Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

relative paths in catalyst

by holli (Monsignor)
on Mar 28, 2006 at 14:58 UTC ( #539712=perlquestion: print w/ replies, xml ) Need Help??
holli has asked for the wisdom of the Perl Monks concerning the following question:

Brethren,

I am writing a Catalyst application, that needs to access several files. Currently I'm doing this by using absolute paths.

Now I would like to use path names that are relative to the directory where the applications main module (myApp.pm) is. How can I find this directory?

Update:
When I run the app under mod_perl,
cwd returns "\xampp\apache", $Findbin::Bin returns "\xampp\apache\bin" and $0 returns "\xampp\apache\bin\apache.exe",


holli, /regexed monk/

Comment on relative paths in catalyst
Select or Download Code
Re: relative paths in catalyst
by haoess (Curate) on Mar 28, 2006 at 15:17 UTC
    $c->config->{base} $c->config->{home} gives you the path, where YourApp lives. Perhaps you want $c->config->{home} . '/lib'?

    --Frank

    update: s/base/home/

      On my system, $c->config->{base} is empty :(


      holli, /regexed monk/
        O yes, sorry, it's $c->config->{home}.

        --Frank

Re: relative paths in catalyst
by LTjake (Prior) on Mar 28, 2006 at 15:49 UTC

    You can use the path_to helper:

    $c->path_to( 'bar', 'foo.txt' );

    See the docs for more info.

    --
    "Go up to the next female stranger you see and tell her that her "body is a wonderland."
    My hypothesis is that she’ll be too busy laughing at you to even bother slapping you.
    " (src)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://539712]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2014-12-18 11:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (50 votes), past polls