you know you're deep in code

Wednesday, May 22, 2002, at 07:27AM

By Eric Richardson

You know you're deep in code when you sit down to write a little test script to see how something works and it comes out like the following... (Click to see)

The code:


use Symbol;

my $obj = foobar->init();
my $a = $obj->can("foo");
*{qualify_to_ref("foobar::foo")} = \&foo;

sub foo { print "bar\n"; &{$_[1]}; }


package foobar;
sub init { return bless({},shift); }
sub foo { print "foo\n"; }

Like usual, this is code for eThreads. It plays with fun Perl globs and coderefs.