Acme-Locals

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

  url: http://module-build.sourceforge.net/META-spec-v1.3.html
  version: 1.3
name: Acme-Locals
no_index: 
  directory: 
    - examples
    - devel
    - inc
    - t
requires: 
  PadWalker: 0
  Params::Util: 0
  perl: 5.6.0
  version: 0
version: 0.0.1

Makefile.PL  view on Meta::CPAN


my $THIS_VERSION = '0.0.1';

name                'Acme-Locals';
author              'Ask Solem <asksh@cpan.org>';
version             $THIS_VERSION;
license             'bsd';
all_from            'lib/Acme/Locals.pm';

requires            'version'          => 0;
requires            'PadWalker'        => 0;
requires            'Params::Util'     => 0;

build_requires      'Test::Simple'     => 0.42;
build_requires      'Scalar::Util'     => 1.14;

perl_version        5.006_000;

no_index            directory => 'examples';

no_index            directory => 'devel';

README  view on Meta::CPAN

    print/puts like python/ruby.

   "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
    *   version

    *   PadWalker

    *   Params::Util

INCOMPATIBILITIES
    None known.

BUGS AND LIMITATIONS
    No bugs have been reported.

    Please report any bugs or feature requests to

lib/Acme/Locals.pm  view on Meta::CPAN

# $Revision$
# $Date$
package Acme::Locals;

use strict;
use warnings;
use version; our $VERSION = qv('0.1.1');
use 5.00600;

use Carp            qw(carp croak);
use PadWalker       ();
use Params::Util    qw(_SCALAR _ARRAY);

BEGIN {
    use English qw(-no_match_vars);
    my $find_best_say = sub {
        eval q{use Perl6::Say}; ## no critic
        return if not $EVAL_ERROR;
        no warnings 'once'; ## no critic
        *say = sub { print @_, "\n" };
    };

lib/Acme/Locals.pm  view on Meta::CPAN

        push @binds, ${ $value_ref };

        return defined $format_char ? q{%} . $format_char
                                    : $DEFAULT_FORMAT;
    };

    my $mode = $mode_for_class{$call_class} || $DEFAULT_MODE;
    my $re   = $MODES{ $mode };

    if ($mode eq '-ruby' && !scalar keys %bind_vars) {
        %bind_vars = %{ PadWalker::peek_my($peek_level) };
    }
    
    $fmt =~ s/$re/$map_bind_var->($1, $2)/xmseg;

    return sprintf $fmt, @binds;
}

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

= NAME

lib/Acme/Locals.pm  view on Meta::CPAN


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

* [version]

* [PadWalker]

* [Params::Util]

= INCOMPATIBILITIES

None known.

= BUGS AND LIMITATIONS

No bugs have been reported.

lib/Acme/Locals.pod  view on Meta::CPAN


printf like pythonE<sol>ruby.

=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

lib/Acme/Locals.pod  view on Meta::CPAN

=item *

L<version>

=back

=over

=item *

L<PadWalker>

=back

=over

=item *

L<Params::Util>

=back



( run in 0.827 second using v1.01-cache-2.11-cpan-05444aca049 )