develooper Front page | perl.perl5.porters | Postings from February 2006

Distinguish method/function call during debugger?

Thread Next
Joshua ben Jore
February 23, 2006 14:33
Distinguish method/function call during debugger?
Message ID:
I posted this message on perlmonks but on reflection, it seems like
the kind of thing I'm better off asking p5p about.

I'm writing a small debugger for myself to generate Test::MockObject
scripts. I'm able to trap method calls and function calls but I don't
know how to distinguish between the two. Can any of you help?

The following code results in:
  Deb::meth( Deb=SCALAR(0x97f3c4c) )
  Deb::func( Deb=SCALAR(0x97f3c4c) )

    $ENV{PERL5DB} = '';
    $^P = 0x01; # Debug subroutine enter/exit.

$obj = bless do { \ my $x }, "Deb";
Deb::func( $obj );

sub Deb::meth { }
sub Deb::func { }

package DB;
sub sub {
    print "$sub( " . join( ', ', @_ ) . " )\n";


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About