Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Matts (1087)

  (email not shown publicly)

I work for MessageLabs [] in Toronto, ON, Canada. I write spam filters, MTA software, high performance network software, string matching algorithms, and other cool stuff mostly in Perl and C.

Journal of Matts (1087)

Thursday August 08, 2002
11:16 AM

Closures again

[ #6982 ]

The most interesting thing that came out of my thoughts earlier this week about closures was a description from Artur about how "require" actually works.

Apparently it loads the file, and turns it into a code reference with the body being the body of the anonymous sub. Then after it has been loaded it executes that code reference [*].

It's gems like that that I think would make people see some of the cool internal designs of perl. Yes, I think the above is a good idea - it's reusing one of perl's internal subsystems, and we like reuse, where it's sane.

So next time you're looking at a perl module, you can imagine it wrapped with "sub {" and "}->();" and you'll nicely confuse yourself!

[*] And then does some magic cloning that I didn't really understand ;-)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.