Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by blazar (Canon)
on May 28, 2007 at 21:47 UTC ( #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
Node Status?
node history
Node Type: note [id://617887]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2021-05-10 19:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (106 votes). Check out past polls.

    Notices?