--- David Nicol <[EMAIL PROTECTED]> wrote:
> how is it different from Package::Alias?

You mean, besides the fact that Package::Alias doesn't work? :)

  #!/usr/local/bin/perl
  use Package::Alias Parser => 'HTML::TokeParser::Simple';
  my $parser = Parser->new(\'<html></html>');

Trying to run that gives the following counter-intuitive error:

  Can't locate object method "new" via package
"HTML::TokeParser::Simple"

That fails because Package::Alias merely aliases packages.  It doesn't
actually "use" or "require" packages.  You have to do that first (and
handle the importing yourself.)  It's possible that Joshua was aware of
this issue and simply didn't document this fact, but this is not clear
from the docs (though he's a very sharp guy, so I wouldn't be surprised
if this is merely an oversight.)

I see that I'm really going to have to update the docs because you're
not the first person to ask me "how is this different from X".  See
http://use.perl.org/~Ovid/journal/22615 for another example.

In this case, I am explicitly *not* aliasing typeglobs.  I don't want
to mess with another namespace.  Package::Alias won't alias over a
different namespace if you don't want it to (but you can force it), but
there's nothing stopping something else from coming along and
overwriting the new namespace that's been created.  Mine creates *one*
subroutine and it handles the importing.  That's it.  No muss.  No
fuss.

I should add that even if Joshua decides to have Package::Alias attempt
to load the packages he's aliasing, he has no convenient way of
handling importing with his syntax.

Cheers,
Ovid

=====
Silence is Evil            
http://users.easystreet.com/ovid/philosophy/decency.html
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/

Reply via email to