Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
What are the suggested power tools?

An extremely helpful powertool is Data::Dump::Streamer, since it not only outputs data structures or code, but nearly all bits necessary for an object to exist.

From my workbench, AutoReloader version 0.03:

#!/usr/bin/perl -w use strict; use Data::Dump::Streamer; use AutoReloader qw(AUTOLOAD); AutoReloader->check(1); $sub = AutoReloader->gensub("foo"); print $sub; $sub->(); print Dump($sub); __END__ AutoReloader=CODE(0x8337994) AutoReloader

with a file auto/AutoReloader/

sub { print __PACKAGE__ }

Data::Dump::Streamer produces via Dump($sub)

my ($class,$file,$h,$load,$package); $class = ''; $file = './auto/AutoReloader/'; $h = { check => \do { my $v = undef }, checkref => \do { my $v = 1177271972 }, checksub => \sub { package AutoReloader; use warnings; use strict 'refs'; (stat $_[0])[9]; }, file => './auto/AutoReloader/', function => 'AutoReloader::foo', inner => \sub { package AutoReloader; print 'AutoReloader'; }, outer => 'V: $AutoReloader1' }; $load = sub { package AutoReloader; use warnings; use strict 'refs'; my($class, $package, $file, $h) = @_; delete $INC{$file}; my $ref = eval "package $package; require '${file}'"; return undef if $@; { unless (&Scalar::Util::reftype($ref) and &Scalar::Util::re +ftype($ref) eq 'CODE') { $ref = \&{$$h{'function'};}; BEGIN {${^WARNING_BITS} = "TUUU\025UUUUUUU\001"} no strict 'refs'; *{$$h{'function'};} = $$h{'outer'} if $$h{'outer'}; } ${$$h{'inner'};} = $ref; my $sub = sub { BEGIN {${^WARNING_BITS} = "TUUUUUUUUUQU\001"} my $cr = $$h{'checkref'}; my $check; $check = ${$$h{'check'};} if defined ${$$h{'check'};}; if (not defined $check) { $check = $AL{'check'}{$class} if defined $AL{'check'}{ +$class}; } if ($check and ${$$h{'checksub'};} and (my $c = &${$$h{' +checksub'};}($file)) != $$cr) { warn "reloading $file" if $Debug; $$cr = $c; &$load($class, $package, $file, $h); } goto ${$$h{'inner'};}; } ; } }; $package = 'AutoReloader'; $AutoReloader1 = bless( sub { package AutoReloader; BEGIN {${^WARNING_BITS} = "TUUUUUUUUUQU\001"} use strict 'refs'; my $cr = $$h{'checkref'}; my $check; $check = ${$$h{'check'};} if defined ${$$h{'check'} +;}; if (not defined $check) { $check = $AL{'check'}{$class} if defined $AL{'che +ck'}{$class}; } if ($check and ${$$h{'checksub'};} and (my $c = &${ +$$h{'checksub'};}($file)) != $$cr) { warn "reloading $file" if $Debug; $$cr = $c; &$load($class, $package, $file, $h); } goto ${$$h{'inner'};}; }, 'AutoReloader' ); $h->{outer} = $AutoReloader1;

Amazing. It is nearly the entire wheel.


_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re: Understanding Chaos by shmem
in thread Understanding Chaos by logie17

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (2)
    As of 2018-05-21 05:18 GMT
    Find Nodes?
      Voting Booth?