Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures
Parag == Parag Kalra paragka...@gmail.com writes: Parag Do we have any Perl module which can parse any other perl script Parag (or module) and fetch information like total number of arrays Parag being used, total number of hashes, total number of scalar Parag variables etc and size information (like total elements, total Parag keys etc) for each data structure in that perl script or may be Parag another perl module It's not possible to completely parse Perl statically [1], although PPI [2] is pretty close and usable for most programs. [1] http://www.perlmonks.org/index.pl?node_id=44722 [2] http://search.cpan.org/~adamk/PPI-1.215/lib/PPI.pm -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.posterous.com/ for Smalltalk discussion -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures
On 12-02-08 05:20 PM, Parag Kalra wrote: Do we have any Perl module which can parse any other perl script (or module) and fetch information like total number of arrays being used, total number of hashes, total number of scalar variables etc and size information (like total elements, total keys etc) for each data structure in that perl script or may be another perl module Thanks, Parag I haven't found a module to do exactly what you want, but B::Xref may do for a start: perl -MO=Xref myscript See `perldoc B::Xref` for details. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Perl Module to parse any other Perl script/module to fetch stats about data-structures
Do we have any Perl module which can parse any other perl script (or module) and fetch information like total number of arrays being used, total number of hashes, total number of scalar variables etc and size information (like total elements, total keys etc) for each data structure in that perl script or may be another perl module Thanks, Parag
Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures
On 2012.02.08 17:20, Parag Kalra wrote: Do we have any Perl module which can parse any other perl script (or module) and fetch information like total number of arrays being used, total number of hashes, total number of scalar variables etc and size information (like total elements, total keys etc) for each data structure in that perl script or may be another perl module I've written such to identify subs within my own apps for which I've written numerous interconnected modules, but never had the need to see individual elements. Even my own internal traces didn't follow single elements. I would suspect that this would be something that would have to run against the file itself, even prior to compile. Curious task. Might I ask what the purpose of your desire is? Steve -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures
于 2012-2-9 10:15, Steve Bertrand 写道: I would suspect that this would be something that would have to run against the file itself, even prior to compile. Curious task. Might I ask what the purpose of your desire is? I am also not sure what's the special purpuse of the OP. Some modules on CPAN under the namespace of Devel::* may help him. Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures
By data-structures being used, I mean the data structures that are actually *declared* in the script. And is it possible to find at least the data-structures stats of the current script that is getting executed if no parser is available. For example if I have a big script or module and if I want to find total arrays, hashes and variables declared in that script. Is there any special variable where this info is stored. Thanks, Parag On Wed, Feb 8, 2012 at 6:31 PM, Jeff Peng p...@staff.dnsbed.com wrote: 于 2012-2-9 10:15, Steve Bertrand 写道: I would suspect that this would be something that would have to run against the file itself, even prior to compile. Curious task. Might I ask what the purpose of your desire is? I am also not sure what's the special purpuse of the OP. Some modules on CPAN under the namespace of Devel::* may help him. Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures
于 2012-2-9 15:21, Parag Kalra 写道: By data-structures being used, I mean the data structures that are actually *declared* in the script. And is it possible to find at least the data-structures stats of the current script that is getting executed if no parser is available. For example if I have a big script or module and if I want to find total arrays, hashes and variables declared in that script. Is there any special variable where this info is stored. I'm not sure, but you may take a look at this module: http://search.cpan.org/~flora/perl-5.14.2/ext/Devel-Peek/Peek.pm http://search.cpan.org/%7Eflora/perl-5.14.2/ext/Devel-Peek/Peek.pm HTH.