[30926] in Perl-Users-Digest
Perl-Users Digest, Issue: 2171 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 29 21:09:46 2009
Date: Thu, 29 Jan 2009 18:09:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 29 Jan 2009 Volume: 11 Number: 2171
Today's topics:
Re: cgi style % decode and utf-8: missing something (so <*@eli.users.panix.com>
cgi style % decode and utf-8: missing something <*@eli.users.panix.com>
Re: cgi style % decode and utf-8: missing something <smallpond@juno.com>
Re: cgi style % decode and utf-8: missing something <*@eli.users.panix.com>
Re: FAQ 4.48 How do I shuffle my MP3 collection? jidanni@jidanni.org
Re: FAQ 4.48 How do I shuffle my MP3 collection? <tzz@lifelogs.com>
Re: MIME:Lite email address issue <nospam@somewhere.com>
Re: Perl Peeves <bruce-usenet@noreplybicycle.synonet.comnoreply>
Re: Regex for <option> ... </option> (Tim McDaniel)
Re: Regex for <option> ... </option> <hjp-usenet2@hjp.at>
Re: There is no such thing as Circular Lists <tzz@lifelogs.com>
unix - rsync - filter question <slick.users@gmail.com>
Re: unix - rsync - filter question <smallpond@juno.com>
Re: unix - rsync - filter question <slick.users@gmail.com>
Re: unix - rsync - filter question <smallpond@juno.com>
Re: unix - rsync - filter question <slick.users@gmail.com>
Re: unix - rsync - filter question <tim@burlyhost.com>
Re: unix - rsync - filter question <jimsgibson@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 30 Jan 2009 00:53:20 +0000 (UTC)
From: Eli the Bearded <*@eli.users.panix.com>
Subject: Re: cgi style % decode and utf-8: missing something (solved)
Message-Id: <eli$0901291952@qz.little-neck.ny.us>
In comp.lang.perl.misc, Eli the Bearded <*@eli.users.panix.com> wrote:
Original problem statement:
> > > I have some strings of UTF-8 that were octet by octet encoded into
> > > CGI style %XX strings. I would like to get back the Unicode code points.
> > > When I decode the strings, I get things that print as UTF-8, but are
> > > not recognized as UTF-8 for the purposes of ord().
> > >
> > > What am I missing?
Solution:
The perl FAQ didn't help me, but this page did:
http://ahinea.com/en/tech/perl-unicode-struggle.html
"One solution could be to tell perl that the $ustring2 contains Unicode
data in UTF-8 encoding. There is a couple of ways to do that; the
orthodox way is through Encode's decode_utf8() function."
#!/usr/local/bin/perl-5.8.8
use warnings;
use strict;
use vars qw( $char );
use utf8; # probably not needed, but...
use Encode;
$char = '%CF%B1';
print "My original code\n$char : ";
$char =~ s/%([\da-f]{1,2})/pack('C',hex($1))/eig;
print ord($char) . " ($char)\n\n";
$char = Encode::decode_utf8($char);
print "Now decoded: " . ord($char) . " ($char)\n\n";
__END__
:r! /usr/local/bin/perl-5.8.8 -x %
My original code
%CF%B1 : 207 (ϱ)
Now decoded: 1009 (ϱ)
Elijah
------
glanced at the source to Encode.pm but gave up on trying to trace it
------------------------------
Date: Thu, 29 Jan 2009 18:15:41 +0000 (UTC)
From: Eli the Bearded <*@eli.users.panix.com>
Subject: cgi style % decode and utf-8: missing something
Message-Id: <eli$0901291304@qz.little-neck.ny.us>
I have some strings of UTF-8 that were octet by octet encoded into
CGI style %XX strings. I would like to get back the Unicode code points.
When I decode the strings, I get things that print as UTF-8, but are
not recognized as UTF-8 for the purposes of ord().
What am I missing?
#!/usr/local/bin/perl-5.8.8
use warnings;
use strict;
use vars qw( $char );
use utf8; # probably not needed, but...
$char = '%CF%B1';
print "My original code\n$char : ";
$char =~ s/%([\da-f]{1,2})/pack('C',hex($1))/eig;
print ord($char) . " ($char)\n\n";
$char = '%CF%B1';
print "Method used in unescape() from CGI::Util\n$char : ";
$char =~ s/%(?:([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/
defined($1)? chr hex($1) : utf8_chr(hex($2))/ge;
print ord($char) . " ($char)\n\n";
print "Note: %CF == " . hex("CF") . " and %CFB1 == " . hex("CFB1") . "\n\n";
__END__
:r! /usr/local/bin/perl-5.8.8 -x %
My original code
%CF%B1 : 207 (ϱ)
Method used in unescape() from CGI::Util
%CF%B1 : 207 (ϱ)
Note: %CF == 207 and %CFB1 == 53169
Elijah
------
has not posted here in years
------------------------------
Date: Thu, 29 Jan 2009 14:01:08 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: cgi style % decode and utf-8: missing something
Message-Id: <f93f2571-395c-4ed4-a524-2bc21ba3ca3b@i24g2000prf.googlegroups.com>
On Jan 29, 1:15=A0pm, Eli the Bearded <*...@eli.users.panix.com> wrote:
> I have some strings of UTF-8 that were octet by octet encoded into
> CGI style %XX strings. I would like to get back the Unicode code points.
> When I decode the strings, I get things that print as UTF-8, but are
> not recognized as UTF-8 for the purposes of ord().
>
> What am I missing?
>
> #!/usr/local/bin/perl-5.8.8
> use warnings;
> use strict;
> use vars qw( $char );
> use utf8; =A0 =A0 =A0 =A0 =A0 =A0 =A0 # probably not needed, but...
>
> $char =3D '%CF%B1';
> print "My original code\n$char : ";
> $char =3D~ s/%([\da-f]{1,2})/pack('C',hex($1))/eig;
> print ord($char) . " ($char)\n\n";
>
> $char =3D '%CF%B1';
How about convert % to + and do:
use Convert::Xtext qw(decode_xtext);
print decode_xtext("+CF+B1"),"\n";
------------------------------
Date: Thu, 29 Jan 2009 22:38:17 +0000 (UTC)
From: Eli the Bearded <*@eli.users.panix.com>
Subject: Re: cgi style % decode and utf-8: missing something
Message-Id: <eli$0901291732@qz.little-neck.ny.us>
In comp.lang.perl.misc, smallpond <smallpond@juno.com> wrote:
> On Jan 29, 1:15pm, Eli the Bearded <*...@eli.users.panix.com> wrote:
You mangled my email address.
> > I have some strings of UTF-8 that were octet by octet encoded into
> > CGI style %XX strings. I would like to get back the Unicode code points.
> > When I decode the strings, I get things that print as UTF-8, but are
> > not recognized as UTF-8 for the purposes of ord().
> >
> > What am I missing?
> How about convert % to + and do:
>
> use Convert::Xtext qw(decode_xtext);
> print decode_xtext("+CF+B1"),"\n";
Well, I don't have that module, so I looked up the source:
http://cpansearch.perl.org/src/CHRWIN/Convert-XText-0.01/lib/Convert/XText.pm
It doesn't look like it is going to do any better. Did you try it? When I
tried I see the same problem:
#!/usr/local/bin/perl-5.8.8
use warnings;
use strict;
use vars qw( $char );
use utf8; # probably not needed, but...
$char = '%CF%B1';
print "My original code\n$char : ";
$char =~ s/%([\da-f]{1,2})/pack('C',hex($1))/eig;
print ord($char) . " ($char)\n\n";
$char = '%CF%B1';
print "Method used in unescape() from CGI::Util\n$char : ";
$char =~ s/%(?:([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/
defined($1)? chr hex($1) : utf8_chr(hex($2))/ge;
print ord($char) . " ($char)\n\n";
$char = '+CF+B1';
print "Method used in decode_xtext() from Convert::XText\n$char : ";
$char =~ s/\+([0-9A-F]{2})/chr(hex($1))/eg;
print ord($char) . " ($char)\n\n";
print "Note: %CF == " . hex("CF") . " and %CFB1 == " . hex("CFB1") . "\n";
__END__
:r! /usr/local/bin/perl-5.8.8 -x %
My original code
%CF%B1 : 207 (ϱ)
Method used in unescape() from CGI::Util
%CF%B1 : 207 (ϱ)
Method used in decode_xtext() from Convert::XText
+CF+B1 : 207 (ϱ)
Note: %CF == 207 and %CFB1 == 53169
Elijah
------
next
------------------------------
Date: Fri, 30 Jan 2009 01:14:04 +0800
From: jidanni@jidanni.org
Subject: Re: FAQ 4.48 How do I shuffle my MP3 collection?
Message-Id: <87d4e66nmr.fsf@jidanni.org>
PS> FAQ 4.48 How do I shuffle an array randomly?
PS> # shuffle my mpeg collection
PS> my @mpeg = <audio/*/*.mp3>;
PS> fisher_yates_shuffle( \@mpeg ); # randomize @mpeg in place
Well OK, but how to also minimize two songs by the same artist
(the /*/ in audio/*/*.mp3) ending up adjacent?
------------------------------
Date: Thu, 29 Jan 2009 14:36:49 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: FAQ 4.48 How do I shuffle my MP3 collection?
Message-Id: <86ocxpc0im.fsf@lifelogs.com>
On Fri, 30 Jan 2009 01:14:04 +0800 jidanni@jidanni.org wrote:
PS> FAQ 4.48 How do I shuffle an array randomly?
PS> # shuffle my mpeg collection
PS> my @mpeg = <audio/*/*.mp3>;
PS> fisher_yates_shuffle( \@mpeg ); # randomize @mpeg in place
j> Well OK, but how to also minimize two songs by the same artist
j> (the /*/ in audio/*/*.mp3) ending up adjacent?
Do a second pass on the shuffled list, extract all the clusters of
adjacent songs by the same artist, and shuffle each cluster back into
the list. The likelihood of repeated clustering is vanishingly small.
You can also hash the song info (artist+title+byte length), which should
give you a wider spread for songs with similar info. In other words,
similar songs will tend to end far apart, since that's a fundamental
hashing function property. For speed, you may want to get the MD5 hash
as a number and assign it to each song. Then you just do a sort on your
song list by the MD5 number. If you want the shuffling to be random
each time, just add a random piece of data to each song info string
(note you need to get the random data just once at the beginning of the
algorithm, not for every song).
Finally, you can shuffle each artist's songs into a separate list and
then shuffle each artist into the big list, checking for clustering at
every insert and retrying if necessary. This is probably the simplest
solution to implement and will give you the best results, though you
have to be careful to limit the number of retries. It will probably be
slowest as well.
Ted
------------------------------
Date: Thu, 29 Jan 2009 11:20:58 -0500
From: "Thrill5" <nospam@somewhere.com>
Subject: Re: MIME:Lite email address issue
Message-Id: <glsl1f$jdu$1@nntp.motzarella.org>
"Ed Jay" <edMbj@aes-intl.com> wrote in message
news:guj2o45tap5t453rllrau0c6k0j575kgnh@4ax.com...
> Thrill5 wrote:
>
>>
>>"Ed Jay" <edMbj@aes-intl.com> wrote in message
>>news:cfd2o4pklcupic5raq4ucm3ijpdruc928c@4ax.com...
>>> I'm using MIME::Lite to send an email with an attachment. It works fine,
>>> except for one detail. Unless I use a specific email address, the email
>>> and attachment are not delivered. To wit:
>>>
>>> I use From => $rpt_email,
>>>
>>> For $rpt_email = ed@example.com, the email is delivered. example.com is
>>> NOT the domain in which the script resides.
>>>
>>> For $rpt_email = something@example2.com, the email is not delivered.
>>> example2.com is the domain hosting the script.
>>>
>>I'm assuming you really mean that "example2.com" is the local domain of
>>the
>>SMTP server that you are using.
>
> Yes.
>
>>The issue lies with the SMTP server, not MIME::Lite.
>>
> The same script sends emails w/o attachments using the example2
> From-address using 'sendmail.' No problems ever noted.
>
You need to check the SMTP server's log to see why the mail is being
rejected.
------------------------------
Date: Thu, 29 Jan 2009 22:54:07 GMT
From: Bruce Cook <bruce-usenet@noreplybicycle.synonet.comnoreply>
Subject: Re: Perl Peeves
Message-Id: <4982338b@news.mel.dft.com.au>
Peter J. Holzer wrote:
> On 2009-01-27 09:08, Eric Pozharski <whynot@pozharski.name> wrote:
>> On 2009-01-27, Tim McDaniel <tmcd@panix.com> wrote:
>>> (5) That "special false". I was going nuts trying to figure out what
>>> was different between
>
> [ '' in string context, 0 in numeric context ]
>
>> That special false is evaluated to blah-blah-blah *immediately* since
>> the context is known at compile time (am I right?).
>
> No. Consider:
>
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my $bool = (1 < 0);
>
> if (rand() < 0.5) {
> print "<$bool>\n";
> } else {
> print 0 + $bool, "\n";
> }
Anyone who applies a numeric operator to a logical value and expects
consistent results is asking for trouble. In strongly-typed languages you
would get a compiler or run-time error/warning, however perl is a scripting
language and is built to be flexible, assumes you know what you're doing and
will silently oblige even the most horrendous abuses.
You actually have the same issue in C: false is defined as 0 and true is
!false. I have seen a discussion recently where someone was using an
library "elegantly" and came unstuck on a different platform because he
assumed that the true returned from that library was 1 (as it was on his
development platform). His usage became really interesting because the new
platform was returning -1 (binary all 1s), which is another common value
used for true.
As a programmer you need to understand when you're crossing type boundaries
and make sure at that point you force defined behavior the || 0 construct
is a good clean way of making sure your falses are actually integer/cleanly
printable.
Perl implicitly acknowledges data type differences in the fact that it uses
different binary operators for strings vs integers. Bool can occur in either
which is why the imprecise definition of what you will actually have in a
scalar when it's a bool result.
Bruce
------------------------------
Date: Thu, 29 Jan 2009 16:27:48 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Regex for <option> ... </option>
Message-Id: <glsle3$kal$1@reader1.panix.com>
In article <slrngo2qbe.6fu.whynot@orphan.zombinet>,
Eric Pozharski <whynot@pozharski.name> wrote:
>On 2009-01-29, Tad J McClellan <tadmc@seesig.invalid> wrote:
>> sln@netherlands.com <sln@netherlands.com> wrote:
>>
>>> XHTML/XML/SGML and HTML standards are now and have been for quite
>>> some time defined with REGULAR ESPRESSIONS exclusively.
>>
>> No they haven't.
>>
>> They are defined with a context free grammar, not a regular
>> grammar.
>
>And they aren't standards anyway. Those are specifications.
What criteria distinguish a standard from a specification?
(That's not an accusation or implying that you're wrong;
I'm interested in definitions.)
--
Tim McDaniel, tmcd@panix.com
------------------------------
Date: Thu, 29 Jan 2009 21:07:26 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Regex for <option> ... </option>
Message-Id: <slrngo433u.9cq.hjp-usenet2@hrunkner.hjp.at>
On 2009-01-29 16:27, Tim McDaniel <tmcd@panix.com> wrote:
> In article <slrngo2qbe.6fu.whynot@orphan.zombinet>,
> Eric Pozharski <whynot@pozharski.name> wrote:
>>On 2009-01-29, Tad J McClellan <tadmc@seesig.invalid> wrote:
>>> sln@netherlands.com <sln@netherlands.com> wrote:
>>>> XHTML/XML/SGML and HTML standards are now and have been for quite
>>>> some time defined with REGULAR ESPRESSIONS exclusively.
>>>
>>> No they haven't.
>>>
>>> They are defined with a context free grammar, not a regular
>>> grammar.
>>
>>And they aren't standards anyway. Those are specifications.
>
> What criteria distinguish a standard from a specification?
> (That's not an accusation or implying that you're wrong;
> I'm interested in definitions.)
AFAICS there is no semantic difference. Some organisations (mostly the
national and international standardization organizations, like ANSI,
DIN, ÖNORM, ISO, but also some industry consortiums like IEEE, ECMA, ITU)
deem themselves to be important enough to call their specifications
"standards", and others are more modest (the W3C for example, only
issues "recommendations").
So SGML is an "ISO standard", but XML is a "W3C recommendation".
hp
------------------------------
Date: Thu, 29 Jan 2009 14:45:45 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: There is no such thing as Circular Lists
Message-Id: <86hc3hc03q.fsf@lifelogs.com>
On Wed, 28 Jan 2009 21:11:12 GMT sln@netherlands.com wrote:
s> Shay Knuth Shay Knuth (born May 29, 1945 in Brown Deer, Wisconsin ) was Playboy
s> magazine's Playmate of the Month for September 1969. Her centerfold …
s> 2 KB (244 words) - 00:27, 24 December 2008
You know, "head" and "tail" in this discussion are *not* referring to
anatomical parts of the body. This may be what's confusing you.
Ted
------------------------------
Date: Thu, 29 Jan 2009 11:10:46 -0800 (PST)
From: Slickuser <slick.users@gmail.com>
Subject: unix - rsync - filter question
Message-Id: <c0fc18ef-0ca3-4957-bc39-3a9593dc4f10@o40g2000prn.googlegroups.com>
I know this not might be the group to post this question but I want to
get an answer.
I will using Perl to Unix command.
Man: http://samba.anu.edu.au/ftp/rsync/rsync.html
I cannot get my filters to work.
I want everything to rsync from /abc/* to /backup/* and delete
destination if tge source is not there but don't delete or touch /
backup/two
Help please?
I have these directories
dirs in /abc: one three fours five six
dirs in /backup: two
This will back up everything and delete /backup/two/
rsync -q --delete -avz /abc/ /backup/
this doesn't work
rsync -q --delete -avz /abc/ /backup/ --filter='protect /backup/two/
*'
rsync -q --delete -avz /abc/ /backup/ --filter='protect /backup/two/'
before::::
dirs in /abc: one three fours five six
dirs in /backup: two
after:
rsync -q --delete -avz /abc/ /backup/
dirs in /abc: one three fours five six
dirs in /backup: one three fours five six
I want this::
before::::
dirs in /abc: one three fours five six
dirs in /backup: two
after:
dirs in /abc: one three fours five six
dirs in /backup: one two three fours five six
if has:
before::::
dirs in /abc: one three fours five six
dirs in /backup: two
after:
dirs in /abc: one three fours five six
dirs in /backup: one two three fours five six
next rsync
dirs in /abc: one three
dirs in /backup: one two three fours five six
this will become
dirs in /abc: one three
dirs in /backup: one two three
------------------------------
Date: Thu, 29 Jan 2009 13:31:59 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: unix - rsync - filter question
Message-Id: <1632f434-45a5-49c7-bc94-b319f5509cf1@r37g2000prr.googlegroups.com>
On Jan 29, 2:10=A0pm, Slickuser <slick.us...@gmail.com> wrote:
> I know this not might be the group to post this question but I want to
> get an answer.
>
> I will using Perl to Unix command.
>
> Man:http://samba.anu.edu.au/ftp/rsync/rsync.html
> I cannot get my filters to work.
> I want everything to rsync from /abc/* to /backup/* and delete
> destination if tge source is not there but don't delete or touch /
> backup/two
> Help please?
> I have these directories
> dirs in /abc: one three fours five six
> dirs in /backup: two
> This will back up everything and delete /backup/two/
> rsync -q --delete -avz /abc/ /backup/
> this doesn't work
1) this is not valid perl
2) rsync does not have an error message "doesn't work"
please post a perl question and an actual result.
------------------------------
Date: Thu, 29 Jan 2009 14:29:05 -0800 (PST)
From: Slickuser <slick.users@gmail.com>
Subject: Re: unix - rsync - filter question
Message-Id: <6123a3ad-b004-4502-937e-b02d35e355b9@k36g2000pri.googlegroups.com>
Rsync is part of unix, but I'm using perl to call it.
Posting here to see if someone has use rsync before.
#!/usr/local/bin/perl
use warnings;
use strict;
#my $run = "rsync -q --delete -avz /abc/ /backup/ ";
my $run = "rsync -q --delete -avz /abc/ /backup/ --filter='protect /
backup/two/*' ";
print $run ."\n";
system($run);
Executing the perl script:
rsync error: syntax or usage error (code 1) at main.c(1013)
> 1) this is not valid perl
> 2) rsync does not have an error message "doesn't work"
>
> please post a perl question and an actual result.
------------------------------
Date: Thu, 29 Jan 2009 15:42:43 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: unix - rsync - filter question
Message-Id: <27284ea2-e7a4-4ffb-86bc-4230906fe69d@j39g2000yqn.googlegroups.com>
On Jan 29, 5:29=A0pm, Slickuser <slick.us...@gmail.com> wrote:
> Rsync is part of unix, but I'm using perl to call it.
> Posting here to see if someone has use rsync before.
>
> #!/usr/local/bin/perl
>
> use warnings;
> use strict;
>
> #my $run =3D "rsync -q --delete -avz /abc/ /backup/ ";
> my $run =3D "rsync -q --delete -avz /abc/ /backup/ --filter=3D'protect /
> backup/two/*' ";
>
> print $run ."\n";
> system($run);
>
> Executing the perl script:
> rsync error: syntax or usage error (code 1) at main.c(1013)
Weird. I would have expected it to print the command
before it got the error. I'm stumped.
------------------------------
Date: Thu, 29 Jan 2009 15:48:48 -0800 (PST)
From: Slickuser <slick.users@gmail.com>
Subject: Re: unix - rsync - filter question
Message-Id: <53caf6c1-edd8-41eb-94ff-eb4efbbbd264@z6g2000pre.googlegroups.com>
> Weird. =A0I would have expected it to print the command
> before it got the error. =A0I'm stumped.- Hide quoted text -
>
rsync -q --delete -avz /abc/ /backup/ --filter=3D'protect /backup/two/
*'
Yah, it does have the command print. Not using the right --filter
option.
------------------------------
Date: Thu, 29 Jan 2009 16:01:56 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: unix - rsync - filter question
Message-Id: <Urrgl.4877$Jd4.2616@newsfe02.iad>
Slickuser wrote:
>
>> Weird. Â I would have expected it to print the command
>> before it got the error. Â I'm stumped.- Hide quoted text -
>>
>
> rsync -q --delete -avz /abc/ /backup/ --filter='protect /backup/two/
> *'
>
>
> Yah, it does have the command print. Not using the right --filter
> option.
The rule of thumb, is to ensure the command you want to run with exec()
or system() be ran manually on the command line and ensure that it
works normally, before you introduce it in a script and expect it to
work. Thus, the issue is not (yet) a Perl related problem. The error
output is from rsync, there's nothing special related to Perl in this
equation at this time. Be sure you test run the rsync command on the
command line first. Once you remedy that, your problem should be
resolved (assuming there aren't other aspects involved in the Perl code
after the fact).
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Thu, 29 Jan 2009 17:28:23 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: unix - rsync - filter question
Message-Id: <290120091728231585%jimsgibson@gmail.com>
In article
<27284ea2-e7a4-4ffb-86bc-4230906fe69d@j39g2000yqn.googlegroups.com>,
smallpond <smallpond@juno.com> wrote:
> On Jan 29, 5:29 pm, Slickuser <slick.us...@gmail.com> wrote:
> > Rsync is part of unix, but I'm using perl to call it.
> > Posting here to see if someone has use rsync before.
> >
> > #!/usr/local/bin/perl
> >
> > use warnings;
> > use strict;
> >
> > #my $run = "rsync -q --delete -avz /abc/ /backup/ ";
> > my $run = "rsync -q --delete -avz /abc/ /backup/ --filter='protect /
> > backup/two/*' ";
> >
> > print $run ."\n";
> > system($run);
> >
> > Executing the perl script:
> > rsync error: syntax or usage error (code 1) at main.c(1013)
>
> Weird. I would have expected it to print the command
> before it got the error. I'm stumped.
In Unix, errors are usually printed to STDERR, which is unbuffered (or,
for the pedantic among us, "autoflushed"). However, the print
statements writes to STDOUT, which is buffered and non-autoflushed.
Thus, one often sees error messages before regular output even if the
errors occur later.
--
Jim Gibson
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 2171
***************************************