Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://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/foo.al

sub { print __PACKAGE__ }

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

my ($class,$file,$h,$load,$package); $class = ''; $file = './auto/AutoReloader/foo.al'; $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/foo.al', 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.

--shmem

_($_=" "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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-19 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found