Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SendMyEmail.pm
- SendMyEmail/defualt_email.tt
- # This is what I would like to do.
- package SendMyEmail;
- sub new {
- my ($self, $template) = @_;
- $template ||= $dir_of_SendMyEmail .'/SendMyEmail/default_email.tt'; # ??
- }
- my $DEFAULT_TEMPLATE;
- BEGIN {
- $DEFAULT_TEMPLATE = __FILE__;
- $DEFAULT_TEMPLATE =~ s,.pm$,/default_email.tt,;
- }
- package Foo::Bar;
- use Cwd qw(abs_path);
- use File::Basename qw(dirname);
- sub module_dir { abs_path(dirname(__FILE__)) }
- 1;
- use Foo::Bar;
- print Foo::Bar->module_dir, "n";
- ## load the module
- use Data::Dumper;
- ## output full path to Data::Dumper module loaded
- print $INC{'Data/Dumper.pm'};
- ## see which module was loaded (if you have multiple folders with same modules)
- print Dumper(%INC);
- perlwhere() {
- perl -wle'eval "require $ARGV[0]" or die; ($mod = $ARGV[0]) =~ s|::|/|g; print $INC{"${mod}.pm"}' $1
- }
Add Comment
Please, Sign In to add comment