Acme-Locals
view release on metacpan or search on metacpan
"printx $format @fmt_vars"
printf like python/ruby.
"sprintx $format @fmt_vars"
sprintf like python/ruby.
"locals()"
Return a hash of all lexical variables in the current scope. (Using
PadWalker).
"globals()"
Return a hash of all global variables. (Using PadWalker).
"lexicals()"
Alias to "locals()"
PRIVATE CLASS METHODS
DIAGNOSTICS
CONFIGURATION AND ENVIRONMENT
This module requires no configuration file or environment variables.
DEPENDENCIES
examples/locals-python.pm view on Meta::CPAN
sub hi { # Using lexical variables.
my $x = 10;
my $y = 200;
my $name = "George Constanza";
sayx "x: %(x)d y: %(y)d name: %(name)s", locals();
}
sub moo { # Using global variables
our $a = 13.54;
our $b = "world";
sayx "%(a)f: Hello %(b)s", globals();
}
hi();
moo();
inc/Module/AutoInstall.pm view on Meta::CPAN
unshift @$modules, $arg;
$arg = 0;
}
# XXX: check for conflicts and uninstalls(!) them.
if (
defined( my $cur = _version_check( _load($mod), $arg ||= 0 ) ) )
{
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
push @Existing, $mod => $arg;
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
else {
print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
push @required, $mod => $arg;
}
}
next unless @required;
my $mandatory = ( $feature eq '-core' or $core_all );
inc/Module/AutoInstall.pm view on Meta::CPAN
qq{==> Auto-install the }
. ( @required / 2 )
. ( $mandatory ? ' mandatory' : ' optional' )
. qq{ module(s) from CPAN?},
$default ? 'y' : 'n',
) =~ /^[Yy]/
)
)
{
push( @Missing, @required );
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
elsif ( !$SkipInstall
and $default
and $mandatory
and
_prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
=~ /^[Nn]/ )
{
push( @Missing, @required );
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
else {
$DisabledTests{$_} = 1 for map { glob($_) } @tests;
}
}
$UnderCPAN = _check_lock(); # check for $UnderCPAN
if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
require Config;
print
"*** Dependencies will be installed the next time you type '$Config::Config{make}'.\n";
inc/Module/AutoInstall.pm view on Meta::CPAN
require ExtUtils::Manifest;
my $manifest = ExtUtils::Manifest::maniread('MANIFEST');
$args{EXE_FILES} =
[ grep { exists $manifest->{$_} } @{ $args{EXE_FILES} } ];
}
$args{test}{TESTS} ||= 't/*.t';
$args{test}{TESTS} = join( ' ',
grep { !exists( $DisabledTests{$_} ) }
map { glob($_) } split( /\s+/, $args{test}{TESTS} ) );
my $missing = join( ',', @Missing );
my $config =
join( ',', UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
if $Config;
$PostambleActions = (
$missing
? "\$(PERL) $0 --config=$config --installdeps=$missing"
: "\$(NOECHO) \$(NOOP)"
inc/Module/Install.pm view on Meta::CPAN
}
my @exts = @{$self->{extensions}};
unless ( @exts ) {
my $admin = $self->{admin};
@exts = $admin->load_all_extensions;
}
my %seen;
foreach my $obj ( @exts ) {
while (my ($method, $glob) = each %{ref($obj) . '::'}) {
next unless $obj->can($method);
next if $method =~ /^_/;
next if $method eq uc($method);
$seen{$method}++;
}
}
my $who = $self->_caller;
foreach my $name ( sort keys %seen ) {
*{"${who}::$name"} = sub {
lib/Acme/Locals.pm view on Meta::CPAN
}
my $DEFAULT_FORMAT = q{%s};
my $DEFAULT_MODE = '-python';
my %EXPORT_OK = (
sayx => \&sayx,
printx => \&printx,
sprintx => \&sprintx,
locals => \&locals,
globals => \&globals,
lexicals => \&lexicals,
);
my %EXPORT_TAGS = (
':all' => [ keys %EXPORT_OK ],
);
my %MODES = (
'-python' => qr/\%\( (.+?) \)(\w)?/xms,
'-ruby' => qr/\#\{ (.+?) \}/xms,
lib/Acme/Locals.pm view on Meta::CPAN
sub lexicals {
goto &locals;
}
sub locals {
return wantarray ? %{ PadWalker::peek_my(1) }
: PadWalker::peek_my(1);
}
sub globals {
return wantarray ? %{ PadWalker::peek_our(1) }
: PadWalker::peek_our(1);
}
1;
__END__
=begin wikidoc
lib/Acme/Locals.pm view on Meta::CPAN
=== {sprintx $format @fmt_vars}
sprintf like python/ruby.
=== {locals()}
Return a hash of all lexical variables in the current scope. (Using
PadWalker).
=== {globals()}
Return a hash of all global variables. (Using PadWalker).
=== {lexicals()}
Alias to {locals()}
== PRIVATE CLASS METHODS
= DIAGNOSTICS
lib/Acme/Locals.pod view on Meta::CPAN
=head3 C<<< sprintx $format @fmt_vars >>>
sprintf like pythonE<sol>ruby.
=head3 C<<< locals() >>>
Return a hash of all lexical variables in the current scope. (Using
PadWalker).
=head3 C<<< globals() >>>
Return a hash of all global variables. (Using PadWalker).
=head3 C<<< lexicals() >>>
Alias to C<<< locals() >>>
=head2 PRIVATE CLASS METHODS
=head1 DIAGNOSTICS
=head1 CONFIGURATION AND ENVIRONMENT
( run in 0.578 second using v1.01-cache-2.11-cpan-49f99fa48dc )