Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

autobox

by jmcnamara (Monsignor)
on Oct 14, 2003 at 16:03 UTC ( [id://299162]=perlnews: print w/replies, xml ) Need Help??


autobox "endows Perl's core datatypes with the capabilities of first-class objects".

This is best demonstrated with an example:

#!/usr/bin/perl5.8.1-autobox -w use autobox SCALAR => 'Print'; package Print; sub print {print $_[0], "\n"}; 1; "Just Another Perl Hacker"->print(); __END__

And when you run it:

$ ./autobox.pl It's Perl Jim, but not as we know it.

Or (perhaps) the first autobox JAPH (with the above Print in a separate package):

perl5.8.1-autobox -Mautobox="SCALAR,Print" -MPrint -e '"Just Anoth +er Perl Hacker"->print()'

Or consider the following example from the pod:

my $schwartzian = [ @_ ]->map(...)->sort(...)->map(...);
Let the holy wars commence.

--
John.

Replies are listed 'Best First'.
Re: autobox
by thelenm (Vicar) on Oct 14, 2003 at 16:28 UTC

    For further reference, this was also discussed at length on perl5-porters. You can find the discussion archived here.

    -- Mike

    --
    XML::Simpler does not require XML::Parser or a SAX parser. It does require File::Slurp.
    -- grantm, perldoc XML::Simpler

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlnews [id://299162]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found