in reply to Short invocation for per-object methods

Is $self->debug(...); sufficiently worse than debug ...; to warrant this?

If you do go ahead with this, at least limit the scope of $self.

sub debug { our $self; # Must be set by caller! $self->{'debug'}->(@_); } sub method1 { (local our $self) = @_; debug "Entering method1"; }

(If there are args: (local our $self, my $arg1, my $arg2) = @_;.)

Replies are listed 'Best First'.
Re^2: Short invocation for per-object methods
by Crackers2 (Parson) on Jan 04, 2007 at 07:14 UTC
    Is $self->debug(...); sufficiently worse than debug ...; to warrant this?

    I'd vastly prefer debug ....

    If you do go ahead with this, at least limit the scope of $self.

    That looks cleaner all right.

    But based on both perrin and your answers I'll just go with $self->debug() after all.