in reply to Re: object method question
in thread object method question

sub _setup_dbh { my $self = shift; my $dbh = DBI->connect($foo); *{ref($dbh)."dbq"} = sub { print "I am dbq" }; }
Not that I'm really advocating such a beast, merely mentioning it =]

Replies are listed 'Best First'.
Re^3: object method question
by Tanktalus (Canon) on Oct 11, 2005 at 21:45 UTC

    BUU, you're right, of course, that you could do this. And I knew that when I posted. And I deliberately left it out. Figured it was best not to confuse the poor OP with dangerous things like this ;-)

    Oh, and I think you need a "::" in front of "dbq":

    *{ref($dbh)."::dbq"} = sub { print "I am dbq" };
    ;-)

      Yeah, you're right. Confusing people is fun!