Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: [Perl 6] Any provision for a "dereferencing object"?

by blazar (Canon)
on May 28, 2007 at 21:47 UTC ( [id://617887]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $a = []; $a->[1]{bar}{baz}[3] = 7;
    bless $a, "hrmph";
    *hrmph::deref = sub { $_[0]->[1]{bar}{baz}[3] };
    print "yeah: ", $a->deref, "\n";
    
  2. or download this
    my $x = []; $x->[1]{bar}{baz}[3] = 7;
    bless $x, "whatever";
    my $deref = sub { $_[0]->[1]{bar}{baz}[3] };
    print "yeah: ", $x->$deref, "\n";
    
  3. or download this
    my $x = []; $x->[1]{bar}{baz}[3] = 7;
    # bless $x, "whatever";
    my $deref = sub { $_[0]->[1]{bar}{baz}[3] };
    print "yeah: ", $x->$deref, "\n";
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-24 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found