Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.perl.misc > #8812

Re: using Exporter::export_fail

From Rainer Weikusat <rweikusat@mssgmbh.com>
Newsgroups comp.lang.perl.misc
Subject Re: using Exporter::export_fail
Date 2013-07-22 19:47 +0100
Message-ID <87mwpel9dv.fsf@sapphire.mobileactivedefense.com> (permalink)
References <51ec36ff$0$6548$9b4e6d93@newsspool4.arcor-online.net> <pjstba-u641.ln1@anubis.morrow.me.uk> <51ec5a7b$0$6562$9b4e6d93@newsspool4.arcor-online.net> <877ggin1hm.fsf@sapphire.mobileactivedefense.com> <51ed6ef3$0$6572$9b4e6d93@newsspool3.arcor-online.net>

Show all headers | View raw


"A.  Sicken" <AndSiPerl@Arcor.De> writes:
> Rainer Weikusat wrote:
>> "A.  Sicken" <AndSiPerl@Arcor.De> writes:

[...]

>>> Ok. The method I want to get rid of is the export_fail-method (not the
>>> local tied enable_debug var or the symbol) because you can call it on
>>> every object created through this modul.
>> 
>> And what's the problem with that? 'class modules' I'm using usually
>> also contain auxiliary subroutines which could also be called 'on
>> every object' except that this wouldn't be particularly useful

[...]

> Many modules are base-class modules to many oher modules - either directly 
> (as parent) or indirectly (as grand parent).

[...]

> the export-fail method is implicite called if it exists and it 
> will exists by all module siblings (in case of inheritance).

This is not quite true: According to the documentation,
Exporter::import will end up calling the export_fail method when an
import of a symbol listed in @EXPORT_FAIL is attempted. Modules/
classes not using that would be unaffected. For others, the default
behaviour of turning every attempt to import something on @EXPORT_FAIL
into a compile-time error would change. A workaround for that could be
to add

return &Exporter::export_fail unless $_[0] eq __PACKAGE__;

as first line to your export_fail method. This would forward the call
to the default implementation unless the method was called 'directly'
via the module/ class defining it.

Back to comp.lang.perl.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

using Exporter::export_fail "A.  Sicken" <AndSiPerl@Arcor.De> - 2013-07-21 21:31 +0200
  Re: using Exporter::export_fail Ben Morrow <ben@morrow.me.uk> - 2013-07-21 21:23 +0100
    Re: using Exporter::export_fail "A.  Sicken" <AndSiPerl@Arcor.De> - 2013-07-22 00:02 +0200
      Re: using Exporter::export_fail Ben Morrow <ben@morrow.me.uk> - 2013-07-22 12:49 +0100
        Re: using Exporter::export_fail "A.  Sicken" <AndSiPerl@Arcor.De> - 2013-07-22 20:19 +0200
          Re: using Exporter::export_fail Ben Morrow <ben@morrow.me.uk> - 2013-07-22 22:41 +0100
      Re: using Exporter::export_fail Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-22 14:55 +0100
        Re: using Exporter::export_fail "A.  Sicken" <AndSiPerl@Arcor.De> - 2013-07-22 19:42 +0200
          Re: using Exporter::export_fail Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-22 19:47 +0100
            Re: using Exporter::export_fail - SOLVED "A.  Sicken" <AndSiPerl@Arcor.De> - 2013-07-22 23:33 +0200
              Re: using Exporter::export_fail - SOLVED Ben Morrow <ben@morrow.me.uk> - 2013-07-23 00:14 +0100

csiph-web