Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Clawing my way out of operator overloading hell

by chunlou (Curate)
on Aug 01, 2003 at 01:37 UTC ( #279829=note: print w/replies, xml ) Need Help??


in reply to Clawing my way out of operator overloading hell

I once used Aspect. I was trying to trace the double quotes operator (that's what's being called implicitly when using print). The following is an example.
use strict; use warnings; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - use Aspect qw(advice calls returns around) ; my $aspect = advice( calls(qr/^(Quantum|main)::(.*)/), sub { printf "calling -> %s\n", $::thisjp->sub } ); $aspect->enable; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - use Quantum::Entanglement; sub foo { my $die = entangle( 1=>1, 1=>2, 1=>3, 1=>4, 1=>5, 1=>6 ); print "$die" ; # observed state print "\n" ; } foo(); __END__ calling -> main::foo calling -> main::entangle calling -> Quantum::Entanglement::_new calling -> Quantum::Entanglement::("" calling -> Quantum::Entanglement::_normalise 3 calling -> Quantum::Entanglement::DESTROY calling -> Quantum::Entanglement::_rationalise_states calling -> Quantum::Entanglement::_unravel

Replies are listed 'Best First'.
Re: Re: Clawing my way out of operator overloading hell
by skyknight (Hermit) on Aug 01, 2003 at 16:28 UTC
    Interesting. Both your reply and ViceRaid's below are the kind of answers for which I was searching. In fact, it seems that the other comment-makers are right, in that the code was comparing two references directly, but this has been a good, all-around learning experience regardless. Fun stuff.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://279829]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2016-12-10 21:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (165 votes). Check out past polls.