john.tm has asked for the wisdom of the Perl Monks concerning the following question:
Path::Tiny paths require defined, positive-length parts at C:\testscripts\dir.pl line 30.
could someone please explain what is being requested or what i need to change at line 30updated code#!/usr/bin/perl -- ## ## 2014-05-29-18:05:27 ## ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr +-ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use POSIX qw/ strftime /; use Path::Tiny qw/ path /; Main( @ARGV ); Main( "C:\\TEMP\\DAILY.csv", "C:\\TEMP\\MONTHLY.csv" ); exit( 0 ); sub Main { my( $infile, $outfile ) = @_; if( not has_today( $outfile ) ) { append_today( $infile, $outfile ); ... ## make noise on STDOUT } else { ... ## make noise on STDOUT } } ## end sub Main sub has_today { my( $infile ) = @_; my $today = strftime( '%d %b %Y', localtime ); my $fh = path( $infile )->openr_raw; ... ## read last 8k, check for $today } ## assumes infile will fit in memory, if it don't, write more code :) sub append_today { my( $infile, $outfile ) = @_; path( $outfile )->append_raw( path( $infile )->slurp_raw ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Path::Tiny paths require defined, positive-length parts
by Old_Gray_Bear (Bishop) on Jun 19, 2014 at 01:49 UTC | |
|
Re: Path::Tiny paths require defined, positive-length parts
by Anonymous Monk on Jun 19, 2014 at 04:15 UTC |