Perl script not running properly...

Discussion in 'Perl Misc' started by abstractjoe, Jul 11, 2003.

  1. abstractjoe

    abstractjoe Guest

    Hi,

    I wrote a CGI script in Perl(see below) and when I execute ./ in Unix
    console it works just fine. However, when I use it in an html page it
    doesn't work.

    Below is the form tag within my html page.

    <form name="the_script" method="POST"
    action="http://www.mydomain.com/cgi-bin/the_script.cgi">
    <input type="submit" value="the_script">

    So, when I hit submit it takes me to the redirect, however when I
    check the files to see if they are replaced, nothing...

    If I just run the script in Unix via ./ the files are replaced...
    weird.

    Below is the CGI script:

    #! /usr/bin/perl
    use File::Find;
    use File::Copy;
    use File::path;

    my $top_src = "/usr/local/whatever";
    my $dest = "/usr/local/htdocs/whatever";

    find sub {
    ##might need it for later on
    ##ignore non html files
    return unless -f ;

    my $more_subdir;
    for ( $more_subdir = $File::Find::dir) {
    s#^\Q$top_src##;
    s#^/##;
    }

    ## don't copy if we already have a later file
    if (-e "$dest/$more_subdir/$_" and -M "$dest/$more_subdir/$_" <= -M
    $_) {
    ## tracing: turn off when you're happy
    warn "ignoring older $File::Find::name\n";
    return;
    }

    mkpath( ["$dest/$more_subdir"], 0, 0711); # $dest must be an
    absolute

    ## tracing: turn off when you're happy
    $content = warn "copying $File::Find::name to
    $dest/$more_subdir/$_\n";
    copy $_, "$dest/$more_subdir/$_";
    }, $top_src;

    $url = "http://www.mydomain.com/redirect.html";
    print "Location: $url\n\n";
    exit;
    abstractjoe, Jul 11, 2003
    #1
    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. Wet Basement
    Replies:
    1
    Views:
    2,501
    BobMonk
    Jul 15, 2003
  2. dpackwood
    Replies:
    3
    Views:
    1,766
  3. Replies:
    4
    Views:
    175
    Josef Moellers
    Oct 27, 2007
  4. Replies:
    4
    Views:
    285
    ccc31807
    Jul 29, 2011
  5. Yogi
    Replies:
    1
    Views:
    418
    Peter Makholm
    Sep 13, 2012
Loading...

Share This Page