Dear Monks - a little help here would be highly valued..

OS NAME: Red Hat Enterprise Linux 5 RHEL5

Perl version: v5.8.8 built for x86_64-linux-thread-multi

Module Version: Archive::Extract v?

Situation: A bash script 'my_bash.txt' invokes my_perl.pl - both scripts enclosed.

TWO Problems:

1. If I don't manually invoke 'my_bash.txt' from the same dir that it resides in - for example /usr/my_dir/my_bash.txt -

the Archive::Extract module in /usr/my_dir/my_perl.pl extracts the output to the root folder '/' and not the correct working directory /usr/my_dir/.

2. If I invoke /usr/my_dir/my_bash.txt via root crontab - the Archive::Extract module will not work.

Please could someone help as I have been at this maddening process for days..

BASH SCRIPT BELOW (this invokes my_perl.pl)

#!/bin/sh #call perl script to download MODIS greening each decad /usr/bin/perl /work/locust1/swarmsdata/RasterData/greening/modis_green +ing.pl

PERL SCRIPT BELOW (is called by bash script above)

#!/usr/bin/perl use Archive::Extract; $Archive::Extract::PREFER_BIN=1; #if $inputZip exists unzip, store file correctly and remove date from +dekadalGet.txt if (-e $inputZip) { #unzip file print $timeStamp.' -New zip file successfully downloaded, unzipping fi +le: '."\n"."\n"; # create an archive object my $archive = Archive::Extract->new(archive => $inputZip); #extract the contents to the current working directory $archive->extract() or die "Can't extract: " . $archive->error; print $timeStamp.' -New zip file = '.$inputZip.' for '.$j.' successful +ly unzipped -> deleting file.'."\n"."\n"; #delete the zip file unlink($inputZip) or die "Zip file cannot be deleted."; unless (-e $inputZip) { print $timeStamp.' -New zip file successfully deleted: '."\n"."\n"; }

In reply to Perl Module Not Working In Crontab by dailyoliver

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.