Normally when I am writing the perl program . I used to include following package .
use strict ;
use warnings ;
use Data::Dumper ;
Now , I want like this, I will not include all this package for every program . for that
I will have these all package in my own package. like following.
my_packages.pm
package my_packages ;
{
use strict ;
use warnings ;
use Data::Dumper;
}
1;
So, that if I add my_packages.pm in perl program , it needs have all above packages .
Actually I have done this experimentation . But I am not able get this things . which means when I am using my_packages . I am not able get the functionality of "use strict, use warnings , use Data::Dumper ".
Someone help me out of this problem.....
Have a look at
ToolSet
, which does all the dirty import work for you.Usage example from pod:
Creating a ToolSet:
Using a ToolSet:
/I3az/
See this:
And now:
Taken from Modern::Perl.
This is harder than you expect.
For pragmas like
strict
andwarnings
you can pass them through.For modules that don't export functions such as object oriented ones, it will work.
However for modules that export by default, like Data::Dumper (it gives you the
Dumper()
function in the package of the caller), it is trickier.You can make it work by telling
Exporter
that there is an extra layer of magic:So you could do:
For three modules, this hardly seems to be worth it.