in reply to tool to automatic update legacy code to English module usage
#!/usr/bin/perl use strict; use warnings; use PPI; my $script; { local $/ = undef; $script = <DATA>; } my $doc = PPI::Document->new(\$script); my $vars = $doc->find('PPI::Statement::Variable'); my @var_names = map { $_->variables } @$vars; print "$_\n" for @var_names; __END__ #!/usr/bin/perl use strict; use warnings; my $foo = 'bar'; our $blah = 'asdf'; { local $_ = 'hello world'; print $_, $/; }
I was hoping there was a tutorial but I couldn't find one. It seems like PPI::Transform would be the right tool if you can figure out how to use it. I remember reading this article a few years ago - perhaps it will help/inspire you.
Cheers - L~R
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: tool to automatic update legacy code to English module usage
by adamk (Chaplain) on Jul 07, 2009 at 08:48 UTC |