in reply to How to export several modules intu users name space to not have a use ...; use ...; use ...; with the same modules all over again

i think it should works as expected: if you use A that uses B, C and D you have imported B, C and D in the namespaces. Also the code in A is executed so i think you can modify %ENV too. You tried the simple solution?

L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
  • Comment on Re: How to export several modules intu users name space to not have a use ...; use ...; use ...; with the same modules all over again
  • Download Code

Replies are listed 'Best First'.
Re^2: How to export several modules intu users name space to not have a use ...; use ...; use ...; with the same modules all over again
by bigj (Monk) on Jan 12, 2015 at 09:32 UTC
    Sometimes it is too easy :-o It imports the modules like DBI, but it doesn't look like the strict and warnings pragmas are imported also. Update: Also POSIX::strftime doesn't get imported, just only into the module package MyFirma::Standard

    Greetings,
    Janek Schleicher

      ok, never realized all subtitlies (quibbles?) of using.. and in the import of Modern::Perl there is something i dont understand but i can replicate.
      While i suggest following wiser adivice you can play with:
      package FirmaTest { print "welcome to FirmaTest\n"; sub import { use feature (); feature->import ('say'); } use strict; #strictures are imported # while warnings are not #use warnings; seems not enough.. $^W=1; # but setting $^W seems ok! $ENV{'FirmaTest'} = 1;#it works use POSIX qw (strftime); } 1;
      It seems to do the right think you want (notice the windows quotation..):
      perl -MFirmaTest -e " print qq(warnings: $^W\n); print qq(ENV: $ENV{'F +irmaTest'}\n); say qw(saying: aa) my $str = POSIX::strftime( '%B %d, %Y',0, 0, 0, 12, 11, 115, 2 );say +qq(POSIX::strftime: $str) " #output: welcome to FirmaTest warnings: 1 ENV: 1 saying:aa POSIX::strftime: dicembre 12, 2015
      HtH
      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      use strict; is lexical-scope-wise, it is specially designed to behave this way, so you can write
      use strict; .... { no strict; .... } # and here 'use strict' is in effect;
      this is why