You can run it thru system or backticks, but the syntax for options can get tricky. For instance
system ('tar','-c','-XEXCLUDE_FILE','-M','-L50000',"-F ./backup-rotate
+.pl $basename","-f$basename-0.tar",$dir);
| [reply] [d/l] |
Is there a specific reason why you would have to use perl for this? This could easily be written in a shell (bash,csh, etc) script.
| [reply] |
Is there a specific reason why you would have to use perl for thisWell, that line was pulled from a more complex script, that is far easier to do in Perl, than something like bash shell. For instance, what if you were automating writing the tarballs to a cd/dvd, or transferring it over a socket to another location, forking the work off, etc. Additionally, file and directory operations are soooo much easier with Perl, than shell, especially if you are used to Perl and abhor shell syntax. So....it is often better to use Perl , and run the occaisional command thru system/backtick/pipe, and have the full power of Perl available when needed for things shell dosn't do well.
| [reply] |
Due to system requirements I won't be able to use Archive::Tar. I am always interested to know what these "system requirements" could be.
Archive::Tar is now a core module (first released with perl 5.009003), so it should be available on all modern Perl-installations for all types of OS and can easily be installed on older versions through CPAN as it is a "Perl-only" module, no compiler needed.
CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
| [reply] |