Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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


Comment on Re: Clawing my way out of operator overloading hell
Download Code
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 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: (3)
As of 2015-08-01 02:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls