in reply to passing a $var thru a "use module($var)"

Glad chip answered the question ... but why are you doing this? Sure it is neat, but are you planning on using this in production code? Or are you just experimenting with import/export? Personally, while i do find exporting to be handy, i think that importing is a Bad Idea™ Why? Because you can do the same thing in a cleaner fashion with OO.

my $foo = Foo->new({pid => $$}); print $foo->pid; package Foo; use Class::MethodMaker new_hash_init => 'new', get_set => [ qw /foo bar pid/ ] ;
Now, what's going on behind the scene with that code is another story. But i don't have to maintain that, now do i? ;)

But thanks for asking ... i learned a little something today because of it.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: Re: passing a $var thru a "use module($var)"
by chip (Curate) on Mar 16, 2004 at 15:51 UTC
    Object orientation is a tool. It is not the tool. There are many things that need not be OO, and for which OO would actually be an unwelcome complication.

    /me imagines File::Basename->new and shudders

        -- Chip Salzenberg, Free-Floating Agent of Chaos

      Woah ... i never said that OO was the tool ... those are your words, not mine. Please do not take my node out of context.

      Secondly, i said that i didn't like Import, not Export ... where in File::Basename is importing required to use it procedurally? It isn't. Only Export is needed for that.

      Maybe i should clarify ... only Export is needed by the client.

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      
        I see no distinction between import and export. There's no point in exporting if you're not going to import, and you can't import if there was no export. Saying you like one more than the other seems like deliberate nonsense intended to confuse an android named Norman.

            -- Chip Salzenberg, Free-Floating Agent of Chaos

      /me imagines File::Basename->new and shudders
      That's too late for OO. I could only ever imagine basename as a method of a File(Name)? object. If there existed such a class, there'd be no need for File::Basename (FileName->new("/foo/bar/baz")->basename() eq FileName->basename("/foo/bar/baz")).

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.