1PPIx::EditorTools::FindUVsaerriaCbolnetDreicbPluPatIrexad:t:iPEoednri(lt3o)DroTcouomlesn:t:aFtiinodnVariableDeclaration(3)
2
3
4
6 PPIx::EditorTools::FindVariableDeclaration - Finds where a variable was
7 declared using PPI
8
10 # finds declaration of variable at cursor
11 my $declaration = PPIx::EditorTools::FindVariableDeclaration->new->find(
12 code =>
13 "package TestPackage;\nuse strict;\nBEGIN {
14 $^W = 1;
15 }\nmy \$x=1;\n\$x++;"
16 line => 5,
17 column => 2,
18 );
19 my $location = $declaration->element->location;
20
22 Finds the location of a variable declaration.
23
25 new()
26 Constructor. Generally shouldn't be called with any arguments.
27
28 find( ppi => PPI::Document $ppi, line => $line, column => $column )
29 =item find( code => Str $code, line => $line, column => $column )
30 Accepts either a "PPI::Document" to process or a string containing
31 the code (which will be converted into a "PPI::Document") to
32 process. Searches for the variable declaration and returns a
33 "PPIx::EditorTools::ReturnObject" with the declaration
34 ("PPI::Statement::Variable") available via the "element" accessor.
35
36 Croaks with a "no token" exception if no token is found at the
37 location. Croaks with a "no declaration" exception if unable to
38 find the declaration.
39
41 This class inherits from "PPIx::EditorTools". Also see
42 App::EditorTools, Padre, and PPI.
43
45 Steffen Mueller "smueller@cpan.org" Mark Grimes "mgrimes@cpan.org"
46
48 Copyright 2008-2009 The Padre development team as listed in Padre.pm.
49
50 This program is free software; you can redistribute it and/or modify it
51 under the same terms as Perl 5 itself.
52
53
54
55perl v5.12.0 P2P0I0x9:-:0E9d-i1t9orTools::FindVariableDeclaration(3)