Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^5: XP and slashes?

by ikegami (Patriarch)
on Apr 05, 2009 at 08:18 UTC ( [id://755541]=note: print w/replies, xml ) Need Help??


in reply to Re^4: XP and slashes?
in thread XP and slashes?

That fails if the caller also uses (say) Parse::RecDescent. If you did want to use %INC, it would be:
use Cwd qw( realpath ); use File::Basename qw( dirname ); use File::Spec::Functions qw( catdir ); my $mod = __PACKAGE__; $mod =~ s{::}{/}g; $mod .= '.pm'; $mod = $INC{$mod}; my $module_dir_qfn = dirname(realpath($mod)); my $db_dir_qfn = catdir($module_dir_qfn, 'db');

But there's no need to waste four lines getting the file name when it's already provided for you.

Replies are listed 'Best First'.
Re^6: XP and slashes?
by hsmyers (Canon) on Apr 05, 2009 at 09:11 UTC
    Arggggh! Good point! Not just cumbersome, but wrong. Well that is what version numbers are for!! Thanks for the correction.

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
Re^6: XP and slashes?
by hsmyers (Canon) on Apr 05, 2009 at 09:50 UTC
    Since File::Spec::Functions doesn't export dirname, what did you mean?

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://755541]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-03-28 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found