Sub-Information
view release on metacpan or search on metacpan
my $builder = Module::Build->new(
module_name => 'Sub::Information',
license => 'perl',
dist_author => 'Curtis "Ovid" Poe <ovid@cpan.org>',
dist_version_from => 'lib/Sub/Information.pm',
requires => {
'B' => 0,
'Test::More' => 0,
'Data::Dump::Streamer' => 1.14,
'Devel::Peek' => 0,
'PadWalker' => 0,
'Sub::Identify' => 0,
'Scalar::Util' => 0,
},
add_to_cleanup => ['Sub-Information-*'],
create_makefile_pl => 'traditional',
);
$builder->create_build_script();
author:
- 'Curtis "Ovid" Poe <ovid@cpan.org>'
abstract: Get subroutine information
license: perl
resources:
license: http://dev.perl.org/licenses/
requires:
B: 0
Data::Dump::Streamer: 1.14
Devel::Peek: 0
PadWalker: 0
Scalar::Util: 0
Sub::Identify: 0
Test::More: 0
provides:
Sub::Information:
file: lib/Sub/Information.pm
version: 0.10
generated_by: Module::Build version 0.2808
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
Makefile.PL view on Meta::CPAN
WriteMakefile
(
'PL_FILES' => {},
'INSTALLDIRS' => 'site',
'NAME' => 'Sub::Information',
'EXE_FILES' => [],
'VERSION_FROM' => 'lib/Sub/Information.pm',
'PREREQ_PM' => {
'Test::More' => 0,
'Scalar::Util' => 0,
'PadWalker' => 0,
'Data::Dump::Streamer' => '1.14',
'Sub::Identify' => 0,
'Devel::Peek' => 0,
'B' => 0
}
)
;
lib/Sub/Information.pm view on Meta::CPAN
their or outside of the code reference). The return value is a hashref whose
keys are the names (with sigils) of the variables and whose values are the
values of said variable.
Note that those values will be undefined unless the code is currently "in use"
(e.g., you're calling C<variables()> from inside the sub or in a call stack
the sub is currently in).
The returned values are not cached.
From: C<PadWalker::peek_sub>
=head3 C<line>
my $line_number = $info->line;
Returns the approximate line number where the sub was declared. This is
experimental.
From : C<B>
lib/Sub/Information.pm view on Meta::CPAN
fullname => {
code => sub { Sub::Identify::sub_fullname(shift) }
},
name => {
code => sub { Sub::Identify::sub_name(shift) }
},
package => {
code => sub { Sub::Identify::stash_name(shift) }
},
variables => {
code => sub { PadWalker::peek_sub(shift) }
},
line => { code => sub { B::svref_2object(shift)->START->line } },
file => { code => sub { B::svref_2object(shift)->START->file } },
# XXX I suspect these are useless
#size => { code => sub { Devel::Size::size(shift) } },
#total_size => { code => sub { Devel::Size::total_size(shift) } },
);
$sub_information{variables}{dont_cache} = 1;
#$sub_information{size}{dont_cache} = 1;
#$sub_information{total_size}{dont_cache} = 1;
my %function_from = (
'Scalar::Util' => [qw/address blessed/],
'Data::Dump::Streamer' => ['code'],
'Sub::Identify' => [qw/full_name name package/],
'PadWalker' => [qw/variables/],
#'Devel::Size' => [qw/size total_size/],
);
while ( my ( $package, $methods ) = each %function_from ) {
foreach my $method (@$methods) {
$PACKAGE_FOR{$method} = $package;
}
}
lib/Sub/Information.pm view on Meta::CPAN
=over 4
=item * L<B::Deparse>
=item * L<Devel::Peek>
=item * L<Devel::Size>
=item * L<Data::Dump::Streamer>
=item * L<PadWalker>
=item * L<Sub::Identify>
=item * L<Scalar::Util>
=back
=head1 THANKS
Much appreciation to Adriano Ferreira for providing two very useful patches.
( run in 0.848 second using v1.01-cache-2.11-cpan-05444aca049 )