[Bristolbathpm] Portable code reuse, a question about Perl

Gavin Ford revford at blueyonder.co.uk
Thu May 1 11:08:20 BST 2008


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?

-- 
Gav Ford
revford at blueyonder.co.uk 
http://revford.pwp.blueyonder.co.uk 
I think we need to:  Deflect the energon condenser
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.bristolbath.org/pipermail/bristolbathpm/attachments/20080501/86f6e44a/attachment.bin 


More information about the BristolBathPM mailing list