[32142] in Perl-Users-Digest
Perl-Users Digest, Issue: 3407 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 9 14:09:27 2011
Date: Thu, 9 Jun 2011 11:09:09 -0700 (PDT)
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, 9 Jun 2011 Volume: 11 Number: 3407
Today's topics:
[RegEx] Optional parameter <scottie383@gmail.com>
Re: [RegEx] Optional parameter <devnull4711@web.de>
Re: [RegEx] Optional parameter <nospam.gravitalsun@hotmail.com.nospam>
Re: [RegEx] Optional parameter <rweikusat@mssgmbh.com>
Re: [RegEx] Optional parameter sln@netherlands.com
Re: [RegEx] Optional parameter <uri@StemSystems.com>
Re: [RegEx] Optional parameter sln@netherlands.com
Re: [RegEx] Optional parameter sln@netherlands.com
command pipe not working <herbert.burnswell@gmail.com>
Re: How to setup when "Can't locate Date/Simple.pm in @ <peter.tuente@materna.de>
Re: How to setup when "Can't locate Date/Simple.pm in @ <moonhkt@gmail.com>
Re: How to setup when "Can't locate Date/Simple.pm in @ <peter.tuente@materna.de>
Re: Howto conjoin information from two hash tables? <rweikusat@mssgmbh.com>
Re: Module for parsing .authinfo? <uri@StemSystems.com>
Re: Optional parameter <scottie383@gmail.com>
Re: Warning in one statement, not in apparently identic <derykus@gmail.com>
Re: Warning in one statement, not in apparently identic <news@lawshouse.org>
Re: Warning in one statement, not in apparently identic <sreservoir@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 9 Jun 2011 03:00:03 -0700 (PDT)
From: Scottie <scottie383@gmail.com>
Subject: [RegEx] Optional parameter
Message-Id: <483188db-0908-4016-9a78-7b79dec4b9ed@l2g2000prg.googlegroups.com>
Hi!
I've problem with one of Regular Expression. Following code is not
working properly - Perl produce warning "Use of uninitialized value in
string eq at /tmp/test.pl line 7", where line 7 = print "|
$backup_compressed|$type_of_backup|\n";
-------------8<-------------
#!/usr/bin/perl
use warnings;
use strict;
while (<DATA>) {
my ($backup_compressed, $type_of_backup ) = $_ =~ /
channel.*starting\s(?!piece)(.*)\s(.*)\sdatafile.*/;
if ( $backup_compressed eq '') {
$backup_compressed = "not_compressed";
}
print "|$backup_compressed|$type_of_backup|\n";
}
__DATA__
channel ch1: starting compressed full datafile backup set
channel ch1: starting piece 1 at 2011-05-30 02:00:08
channel ch2: starting compressed full datafile backup set
channel ch2: starting piece 1 at 2011-05-30 02:00:08
channel ch3: starting compressed full datafile backup set
channel ch3: starting piece 1 at 2011-05-30 02:00:08
channel ch1: starting compressed full datafile backup set
channel ch1: starting piece 1 at 2011-05-30 02:37:19
channel ch1: starting compressed full datafile backup set
channel ch1: starting piece 1 at 2011-05-30 02:37:20
channel ch1: starting compressed archived log backup set
channel ch1: starting piece 1 at 2011-05-30 02:50:57
channel ch2: starting compressed archived log backup set
channel ch2: starting piece 1 at 2011-05-30 02:50:57
channel ch3: starting compressed archived log backup set
channel ch3: starting piece 1 at 2011-05-30 02:50:57
channel ch1: starting full datafile backup set
channel ch1: starting piece 1 at 2011-05-31 02:00:06
channel ch2: starting full datafile backup set
channel ch2: starting piece 1 at 2011-05-31 02:00:06
channel ch3: starting full datafile backup set
channel ch3: starting piece 1 at 2011-05-31 02:00:07
channel ch1: starting full datafile backup set
channel ch1: starting piece 1 at 2011-05-31 02:34:57
channel ch1: starting full datafile backup set
channel ch1: starting piece 1 at 2011-05-31 02:34:58
channel ch1: starting archived log backup set
channel ch1: starting piece 1 at 2011-05-31 02:47:55
channel ch2: starting archived log backup set
channel ch2: starting piece 1 at 2011-05-31 02:47:55
channel ch3: starting archived log backup set
channel ch3: starting piece 1 at 2011-05-31 02:47:55
-------------8<-------------
Output that I would get is this:
IF line = 'channel ch1: starting compressed full datafile backup set'
THEN $backup_compressed = "Yes" AND $type_of_backup = "Full"
IF line = 'channel ch1: starting full datafile backup set'
THEN $backup_compressed = "No" AND $type_of_backup = "Full"
Thank you in advance for your help.
Best regards,
--
Scottie
------------------------------
Date: Thu, 09 Jun 2011 12:17:24 +0200
From: Frank Seitz <devnull4711@web.de>
Subject: Re: [RegEx] Optional parameter
Message-Id: <95bktkF4n1U1@mid.individual.net>
Scottie wrote:
> Hi!
> I've problem with one of Regular Expression. Following code is not
> working properly - Perl produce warning "Use of uninitialized value in
> string eq at /tmp/test.pl line 7", where line 7 = print "|
> $backup_compressed|$type_of_backup|\n";
> -------------8<-------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> while (<DATA>) {
> my ($backup_compressed, $type_of_backup ) = $_ =~ /
> channel.*starting\s(?!piece)(.*)\s(.*)\sdatafile.*/;
> if ( $backup_compressed eq '') {
Hm, I think the above is line 7. Try:
if ( !$backup_compressed ) {
Regards
Frank
--
Dipl.-Inform. Frank Seitz
Anwendungen für Ihr Internet und Intranet | Web-, Datenbank-, Unix-Development
Tel: +49 (0)4103/180301, Fax: -02, Industriestr. 31, D-22880 Wedel
Blog: http://www.fseitz.de/blog
------------------------------
Date: Thu, 9 Jun 2011 14:34:29 +0300
From: "George Mpouras" <nospam.gravitalsun@hotmail.com.nospam>
Subject: Re: [RegEx] Optional parameter
Message-Id: <isqb37$2ead$1@news.ntua.gr>
use warnings;
use strict;
my $type_of_backup;
my $backup_compressed;
while (<DATA>) {
$type_of_backup = '-';
$backup_compressed = '-';
/^channel ..\d+: starting (.*?)(?{ ($type_of_backup, $backup_compressed) =
('Full', $1 eq ''?'No':'Yes') })full datafile backup set\s*$/;
print "$backup_compressed|$type_of_backup|$_"
}
------------------------------
Date: Thu, 09 Jun 2011 13:27:46 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: [RegEx] Optional parameter
Message-Id: <87ei33nq9p.fsf@sapphire.mobileactivedefense.com>
Scottie <scottie383@gmail.com> writes:
> Hi!
> I've problem with one of Regular Expression. Following code is not
> working properly - Perl produce warning "Use of uninitialized value in
> string eq at /tmp/test.pl line 7", where line 7 = print "|
> $backup_compressed|$type_of_backup|\n";
> -------------8<-------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> while (<DATA>) {
> my ($backup_compressed, $type_of_backup ) = $_ =~ /
> channel.*starting\s(?!piece)(.*)\s(.*)\sdatafile.*/;
> if ( $backup_compressed eq '') {
> $backup_compressed = "not_compressed";
> }
> print "|$backup_compressed|$type_of_backup|\n";
> }
A nice demonstration why 'use warnings' makes no sense. I have no real
idea what output you actually wanted to produce, but a script which
prints AFAIK accurate information about all backups could be (I've
also dumped the 'use strict' which just about as useless 'use
warnings'. If you want to check your code use, perl -cw -Mstrict ...
and fix whatever you consider to be an actual problem)
------------------------------
#!/usr/bin/perl
/piece/ || printf("|%scompressed|%s|\n", /compressed/ ? '' : 'not ', /(full)/)
while (<DATA>);
__DATA__
channel ch1: starting compressed full datafile backup set
channel ch1: starting piece 1 at 2011-05-30 02:00:08
channel ch2: starting compressed full datafile backup set
channel ch2: starting piece 1 at 2011-05-30 02:00:08
channel ch3: starting compressed full datafile backup set
channel ch3: starting piece 1 at 2011-05-30 02:00:08
channel ch1: starting compressed full datafile backup set
channel ch1: starting piece 1 at 2011-05-30 02:37:19
channel ch1: starting compressed full datafile backup set
channel ch1: starting piece 1 at 2011-05-30 02:37:20
channel ch1: starting compressed archived log backup set
channel ch1: starting piece 1 at 2011-05-30 02:50:57
channel ch2: starting compressed archived log backup set
channel ch2: starting piece 1 at 2011-05-30 02:50:57
channel ch3: starting compressed archived log backup set
channel ch3: starting piece 1 at 2011-05-30 02:50:57
channel ch1: starting full datafile backup set
channel ch1: starting piece 1 at 2011-05-31 02:00:06
channel ch2: starting full datafile backup set
channel ch2: starting piece 1 at 2011-05-31 02:00:06
channel ch3: starting full datafile backup set
channel ch3: starting piece 1 at 2011-05-31 02:00:07
channel ch1: starting full datafile backup set
channel ch1: starting piece 1 at 2011-05-31 02:34:57
channel ch1: starting full datafile backup set
channel ch1: starting piece 1 at 2011-05-31 02:34:58
channel ch1: starting archived log backup set
channel ch1: starting piece 1 at 2011-05-31 02:47:55
channel ch2: starting archived log backup set
channel ch2: starting piece 1 at 2011-05-31 02:47:55
channel ch3: starting archived log backup set
channel ch3: starting piece 1 at 2011-05-31 02:47:55
------------------------------
Date: Thu, 09 Jun 2011 09:50:11 -0700
From: sln@netherlands.com
Subject: Re: [RegEx] Optional parameter
Message-Id: <n9u1v65cge7sa5d8cokec2pu4u5i737pr1@4ax.com>
On Thu, 9 Jun 2011 03:00:03 -0700 (PDT), Scottie <scottie383@gmail.com> wrote:
>Hi!
>I've problem with one of Regular Expression. Following code is not
>working properly - Perl produce warning "Use of uninitialized value in
>string eq at /tmp/test.pl line 7", where line 7 = print "|
>$backup_compressed|$type_of_backup|\n";
use strict;
use warnings;
while (<DATA>) {
my ($backup_compressed, $type_of_backup ) =
map { !length($2) ? ('-','-') :
!length($1) ? ('not_compressed',$2) :
($1,$2)
} /starting (?| [ ]?([^ ]*)[ ](.+)[ ]datafile | ()() )/x;
print "|$backup_compressed|$type_of_backup|\n";
}
-----------------
-sln
-----------------
Output:
|compressed|full|
|-|-|
|compressed|full|
|-|-|
|compressed|full|
|-|-|
|compressed|full|
|-|-|
|compressed|full|
|-|-|
|-|-|
|-|-|
|-|-|
|-|-|
|-|-|
|-|-|
|not_compressed|full|
|-|-|
|not_compressed|full|
|-|-|
|not_compressed|full|
|-|-|
|not_compressed|full|
|-|-|
|not_compressed|full|
|-|-|
|-|-|
|-|-|
|-|-|
|-|-|
|-|-|
|-|-|
------------------------------
Date: Thu, 09 Jun 2011 12:59:52 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: [RegEx] Optional parameter
Message-Id: <874o3zey9j.fsf@quad.sysarch.com>
>>>>> "S" == Scottie <scottie383@gmail.com> writes:
S> Hi!
S> I've problem with one of Regular Expression. Following code is not
S> working properly - Perl produce warning "Use of uninitialized value in
S> string eq at /tmp/test.pl line 7", where line 7 = print "|
S> $backup_compressed|$type_of_backup|\n";
S> -------------8<-------------
S> #!/usr/bin/perl
S> use warnings;
S> use strict;
S> while (<DATA>) {
S> my ($backup_compressed, $type_of_backup ) = $_ =~ /
S> channel.*starting\s(?!piece)(.*)\s(.*)\sdatafile.*/;
why are you jamming all that into the regex? also be careful when
posting code as the regex was line wrapped which changes it (it added a
newline).
you don't need $_ when doing a regex against it.
you don't need to match all the stuff at the beginning or end of the
line so don't do that. it makes for a more complex regex than needed.
finally, the real answer (regardless of your getting a working regex as
you did) is to just skip the lines with 'piece' in them. much simpler,
and likely even faster.
this is untested but should give you a better way to do this:
next if /piece/ ;
# this matches the word compressed directly and makes it optional. the
# next word is always grabbed (full or archived it would seem).
my ($backup_compressed, $type_of_backup ) =
/starting\s(compressed)?\s*(.+)\sdatafile/;
$backup_compressed = ($1) ? 'Yes' : 'No' ;
S> print "|$backup_compressed|$type_of_backup|\n";
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 09 Jun 2011 10:13:29 -0700
From: sln@netherlands.com
Subject: Re: [RegEx] Optional parameter
Message-Id: <1nv1v6hv0jgi33k9if1hcq38s3u1811k06@4ax.com>
On Thu, 09 Jun 2011 09:50:11 -0700, sln@netherlands.com wrote:
>On Thu, 9 Jun 2011 03:00:03 -0700 (PDT), Scottie <scottie383@gmail.com> wrote:
>
>>Hi!
>>I've problem with one of Regular Expression. Following code is not
>>working properly - Perl produce warning "Use of uninitialized value in
>>string eq at /tmp/test.pl line 7", where line 7 = print "|
>>$backup_compressed|$type_of_backup|\n";
>
>use strict;
>use warnings;
>
>while (<DATA>) {
> my ($backup_compressed, $type_of_backup ) =
> map { !length($2) ? ('-','-') :
> !length($1) ? ('not_compressed',$2) :
> ($1,$2)
> } /starting (?| [ ]?([^ ]*)[ ](.+)[ ]datafile | ()() )/x;
> print "|$backup_compressed|$type_of_backup|\n";
>
>}
Some may object to the map, this is alternate:
while (<DATA>) {
/starting (?| [ ]?([^ ]*)[ ](.+)[ ]datafile | ()() )/x;
my ($backup_compressed, $type_of_backup ) =
!length($2) ? ('-','-') :
!length($1) ? ('not_compressed',$2) :
($1,$2);
print "|$backup_compressed|$type_of_backup|\n";
}
-sln
------------------------------
Date: Thu, 09 Jun 2011 10:28:32 -0700
From: sln@netherlands.com
Subject: Re: [RegEx] Optional parameter
Message-Id: <4c02v6tp5kbf56mic7ga1sadls9qmtd8dr@4ax.com>
On Thu, 09 Jun 2011 10:13:29 -0700, sln@netherlands.com wrote:
>On Thu, 09 Jun 2011 09:50:11 -0700, sln@netherlands.com wrote:
>
>>On Thu, 9 Jun 2011 03:00:03 -0700 (PDT), Scottie <scottie383@gmail.com> wrote:
>>
>>>Hi!
>>>I've problem with one of Regular Expression. Following code is not
>>>working properly - Perl produce warning "Use of uninitialized value in
>>>string eq at /tmp/test.pl line 7", where line 7 = print "|
>>>$backup_compressed|$type_of_backup|\n";
>>
>>use strict;
>>use warnings;
>>
>>while (<DATA>) {
>> my ($backup_compressed, $type_of_backup ) =
>> map { !length($2) ? ('-','-') :
>> !length($1) ? ('not_compressed',$2) :
>> ($1,$2)
>> } /starting (?| [ ]?([^ ]*)[ ](.+)[ ]datafile | ()() )/x;
>> print "|$backup_compressed|$type_of_backup|\n";
>>
>>}
>
>Some may object to the map, this is alternate:
>
>while (<DATA>) {
> /starting (?| [ ]?([^ ]*)[ ](.+)[ ]datafile | ()() )/x;
> my ($backup_compressed, $type_of_backup ) =
> !length($2) ? ('-','-') :
> !length($1) ? ('not_compressed',$2) :
> ($1,$2);
> print "|$backup_compressed|$type_of_backup|\n";
>}
>
Also, to avoid the possibility of getting the "uninitalized" warning
if there are some lines without 'starting' in it, bring out the branch reset operator.
/ (?| .* starting [ ]?([^ ]*)[ ](.+)[ ]datafile | ()() ) /x;
This will be a line image of your file, it includes even empty lines, so there is no
distinction. Overall, generally, this is not really the way to do this.
It depends on what exactly you are trying to accomplish, etc..
-sln
------------------------------
Date: Thu, 9 Jun 2011 10:58:06 -0700 (PDT)
From: Herb Burnswell <herbert.burnswell@gmail.com>
Subject: command pipe not working
Message-Id: <1616c97e-2974-4643-b514-f0a0d31380fd@l14g2000pro.googlegroups.com>
Hi all,
It's been a while since I've actively programmed in perl and I'm a bit
rusty. I trying to do what should be pretty straight forward but I'm
having some trouble. Here is a snippet:
<snip>
sub create_log
{
open(LOG, ">$logfile") || die "Couldn't open $logfile: $!";
write_log_header(" Begin Log File");
close LOG;
}
sub finish_log
{
write_log_header(" End Log File");
}
sub write_log
{
open(LOG, ">>$logfile") || die "Couldn't open $logfile: $!";
print LOG @_;
close LOG;
}
sub write_log_header
{
my $date = `date`;
chomp($date);
open(LOG, ">>$logfile") || die "Couldn't open $logfile: $!";
print LOG ("\n
\n===================================================\n");
print LOG $date . " ";
print LOG @_;
print LOG ("
\n===================================================\n");
close LOG;
}
create_log;
my $file = "/path/to/file";
my $line;
open (INFO, $file);
my @lines = <INFO>;
close (INFO);
foreach $line (@lines)
{
write_log(`echo $line 2>&1`);
write_log(`last -R $line \\| head -1 2>&1`);
}
finish_log;
<snip>
The 2nd 'write_log' is not working as it does not recognize the pipe
to the head command.
Can anyone point me in the right direction? Thanks in advance...
Herb
------------------------------
Date: Wed, 08 Jun 2011 17:48:28 +0200
From: Peter Tuente <peter.tuente@materna.de>
Subject: Re: How to setup when "Can't locate Date/Simple.pm in @INC"
Message-Id: <iso5kb$pi4$1@pentheus.materna.de>
moonhkt schrieb:
> Thank for your suggestion. Also, Do you know how to parameter
> parameter to perl script with below format ?
>
> My perl script updated.
>
> XVAL=$1 ; export XVAL
> j=$( perl <<-'EOF'
> use strict;
> use POSIX qw( strftime );
> use Getopt::Std;
> my ($ymd,$i) ;
> $i=$ENV{'XVAL'};
> $ymd=strftime("%Y/%m/%d",localtime(time + $i *86400));
> print $ymd;
> EOF
> )
>
Hi moonhkt,
if you only want to get the date string returned into the bash variable,
then you can omit the whole set/read from environment stuff and strip
down the code block like this:
# See $1 near "*86400"
j=$( perl <<EOF
use strict;
use POSIX qw( strftime );
print strftime("%Y/%m/%d",localtime(time + $1 *86400));
EOF
)
Now $j holds the date string ;-)
------------------------------
Date: Thu, 9 Jun 2011 07:37:13 -0700 (PDT)
From: moonhkt <moonhkt@gmail.com>
Subject: Re: How to setup when "Can't locate Date/Simple.pm in @INC"
Message-Id: <53486a72-6465-4b8d-92c4-b6d252e637c1@r2g2000vbj.googlegroups.com>
On Jun 8, 11:48=A0pm, Peter Tuente <peter.tue...@materna.de> wrote:
> moonhkt schrieb:
>
>
>
>
>
>
>
> > Thank for your suggestion. Also, Do you know how to parameter
> > parameter to perl script with below format ?
>
> > My perl script updated.
>
> > XVAL=3D$1 ; export XVAL
> > j=3D$( perl =A0<<-'EOF'
> > =A0 use strict;
> > =A0 use POSIX qw( strftime );
> > =A0 use Getopt::Std;
> > =A0 my ($ymd,$i) ;
> > =A0 $i=3D$ENV{'XVAL'};
> > =A0 $ymd=3Dstrftime("%Y/%m/%d",localtime(time + $i *86400));
> > =A0 print $ymd;
> > EOF
> > )
>
> Hi moonhkt,
>
> if you only want to get the date string returned into the bash variable,
> then you can omit the whole set/read from environment stuff and strip
> down the code block like this:
>
> # See $1 near "*86400"
> j=3D$( perl <<EOF
> =A0 =A0use strict;
> =A0 =A0use POSIX qw( strftime );
> =A0 =A0print strftime("%Y/%m/%d",localtime(time + $1 *86400));
> EOF
> )
>
> Now $j holds the date string ;-)
Thank.
It works only. Why need changed "-"EOF" to EOF ?
------------------------------
Date: Thu, 09 Jun 2011 17:18:04 +0200
From: Peter Tuente <peter.tuente@materna.de>
Subject: Re: How to setup when "Can't locate Date/Simple.pm in @INC"
Message-Id: <isqo7a$7fb$1@pentheus.materna.de>
moonhkt schrieb:
> It works only. Why need changed "-"EOF" to EOF ?
Hi moonhkt,
when using $1 for the calculation, both flavours work.
But when using a bash variable OFFSET=$1 for the calculation, you'll see
the difference.
1) The shell variable $OFFSET inside the "here" document started with
<<EOF gets replaced by its value, before perl is called with the
resulting here document.
# OK, yields: Date string
OFFSET=$1
perl <<EOF
use strict;
use POSIX qw( strftime );
print strftime("%Y-%m-%d",localtime(time + $OFFSET *86400)) . "\n";
EOF
2) The shell variable $OFFSET does not get replaced by its value
# Error: Perl doesn't recognize variable $OFFSET
OFFSET=$1
perl <<'EOF'
use strict;
use POSIX qw( strftime );
print strftime("%Y-%m-%d",localtime(time + $OFFSET *86400)) . "\n";
EOF
HTH
PiT
------------------------------
Date: Wed, 08 Jun 2011 16:17:39 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: Howto conjoin information from two hash tables?
Message-Id: <87zklsnyi4.fsf@sapphire.mobileactivedefense.com>
Scottie <scottie383@gmail.com> writes:
> ------------------ 8< ------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
> use Data::Dumper;
>
> my %channel = (
> ch1 => [
> 'allocated channel: ch1',
> 'channel ch1: SID=596 device type=DISK',
> 'channel ch1: starting compressed full datafile backup set',
> 'channel ch1: specifying datafile(s) in backup set',
> 'exit'
> ],
> ch2 => [
> 'allocated channel: ch2',
> 'channel ch2: SID=15 device type=DISK',
> 'channel ch2: starting compressed full datafile backup set',
> 'channel ch2: specifying datafile(s) in backup set',
> 'exit'
> ],
> );
>
>
> foreach (keys %channel) {
> next if /exit/;
> shift ( @{$channel{$_}} );
> }
>
> print Dumper \%channel;
[...]
> As you can see, there is no first lines ("$channel{ch1}[0]" and
> "$channel{ch2}[0]"), but I expect that output will be as follows:
> $VAR1 = {
> 'ch2' => [
> 'exit'
> ],
> 'ch1' => [
> 'exit'
> ]
> };
>
> Can you enlighten me once again, please.
You are iterating over the keys of %channel and execute a shift on
each of the values exactly once. Alternate code which works as yours
was likely supposed to be:
my $pos;
for (values(%channel)) {
$pos = 0;
while ($pos < @$_) {
last if $_->[$pos] =~ /exit/;
++$pos;
}
splice(@$_, 0, $pos);
}
NB: This is just something quick I wrote down in between two other
tasks.
------------------------------
Date: Wed, 08 Jun 2011 13:21:16 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Module for parsing .authinfo?
Message-Id: <87ei34tf1v.fsf@quad.sysarch.com>
>>>>> "TZ" == Ted Zlatanov <tzz@lifelogs.com> writes:
TZ> On Tue, 07 Jun 2011 19:12:34 -0400 "Uri Guttman" <uri@StemSystems.com> wrote:
UG> well, note that tim hasn't responded since then even when i showed how
UG> to do it quickly. i say "Looking forward to your rewrite" is asking me
UG> to do his work for him which is not something i take lightly. i said it
UG> was easy and he said so do it yourself. i then did it myself and proved
UG> it was easy. that is all there is to it. yes, i was pissed so it
UG> motivated me to spend the 15 minutes coding that up. will tim
UG> acknowledge the code or whatever? i doubt it. it shows who is more
UG> connected to reality. :)
TZ> What do you expect Tim to say at this point? You're obviously so
TZ> fixated on being "right" and "winning the argument" that you don't want
TZ> to be civil even when given the chance, and you keep rehashing your side
TZ> of the argument.
to eat crow or perl code? i don't care about his views anymore. he got
help when he didn't deserve it for his attitude. if i used killfiles he
would likely be in it now.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 9 Jun 2011 08:21:28 -0700 (PDT)
From: Scottie <scottie383@gmail.com>
Subject: Re: Optional parameter
Message-Id: <d0c35cf9-32c5-466f-b670-a76186b8dbe0@w36g2000vbi.googlegroups.com>
On Jun 9, 1:34=A0pm, "George Mpouras"
<nospam.gravital...@hotmail.com.nospam> wrote:
> /^channel ..\d+: starting (.*?)(?{ ($type_of_backup, $backup_compressed) =
=3D
> ('Full', $1 eq ''?'No':'Yes') })full datafile backup set\s*$/;
George,
Your solution works perfectly. :) Thank you so much!
P.S. I could not do any of the standard regular expression.
Best regards,
--
Scottie
------------------------------
Date: Wed, 8 Jun 2011 10:33:39 -0700 (PDT)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: Warning in one statement, not in apparently identical one
Message-Id: <e5cbfc46-d049-48a0-b52f-c3ca47e74600@o10g2000prn.googlegroups.com>
On Jun 8, 4:45=A0am, Henry Law <n...@lawshouse.org> wrote:
> On 08/06/11 12:36, Wolf Behrenhoff wrote:
>
> >> =A0 =A0 $@ =3D "No file supplied" and return 0 unless $file;
> >> =A0 =A0 $@ =3D "File '$file' not found or not a readable file" and ret=
urn 0
> > In line 7 you basically have:
> > assignment and return
>
> > So Perl warns that the assignment should probably be a comparison,
> > because otherwise the "and" does not make sense here as the constant
> > string you are assigning is always true.
>
> Aha! =A0Thank you. =A0Since posting I experimented, and found that the
> message went away when I had any variable in the string; you've
> explained why.
>
> > You can use the comma operator instead of "and".
> ...
Another option to avoid "operator error" if the
expression gets long-ish :
$@ =3D "No file supplied" and return 0 unless $file;
vs.
do{$@ =3D "No file supplied"; return} unless $file;
--
Charles DeRykus
------------------------------
Date: Wed, 08 Jun 2011 19:19:13 +0100
From: Henry Law <news@lawshouse.org>
Subject: Re: Warning in one statement, not in apparently identical one
Message-Id: <rP2dnecDZYi_IHLQnZ2dnUVZ7s2dnZ2d@giganews.com>
On 08/06/11 18:33, C.DeRykus wrote:
> Another option to avoid "operator error" if the
> expression gets long-ish :
>
> $@ = "No file supplied" and return 0 unless $file;
>
> vs.
>
> do{$@ = "No file supplied"; return} unless $file;
I like that too. Another Perl colloquialism to add to my dialect.
--
Henry Law Manchester, England
------------------------------
Date: Wed, 08 Jun 2011 14:50:54 -0400
From: sreservoir <sreservoir@gmail.com>
Subject: Re: Warning in one statement, not in apparently identical one
Message-Id: <isogak$8sl$1@dont-email.me>
On 06/08/2011 01:33 PM, C.DeRykus wrote:
> On Jun 8, 4:45 am, Henry Law<n...@lawshouse.org> wrote:
>> On 08/06/11 12:36, Wolf Behrenhoff wrote:
>>
>>>> $@ = "No file supplied" and return 0 unless $file;
>>>> $@ = "File '$file' not found or not a readable file" and return 0
>>> In line 7 you basically have:
>>> assignment and return
>>
>>> So Perl warns that the assignment should probably be a comparison,
>>> because otherwise the "and" does not make sense here as the constant
>>> string you are assigning is always true.
>>
>> Aha! Thank you. Since posting I experimented, and found that the
>> message went away when I had any variable in the string; you've
>> explained why.
>>
>>> You can use the comma operator instead of "and".
>> ...
>
> Another option to avoid "operator error" if the
> expression gets long-ish :
>
> $@ = "No file supplied" and return 0 unless $file;
>
> vs.
>
> do{$@ = "No file supplied"; return} unless $file;
>
unless ($file) { $@ = "No file supplied"; return }
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 3407
***************************************