Does a Perl module know where it is installed?
- by CoffeeMonster
Hi Perl programmers,
I have started creating a Perl package that contains a default email template.
The MANIFEST looks something like:
SendMyEmail.pm
SendMyEmail/defualt_email.tt
Currently I know where the module (and the template) are - but does the module itself know where on disk it is? So could the module find the default template without my help?
# This is what I would like to do.
package SendMyEmail;
sub new {
my ($self, $template) = @_;
$template ||= $dir_of_SendMyEmail .'/SendMyEmail/default_email.tt'; # ??
}
Is there a better way of including a templates text, or a better place to put the template?
Any references to CPAN modules that do something similar would be welcome.
Thanks in advance.