* On Fri, Jul 18 2008, Bill Ward wrote:
> Sorry for replying to an old thread... but I was catching up on old email.
>
> It occurs to me that if we had the behavior that OO method calling
> would reject any imported modules, wouldn't that solve the problem?  

How do you tell what an imported subroutine is?

There is lots of valid OO code that works exactly like Exporter, namely:

  *{ "${caller}::foo" } = sub { ... }

I don't see a way to implement what you want without making Perl
unusable for modern development. :)

> I can't think of any reason you would want to use an imported
> subroutine as an object method

Roles/traits.  OO is more than inheritance these days.

Anyway, I think the conflicting imports can be solved with
Sub::Exporter.  It lets you rename the imports to something useful.
Obviously not every module on CPAN uses S::Ex, but they should start.
In the mean time, you can work around with something like:

  package Work::Around;
  use strict; use warnings;
  use Sub::Exporter -setup => { exports => [qw/foo bar/] };
  use Broken::Module qw(foo bar);
  1;

Untested, but something like that.

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"

Reply via email to