On Wed, 2004-04-14 at 21:28, dorian wrote:
> > yes. from DBI.pm:
>
> ah, sneaky.
But totally unnecessary. That voodoo is in the DBI code because the
intention of Apache::DBI is to change the behavior of DBI without
altering the client code in any way. If you have control over the
client code, you can just use a singleton pattern, or a plain old
global.
> this seems to work:
>
> package XMLTest;
>
> use strict;
> use warnings;
>
> use XML::LibXML;
>
> our $XML;
>
> *_new = \&XML::LibXML::new;
> *XML::LibXML::new = \&new;
>
> sub new {
> return $XML ||= _new(@_);
> }
It would work just as well if you made that in your own package and just
had it call XML::LibXML instead of mucking around with some other
module's internals. All you have to do is change the place in your
client code where you call XML::LibXML->new() to call this other package
instead.
- Perrin
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html