Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Clawing my way out of operator overloading hell

by chunlou (Curate)
on Aug 01, 2003 at 01:37 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://279829]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-19 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found