> yes.  from DBI.pm:

ah, sneaky. 

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(@_);
}

1;

__END__

minus a bit of whining about the sub redefinition, of course. observe:

[EMAIL PROTECTED]|~/www/lib] perl -MXMLTest -MXML::LibXML -wle \
'print XML::LibXML->new; print $XMLTest::XML; print XML::LibXML->new'
Subroutine XML::LibXML::new redefined at XMLTest.pm line 11.
XML::LibXML=HASH(0x820fc18)
XML::LibXML=HASH(0x820fc18)
XML::LibXML=HASH(0x820fc18)

not sure if that's sustainable though.

.d

-- 
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

Reply via email to