in reply to jar like feature

You could do:

# use File::Spec if you want to be more portable. # The following supports at least unix and Windows. $dir = ($0 =~ m#^(.*[\\/:])# ? $1 : ''); my $logo = $main->Photo(-file=>$dir."samsunglogo.gif");

or

# use File::Spec if you want to be more portable. # The following supports at least unix and Windows. chdir($1) if ($0 =~ m#^(.*[\\/:])#); my $logo = $main->Photo(-file=>"samsunglogo.gif");

Replies are listed 'Best First'.
Re^2: jar like feature
by TedPride (Priest) on Sep 21, 2004 at 20:09 UTC
    I just tested, and $0 works on Mac (MacPerl), so it's probably good across all platforms.
      I wasn't refering to $0, but to the path seperator. In unix, it's '/'. In Windows, it can be '\' and ':'. I don't know about other OSs. File::Spec contains functions to parse paths, but I was too lazy to lookup the syntax.
        Windows generally accepts forward slashes in addition to the canonical back slashes; it does not use colons -- that's MacOS.