I forgot to add that on the version of perl I am using (5.005_03), the
following doesn't seem to work:

Use File::Spec::Unix qw(catfile);

This is a pain. Anyone know why this might be?


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 14 February 2003 15:27
To: Gazi, Nasser (London); [EMAIL PROTECTED]
Subject: RE: Help - Trying to use File::Spec module



------------------------------------------------
On Fri, 14 Feb 2003 15:07:21 -0000, "Gazi, Nasser (London)"
<[EMAIL PROTECTED]> wrote:

> I'm trying to use the catfile method in the File::Spec module. The 
> following program (called test.pl):
> 
>       Use File::Spec::Unix;
>       $c = catfile("aa", "bb");       # line 2
> 
> Gives this error: "Undefined subroutine &main::catfile at test.pl line 
> 4".
> 
> I've set PERL5LIB to the correct directory, but it still doesn't work. 
> Any ideas?

the function 'catfile' is not exported by default (aka into the 'main'
namespace) so you either have to fully qualify it:

File::Spec::Unix::catfile()

Or import it explicitly (assuming it is allowed to be exported)

use File::Spec::Unix qw( catfile );

Or it appears you can do the more simple,

use File::Spec::Functions;

Notice also that you should *not* be using the 'Unix' module directly but
use the File::Spec generic module and let it pick whatever module is correct
for the particular system where the app runs. From the docs:

" The module appropriate for the current OS is automatically loaded by
File::Spec. "

perldoc File::Spec

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to