HI Gavin,

     I think you may be able to put a relative directory in there:
'../lib/MyScript.pl'

     A  bit like a relative URL. But I would also suggest making it a
package and the file can be found in PERL5LIB you're in business.

package MyScript;

# goes here
# and must end with true
1;


Nige

2008/5/1 Dave Hodgkinson <[EMAIL PROTECTED]>:

>
> On 1 May 2008, at 12:08, Gavin Ford wrote:
>
> > As the list is up and going, I thought I'd ask a Perl question.  :)
> >
> > I'm wondering if I'm making things over complicated for myself.
> >
> > I have a few subroutines I reuse in a few scripts, so I moved them
> > to another
> > file in the same directory and link them into each script with
> > something like:
> >
> > use FindBin '$Bin';
> > require "$Bin/lib-rf-iplayer.pl";
> >
> > I had been entering the full path on the require line, but this was
> > a bit
> > rubbish as it needed to be tweaked for different machines or users.
> >
> > But this still feels like I'm going a step too far.
> >
> > Is there a simpler way to require a file relative to the script
> > instead of
> > relative to the working directory?
>
>
> Set a search path outside the script. Add it to PERL5LIB or somesuch.
>
> --
> Dave Hodgkinson                                MSN: [EMAIL PROTECTED]
> Site: http://www.davehodgkinson.com                   UK: +44 7768 49020
> Blog: http://davehodg.blogspot.com                    NL: +31 654 982906
> Photos: http://www.flickr.com/photos/davehodg
>
>
>
>
>
> _______________________________________________
> BristolBathPM mailing list
> [email protected]
> http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm
>
_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm

Reply via email to