no output from perl script
Joseph Annino
jannino at jannino.com
Thu Apr 25 09:55:01 EST 2002
I see a lot of good advice has been posted about stuff that is quite good to
know about perl.
A simpler solution though might be the File::Rsync module available on CPAN.
I use it a lot and it works very well. It will generate the rsync command
line for you, and it can be given a callback which will be called with each
line of rsync's output. Or you can grab the output as a list after the
command completes.
The only shortfall is it gets output one line at a time, so while --verbose
will work well with it, --progress is less useful because it updates the
percent ticker without moving on to the next line, so your callback won't
see it until that file is done.
--
Joseph Annino Consulting - Perl, PHP, MySQL, Oracle, etc.
jannino at jannino.com - http://www.jannino.com
On 4/22/02 7:17 PM, "Robert Silge" <rsilge at mac.com> wrote:
> Here is the first Perl script I've tried to write to run rsync. It seems to
> work, but I don't see the progress like I should. I apologize if it's
> sloppy, I should add that it's not only the first perl script I've written
> for rsync, it's the first perl script I've written at all.
>
> ___________________________
> #!/usr/bin/perl -w
>
> print "
> This command will DELETE EVERYTHING in Remote~/Research
> UNLESS it is also found in Local~/Research.
> Do you really wish to do this?
> [N/yes]: ";
>
> $answer = <STDIN>;
> chomp $answer;
>
>
> if ( $answer eq "yes" ) {
> print "\nOK, here we go.\n";
> `rsync -auvz --progress --delete -e ssh
> Remote:/home/user/rsync-testing /home/user`
> }
>
> else {
> print "\nabort mission\n";
>
> }
> ____________________________
>
> Thanks for the help.
>
> -Rob
>
More information about the rsync
mailing list