Perlish way to get absolute path of current working directory?

Discussion in 'Perl Misc' started by Bob Walton, Sep 26, 2003.

  1. Bob Walton

    Bob Walton Guest

    Is there a Perlish non-OS-dependent way to get the absolute path of the
    current working directory of a Perl program? Thanks.
    --
    Bob Walton
     
    Bob Walton, Sep 26, 2003
    #1
    1. Advertising

  2. Bob Walton wrote:
    > Is there a Perlish non-OS-dependent way to get the absolute path of
    > the current working directory of a Perl program?


    Has been answered several times in the last two days:

    perldoc Cwd

    jue
     
    Jürgen Exner, Sep 26, 2003
    #2
    1. Advertising

  3. Bob Walton <> wrote:

    > Is there a Perlish non-OS-dependent way to get the absolute path of the
    > current working directory of a Perl program? Thanks.


    use FindBin;
     
    David K. Wall, Sep 26, 2003
    #3
  4. Bob Walton <> writes:

    > Is there a Perlish non-OS-dependent way to get the absolute path of
    > the current working directory of a Perl program? Thanks.


    use Cwd;

    my $dir = cwd;

    --
    perl -e '$;=q,BllpZllla_nNanfc]^h_rpF,;@;=split//,
    $;;$^R.=--$=*ord for split//,$~;sub _{for(1..4){$=
    =shift;$=--if$=!=4;while($=){print chr(ord($;[$%])
    +shift);$%++;$=--;}print " ";}}_(split//,$^R);q;;'
     
    Ryan Shondell, Sep 26, 2003
    #4
  5. Bob Walton

    Vlad Tepes Guest

    On the CCLXIX'th day of the MMIII'rd year, Bob Walton spoketh:

    > Is there a Perlish non-OS-dependent way to get the absolute path of
    > the current working directory of a Perl program? Thanks.


    use Cwd;
    my $dir = getcwd;

    --
    (,_ ,_, _,)
    /|\`\._( )_./'/|\
    · · \/ L /\ D · ·
    /__|.-'`-\_/-`'-.|__\
    ` " `
     
    Vlad Tepes, Sep 26, 2003
    #5
  6. "Jürgen Exner" <> wrote:

    > Bob Walton wrote:
    >> Is there a Perlish non-OS-dependent way to get the absolute path of
    >> the current working directory of a Perl program?

    >
    > Has been answered several times in the last two days:
    >
    > perldoc Cwd
    >


    Ok. Why not FindBin?
     
    David K. Wall, Sep 26, 2003
    #6
  7. David K. Wall wrote:
    > Bob Walton <> wrote:
    >
    >> Is there a Perlish non-OS-dependent way to get the absolute path of
    >> the current working directory of a Perl program? Thanks.

    >
    > use FindBin;


    The OP was explicitely asking for the current working directory.
    Exactly which function or variable in FindBin does provide this information?

    jue
     
    Jürgen Exner, Sep 26, 2003
    #7
  8. David K. Wall wrote:
    > "Jürgen Exner" <> wrote:
    >
    >> Bob Walton wrote:
    >>> Is there a Perlish non-OS-dependent way to get the absolute path of
    >>> the current working directory of a Perl program?

    >>
    >> Has been answered several times in the last two days:
    >>
    >> perldoc Cwd

    >
    > Ok. Why not FindBin?


    Because FindBin does not provide any information about the current working
    directory?

    jue
     
    Jürgen Exner, Sep 26, 2003
    #8
  9. Jürgen Exner <> wrote:

    > David K. Wall wrote:
    >> "Jürgen Exner" <> wrote:
    >>
    >>> Bob Walton wrote:
    >>>> Is there a Perlish non-OS-dependent way to get the absolute
    >>>> path of the current working directory of a Perl program?
    >>>
    >>> Has been answered several times in the last two days:
    >>>
    >>> perldoc Cwd

    >>
    >> Ok. Why not FindBin?

    >
    > Because FindBin does not provide any information about the current
    > working directory?


    Oh, duh. <smack self>

    --
    David Wall
     
    David K. Wall, Sep 26, 2003
    #9
  10. Jürgen Exner <> wrote:

    > The OP was explicitely asking for the current working directory.
    > Exactly which function or variable in FindBin does provide this
    > information?


    None of them, of course. I think I'm getting senile.

    --
    David Wall
     
    David K. Wall, Sep 26, 2003
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Francesco Gallarotti

    absolute path to current application

    Francesco Gallarotti, Feb 26, 2004, in forum: Java
    Replies:
    10
    Views:
    9,694
    Jon A. Cruz
    Feb 28, 2004
  2. RonS
    Replies:
    5
    Views:
    4,458
  3. James Byrne
    Replies:
    3
    Views:
    625
    James Byrne
    Sep 14, 2010
  4. hofer
    Replies:
    8
    Views:
    119
  5. pgodfrin

    File edits in a Perlish way

    pgodfrin, Sep 29, 2008, in forum: Perl Misc
    Replies:
    13
    Views:
    157
    Tad J McClellan
    Sep 30, 2008
Loading...

Share This Page