[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] How can a module learn its own location?



I am writing a .pm module which will need to read certain information files
in the same folder.  I wish to refer to those files knowing their location
only relative to the .pm module.  The Cwd::cwd() function is not
appropriate since the working directory is set by the calling script and is
probably different than the directory of the module in use.  Here is
example:

1.  the Schubert folder contains these files --
"QUINTET.pm"
"Trout score" (information used by QUINTET.pm)
"Forelle Partitur" (another info file)

2.  inside any calling ".pl" script --

use Schubert::QUINTET

3.  inside BEGIN block of Schubert:QUINTET script --

my $violin = unknown_function(); # tells pathname of this module
use File::Basename;
my $cello = dirname($violin);
my $piano = $cello.":"."Trout score"; # later we will 'open (FH, $piano);'
my $viola = $cello.":"."Forelle Partitur";


What is unknown_function() ?

TIA,
Genji



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch