Can't run Perl script from outside directory

Discussion in 'Perl Misc' started by lonewolfcsu@gmail.com, Mar 22, 2006.

  1. Guest

    I'm having a problem running a perl script and I'm completely
    dumbfounded on the reason.

    For sake of argument, let's say the script is located at
    /blah/blaugh/blaw/script.pl.

    The following works:
    $ pwd
    /app/home/mylogin
    $ cd /blah/blaugh/blaw
    $ perl script.pl

    This, however, does not:
    $ pwd
    /app/home/mylogin
    $ perl /blah/blaugh/blaw/script.pl

    Any thoughts as to why not? I'm stumped.

    --
    Dave "LoneWolf" Savitsky
     
    , Mar 22, 2006
    #1
    1. Advertising

  2. Guest

    wrote:
    > I'm having a problem running a perl script and I'm completely
    > dumbfounded on the reason.
    >
    > For sake of argument, let's say the script is located at
    > /blah/blaugh/blaw/script.pl.
    >
    > The following works:
    > $ pwd
    > /app/home/mylogin
    > $ cd /blah/blaugh/blaw
    > $ perl script.pl
    >
    > This, however, does not:
    > $ pwd
    > /app/home/mylogin
    > $ perl /blah/blaugh/blaw/script.pl
    >
    > Any thoughts as to why not? I'm stumped.


    What you do you mean by "works"? What do mean by "does not [work]:"?

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Mar 22, 2006
    #2
    1. Advertising

  3. Guest

    In this case, it's just a test script to try and diagnose the problem.

    #! /usr/bin/perl

    open(LOG, ">>/blah/blaugh/blaw/script.log");
    print "Success!\n";
    print LOG "Success!\n";
    close(LOG);
    exit(0);


    When run from the directory the script is in, "Success!" appears both
    in the log and on the screen. When run from some other directory, it's
    not printed at all. Yet I don't get any kind of error message.

    --
    Dave "LoneWolf" Savitsky
     
    , Mar 22, 2006
    #3
  4. Guest

    wrote:
    > In this case, it's just a test script to try and diagnose the problem.
    >


    Is the space in the shebang line a problem?

    > #! /usr/bin/perl


    ## You should ask perl for help before asking us for help!
    use strict;
    use warnings;

    ## See if the program even starts
    warn "Yeah, I started";

    ## You should ask perl for help before asking us for help!
    > open(LOG, ">>/blah/blaugh/blaw/script.log")

    or die "Couldn't open $!";

    ## I don't normally check print, but in a pinch:
    > print "Success!\n"

    or warn "straight print $!";
    > print LOG "Success!\n"

    or warn "LOG print $!";
    > close(LOG)

    or die "Close failed $!";
    > exit(0);
    >
    > When run from the directory the script is in, "Success!" appears both
    > in the log and on the screen. When run from some other directory, it's
    > not printed at all. Yet I don't get any kind of error message.


    You didn't ask for most kinds of error messages!.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Mar 22, 2006
    #4
  5. Guest

    Ok, ignore this whole thread...I'm an idiot. I was typing the wrong
    path to the script. It was a valid path, so there was a script
    running. It was just the wrong path.

    --
    Dave "LoneWolf" Savitsky
     
    , Mar 22, 2006
    #5
    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. dpackwood
    Replies:
    3
    Views:
    1,810
  2. Kristoffer Arfvidson
    Replies:
    7
    Views:
    596
    Shiv Kumar
    Jan 21, 2004
  3. Krzysztof Poc

    outside type, outside function

    Krzysztof Poc, Feb 3, 2012, in forum: C++
    Replies:
    1
    Views:
    288
    Victor Bazarov
    Feb 7, 2012
  4. Replies:
    6
    Views:
    152
    Tad McClellan
    Apr 14, 2005
  5. hara
    Replies:
    6
    Views:
    164
    Peter Scott
    May 27, 2006
Loading...

Share This Page