In article <>,
Uri Guttman <> wrote:
> >>>>> "RA" == R Allen <> writes:
>
>
> i won't address how or why your system calls are failing. i will ask WHY
> you are forking out for stuff perl does easily?
>
>
> RA> my $url = $ARGV[0];
> RA> my $now = `date +%s`;
>
> POSIX::strftime does all that date does
>
> RA> my $differential='360';
> RA> my $transitfile = "wdtimekeeper";
>
> RA> my $cleanup = system("unlink $transitfile");
>
> perl has unlink builtin
>
> RA> if (! $cleanup) {
> RA> print $!;
> RA> }
>
> RA> my $wget=system("wget $url$transitfile");
>
> wget is done in perl with LWP.
>
> RA> print "$wget\n";
> RA> if (! $wget) {
> RA> print $!;
> RA> }
>
> RA> my $laststamp = `cat $transitfile`;
>
> useless use of cat in perl! several very easy and fast ways to read in a
> file. my File::Slurp::read_file is easy, fast and very popular.
>
> RA> open FH1,"+>","$transitfile" || print "cant\n";
> RA> print FH1 $now;
> RA> close FH1;
>
> the same module has write_file. why do you open with +> when you are
> just writing a fresh timestamp?
>
> RA> my $curl = system("curl -k -T $transitfile $url");
>
> from what i know about curl, LWP can do that.
>
> so if you stick with perl your code would be clearer, shorter, faster
> and have fewer issues with system and backticks (in fact no issues).
>
> uri
This is the real reason I choose perl over php when I want to code
something on a Unix system. Plus there are MacOS extensions. It's all
part of the program, built-in.
--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]
|