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


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

Re: using Exporter::export_fail

Newsgroups comp.lang.perl.misc
Subject Re: using Exporter::export_fail
References <51ec36ff$0$6548$9b4e6d93@newsspool4.arcor-online.net>
From Ben Morrow <ben@morrow.me.uk>
Organization morrow.me.uk
Date 2013-07-21 21:23 +0100
Message-ID <pjstba-u641.ln1@anubis.morrow.me.uk> (permalink)

Show all headers | View raw


Quoth "A.  Sicken" <AndSiPerl@Arcor.De>:
> Hello,
> 
> I want to use the Exporter::export_fail-method to set some internal 
> debugging vars like:
> 
> use MyModul qw/enable_debug/; # to enable debugging messages
> 
> in following code example:
[...]
> 
> Now my questions: Is there a way to use the export_fail method without 
> declaring it within my module MyModul (or to destroy it after its first 
> invokation), because this means anyone can call this method as if it would 
> be a real method?

No. If you must, you can get rid of the method on it's first invocation
by deleting the glob from the symbol table, but I wouldn't recommend
doing that.

You could alternatively write your own import method, which removes
enable_debug from the symbol list and calls Exporter->export_to_level to
do the actual exporting.

Ben

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