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 version 0.21
11
13 # finds declaration of variable at cursor
14 my $declaration = PPIx::EditorTools::FindVariableDeclaration->new->find(
15 code =>
16 "package TestPackage;\nuse strict;\nBEGIN {
17 \$^W = 1;
18 }\nmy \$x=1;\n\$x++;"
19 line => 5,
20 column => 2,
21 );
22 my $location = $declaration->element->location;
23
25 Finds the location of a variable declaration.
26
28 new()
29 Constructor. Generally shouldn't be called with any arguments.
30
31 find( ppi => PPI::Document $ppi, line => $line, column => $column )
32 find( code => Str $code, line => $line, column => $column )
33 Accepts either a "PPI::Document" to process or a string containing
34 the code (which will be converted into a "PPI::Document") to
35 process. Searches for the variable declaration and returns a
36 "PPIx::EditorTools::ReturnObject" with the declaration
37 ("PPI::Statement::Variable") available via the "element" accessor.
38
39 Croaks with a "no token" exception if no token is found at the
40 location. Croaks with a "no declaration" exception if unable to
41 find the declaration.
42
44 This class inherits from "PPIx::EditorTools". Also see
45 App::EditorTools, Padre, and PPI.
46
48 · Steffen Mueller "smueller@cpan.org"
49
50 · Mark Grimes "mgrimes@cpan.org"
51
52 · Ahmad M. Zawawi <ahmad.zawawi@gmail.com>
53
54 · Gabor Szabo <gabor@szabgab.com>
55
56 · Yanick Champoux <yanick@cpan.org>
57
59 This software is copyright (c) 2017, 2014, 2012 by The Padre
60 development team as listed in Padre.pm..
61
62 This is free software; you can redistribute it and/or modify it under
63 the same terms as the Perl 5 programming language system itself.
64
65
66
67perl v5.28.0 P2P0I1x7:-:1E2d-i2t4orTools::FindVariableDeclaration(3)