App-Cheats

 view release on metacpan or  search on metacpan

cheats.txt  view on Meta::CPAN


#############################################################
## Perl Modules - overload
#############################################################

# Perl Modules - overload example code.
pod Set::Scalar::Base -e


#############################################################
## Perl Modules - PadWalker
#############################################################

# View the lexical variables in a scope.
perl -MPadWalker=peek_my -Mojo -E 'my $var=123; say r peek_my(0)'
{
  "\$var" => \123
}

# Call a method of an object obtained from peek_my
perl -MDevel::Peek -MPadWalker=peek_my -Mojo -E '{ package My; sub Func {"My-Func"} } my $var =  bless {}, "My"; my $obj_ref = peek_my(0)->{q($var)}; Dump $var; Dump $obj_ref; say $$obj_ref->Func'

# Update a lexical variable in a different scope.
my $lexicals = peek_my(1);
$lexicals->{'@arr'}->[1] = 4;


#############################################################
## Perl Modules - PadWalker::Eval
#############################################################

# Idea for a new module to run eval at a specific scope.
perl -E 'my $v=1; {package My; my $v=2; sub run_code { my ($code) = @_; my $v=3; eval $code }} my $v=4, say My::run_code(q($v))'

# PadWalker::Eval ideas.
sub eval ($string, $scope_level=0)


#############################################################
## Perl Modules - Parallel::ForkManager
#############################################################

# Simple exmplae of parallel processing
# (Perl Modules - Parallel::ForkManager)
# About 3 times slower than using threads!!!



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