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

Reply via email to