Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

autobox

by jmcnamara (Monsignor)
on Oct 14, 2003 at 16:03 UTC ( #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
Node Status?
node history
Node Type: perlnews [id://299162]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2020-07-06 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?