Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: changing object's methods at runtimeby Zaxo (Archbishop) |
on May 22, 2003 at 01:32 UTC ( [id://259961]=note: print w/replies, xml ) | Need Help?? |
You can change a method at runtime with a scoped application of { local *Apache::FakeRequest::lookup_uri = sub { '127.0.0.1' } ...} Here's an example using CGI.pm: That does not change the behavior for just a single object, but for all objects of the class within the local dynamic scope. As othermonks said, subclass for specializing a single instance. After Compline,
In Section
Seekers of Perl Wisdom
|
|