>>>>> "BD" == Brent Dax <[EMAIL PROTECTED]> writes:

  BD> # >       1. Choosing where to export to:
  BD> # >               use Data::Dumper 'Dumper' => 'dumpvar';
  BD> # >               #exports Data::Dumper::Dumper to Main::dumpvar
  BD> # (or whatever)
  BD> #
  BD> # Where to import to.  It's probably not a good idea to export
  BD> # into someone
  BD> # else's namespace.  (Pull vs Push).

  BD> Ack, I hate terminology bugs.  Import to.  As for someone else's
  BD> namespace, under the current implementation (*bursts out
  BD> laughing*) that don't work too well anyway.

i already support that type of customized import in a trace/debug
module. in the use line i pass in an option key/value pair of sub =>
name and the sub is imported with that name. as the sub is a closure and
can be one of several calling styles (selected by another option), you
can import it multiple times (with multiple use statements) and get
different imported subs.

it looks like this:

use Debug sub => 'foo', style => 'text_args', level => 5 ;
use Debug sub => 'bar', style => 'key_value', level => 3 ;

        foo 'send text only to debug system' ;

        bar 'text' => 'send this text, override the level', level => 4 ;

this is all done by a single import sub in that module. in fact it is
the only sub in that module.

generalizing this to be used in Exporter would not be easy as it creates
closures (e.g. storing the debug level) and can even select the code ref
to use. you would have to pass too much info to Exporter to make this
work.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to