Acme::ReturnValue - report interesting module return values
use Acme::ReturnValue; my $rvs = Acme::ReturnValue->new; $rvs->in_INC; foreach (@{$rvs->interesting}) { say $_->{package} . ' returns ' . $_->{value}; }
Acme::ReturnValue will list 'interesting' return values of modules. 'Interesting' means something other than '1'.
Acme::ReturnValue
run from the commandline (via acme_returnvalue.pl
my $data = $arv->waste_some_cycles( '/some/module.pm' );
waste_some_cycles parses the passed in file using PPI. It tries to get the last statement and extract it's value.
waste_some_cycles
waste_some_cycles returns a hash with following keys
file
The file
package
The package defintion (the first one encountered in the file
value
The return value of that file
waste_some_cycles will also put this data structure into interesting or boring.
You might want to pack calls to waste_some_cycles into an eval because PPI dies on parse errors.
eval
Stolen directly from Perl::Critic::Policy::Modules::RequireEndWithOne as suggested by Chris Dolan.
Thanks!
$arv->in_INC;
Collect return values from all *.pm files in @INC.
@INC
$arv->in_dir( $some_dir );
Collect return values from all *.pm files in $dir.
$dir
$arv->in_file( $some_file );
Collect return value from the passed in file.
If waste_some_cycles failed, puts information on the failing file into failed.
Returns an ARRAYREF containing 'interesting' modules.
Returns an ARRAYREF containing 'boring' modules.
Returns an ARRAYREF containing unparsable modules.
Probably many, because I'm not sure I master PPI yet.
Thomas Klausner, <domm@cpan.org>
<domm@cpan.org>
Thanks to Armin Obersteiner and Josef Schmid for input during very early development
Please report any bugs or feature requests to bug-acme-returnvalue@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-acme-returnvalue@rt.cpan.org
Copyright 2008 Thomas Klausner
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Acme::ReturnValue, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Acme::ReturnValue
CPAN shell
perl -MCPAN -e shell install Acme::ReturnValue
For more information on module installation, please visit the detailed CPAN module installation guide.