in reply to changing object's methods at runtime
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.use CGI; my $q = CGI->new({foo=>'bar'}); print $q->param('foo'),$/; { local *CGI::param = sub {}; print "Empty", $/ unless defined $q->param('foo'); } print $q->param('foo'),$/;
After Compline,
Zaxo
|
---|