[29662] in Perl-Users-Digest
Perl-Users Digest, Issue: 906 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 4 21:09:43 2007
Date: Thu, 4 Oct 2007 18: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, 4 Oct 2007 Volume: 11 Number: 906
Today's topics:
Re: @_ zero byte problem <nobull67@gmail.com>
Re: exit status of remote commands xhoster@gmail.com
how do you fix newnews? <zaxfuuq@invalid.net>
How to manipulate the cases of letters in a string? <zhang.xi.cn@gmail.com>
Re: How to manipulate the cases of letters in a string? <jgibson@mail.arc.nasa.gov>
Re: How to manipulate the cases of letters in a string? <mritty@gmail.com>
Re: How to manipulate the cases of letters in a string? (Greg Bacon)
Re: jabba the tuh <rvtol+news@isolution.nl>
Re: jabba the tuh <hjp-usenet2@hjp.at>
Re: perl join on a non printable variable character ? <jack_posemsky@yahoo.com>
Re: perl join on a non printable variable character ? <dummy@example.com>
Re: perl join on a non printable variable character ? (Greg Bacon)
Re: perl join on a non printable variable character ? <nobull67@gmail.com>
Re: perl join on a non printable variable character ? <nobull67@gmail.com>
Re: perl join on a non printable variable character ? <spamtrap@dot-app.org>
Re: perl join on a non printable variable character ? benwbrewster@gmail.com
Re: perl join on a non printable variable character ? <jack_posemsky@yahoo.com>
Re: SIG{'PIPE'} <stoupa@practisoft.cz>
Re: SIG{'PIPE'} <mritty@gmail.com>
Re: SIG{'PIPE'} <ben@morrow.me.uk>
Re: SIG{'PIPE'} <No_4@dsl.pipex.com>
Re: The Modernization of Emacs: terminology buffer and <jwkenne@attglobal.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 04 Oct 2007 16:54:37 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: @_ zero byte problem
Message-Id: <1191516877.575104.233180@y42g2000hsy.googlegroups.com>
On Oct 4, 2:03 am, Jeff <dont_bug...@all.uk> wrote:
> something like:
>
> sub storeImage{
> my ($image) = @_;
>
> open(IF,">$ENV{DOCUMENT_ROOT}/test.jpg") or die "$!";
> binmode IF;
> while (read($image,$Buffer,1024)){print IF $Buffer;}
> close (IF)|| die "$!";
>
> }
>
> Now, when I run that it prints a 0 byte file, it didn't used to.
>
> If I modify the script to shift it off like this:
>
> sub storeImage{
>
> my $image=shift;
> ...}
>
> This works correctly.
There is no reason in the above code why the two should be different.
Either there's something you are not showing us or this is a bug in
Perl.
Please post a _minimal_ but _complete_ script to illustrate the
problem. Indicate also which version of Perl you are using.
> What has changed on this server that this is
> now failing?
I'd guess permissions,
> Sometimes I like to use @_ because if you have a null element in the
> middle of a list being passed in you get it in the correct order while
> shifting off a list will get this wrong.
Please produce a _minimal_ but _complete_ test case for that too, as
if what you say were true this too would be a bug in Perl.
------------------------------
Date: 04 Oct 2007 17:16:16 GMT
From: xhoster@gmail.com
Subject: Re: exit status of remote commands
Message-Id: <20071004131618.354$eG@newsreader.com>
Ironhide <gourabbaksi@gmail.com> wrote:
> Hi,
>
> I want to execute some commands on a remote machine through ssh and
> get back their results; would ideally like get back the
> 1. exit status of the command executed remotely
> 2. stdout
> 3. stderr
>
> All this I would like to do inside a perl script and get all of the
> above 3 in 3 separate variables.
> Can this be done?
>
> p.s.: I have already tried the Net::SSH module; would be helpful if
> you guys could suggest me other ways of doing this.
What was wrong with Net::SSH? If you don't tell us what you found
unsuitable about Net::SSH, then how are we to know whether some other
module we might recommend suffers the same problem or not?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Thu, 4 Oct 2007 18:53:13 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: how do you fix newnews?
Message-Id: <C7OdnSln6-lkF5janZ2dnUVZ_h-vnZ2d@comcast.com>
"Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net> wrote in message
news:13g8g1ve5ff6v2f@corp.supernews.com...
> On 10/03/2007 06:24 PM, Wade Ward wrote:
>> "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net> wrote in message
>> news:13g5luqi5jdfhb4@corp.supernews.com...
>>> On 10/02/2007 05:49 PM, Wade Ward wrote:
>>>> #!/usr/bin/env perl
>>>> use strict;
>>>> use warnings;
>>>> use Net::NNTP;
>>>>
>>>> my $nntp = Net::NNTP->new('newsgroups.comcast.net', Debug => 1 );
>>>> my $USER = '';
>>>> my $PASS = '';
>>>>
>>>> $nntp->authinfo($USER,$PASS) or die $!;
>>>>
>>>>
>>>> $nntp->group('comp.lang.perl.misc')
>>>> or die "failed to set group c.l.p.m.\n";
>>>> my $msg_ids_ref = $nntp->newnews(time() - 24*60*60);
%%%%%% <----here?
>>>> die "Failed to retrieve message ids\n" unless @{$msg_ids_ref};
>>>>
>>>> open my $ofh, '>', 'articles.txt'
>>>> or die "Cannot open articles.txt: $!";
>>>> for my $msg_id (@{$msg_ids_ref}) {
>>>> $nntp->article($msg_id, $ofh)
>>>> or die "Failed to retrieve article $msg_id\n";
>>>> }
>>>> close $ofh;
>>>> __END__
>>>> #end script begin comment
>>>> q3) Why does perl.exe not like line 16? I've correceted this before
>>>> but forget how. Thanks in advance.
>>>>
>>>> gruss,
>>> Which one is line 16?
>>>
>>> Please create a much more descriptive and precise subject line.
>> Are you dumb?
>>
>>> Please read and act on the information here:
>>> http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
>>
>> Jesus balls. Line 16 from the top. Shebang is number one.
>
> Don't curse. If you curse God, He may curse you.
http://www.zaxfuuq.net/perl5.htm
The big has man heard enough godammits from me to fill a truck. Jesus *did*
have balls.
I won't re-read the posting guidleienes. Shoot me. I've changed the
subject line to reflect what the ultinate question is.
> Please read the posting guidelines anyway. If you've already read them,
> read them again.
>
> I'm not trying to be rude to you; I'm giving you good advice that will
> dramatically improve the quality of the help you get in this newsgroup. Of
> course, Tad Maclellen gets the credit for hosting the guidelines. Thanks
> Tad.
>
> To answer your question Wade, evidently NEWNEWS is not supported by
> newsgroups.comcast.net. I tried your program with three free news servers,
> and only one of them supported NEWNEWS.
That's it. Michele and I found a workaround. I'll reread netnntp. This
will be the first time with glasses but otherwise the fifth.
--
wade ward
"Your boyfriend is not my boyfriend, doll."
>
>
------------------------------
Date: Thu, 04 Oct 2007 23:47:47 -0000
From: xz <zhang.xi.cn@gmail.com>
Subject: How to manipulate the cases of letters in a string?
Message-Id: <1191541667.632448.15320@g4g2000hsf.googlegroups.com>
Say, change "i LOVE this Game" into "I LOVE THIS GAME" or "i love this
game"
?
------------------------------
Date: Thu, 04 Oct 2007 17:02:25 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: How to manipulate the cases of letters in a string?
Message-Id: <041020071702251351%jgibson@mail.arc.nasa.gov>
In article <1191541667.632448.15320@g4g2000hsf.googlegroups.com>, xz
<zhang.xi.cn@gmail.com> wrote:
> Say, change "i LOVE this Game" into "I LOVE THIS GAME" or "i love this
> game"
perldoc -f uc
perldoc -f lc
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Thu, 04 Oct 2007 17:17:24 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: How to manipulate the cases of letters in a string?
Message-Id: <1191543444.148192.224150@k79g2000hse.googlegroups.com>
On Oct 4, 7:47 pm, xz <zhang.xi...@gmail.com> wrote:
> Say, change "i LOVE this Game" into "I LOVE THIS GAME" or "i love this
> game"
Jim has already given you the answer, so just some extra
information... You may not be aware of this, but you can get a listing
of ALL Perl functions, ordered by category, by typing this at your
command prompt:
perldoc perlfunc
If you do that, you will see, for example:
Functions for SCALARs or strings
"chomp", "chop", "chr", "crypt", "hex", "index", "lc",
"lcfirst", "length", "oct", "ord", "pack", "q/STRING/",
"qq/STRING/", "reverse", "rindex", "sprintf", "substr",
"tr///", "uc", "ucfirst", "y///"
Perhaps not the most helpful in this case, as it may not be intuitive
that "lc" stands for "lowercase", but it's still good to know in
general.
Paul Lalli
------------------------------
Date: Fri, 05 Oct 2007 00:18:53 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: How to manipulate the cases of letters in a string?
Message-Id: <13gb0nds9av599d@corp.supernews.com>
In article <1191541667.632448.15320@g4g2000hsf.googlegroups.com>,
xz <zhang.xi.cn@gmail.com> wrote:
: Say, change "i LOVE this Game" into "I LOVE THIS GAME" or "i love this
: game"
$ cat try
#! /usr/bin/perl
$_ = "i LOVE this Game";
print "\U$_\n",
"\L$_\n";
$ ./try
I LOVE THIS GAME
i love this game
Hope this helps,
Greg
--
When asked by the king what he thought he was doing by infesting the sea, he
replied with noble insolence, "What do you think you are doing by infesting
the whole world? Because I do it with one puny boat, I am called a pirate;
because you do it with a great fleet, you are called an emperor." --Augustine
------------------------------
Date: Thu, 4 Oct 2007 19:55:18 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: jabba the tuh
Message-Id: <fe3goi.1fo.1@news.isolution.nl>
Tad McClellan schreef:
> Wade Ward:
>> comment1) if you would like to killfile me, please do so now and
>> save the girlish "plonk" replies; it interrupts my threads.
>
> Im in ur group, interrupting ur threads.
<insert a link to Rafael-being-in-our-Perl>
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Thu, 4 Oct 2007 21:27:06 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: jabba the tuh
Message-Id: <slrnfgafka.ak5.hjp-usenet2@zeno.hjp.at>
On 2007-10-03 22:19, Michele Dondi <bik.mido@tiscalinet.it> wrote:
> Yeah... also, "ppl" is one char less than either "perl" or "Perl". But
> "the ppl" is three more. I don't really see what's the advantage of
> using that spelling that no other one is familiar with, and is likely
> to confuse so many people. All in all, an amazing phenomenon...
My guess is that confusing people is the very purpose of Wade's
postings.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
Date: Thu, 04 Oct 2007 15:52:37 -0000
From: Jack <jack_posemsky@yahoo.com>
Subject: Re: perl join on a non printable variable character ?
Message-Id: <1191513157.541702.279850@y42g2000hsy.googlegroups.com>
On Oct 4, 8:06 am, Mintcake <t...@skelding.co.uk> wrote:
> On Oct 4, 9:54 pm, Jack <jack_posem...@yahoo.com> wrote:
>
>
>
>
>
> > Hi I am trying to join on decimal 28, or \034 the non printable field
> > delimiter. I cant get this to work.. any help would be great ..
>
> > assume $delimiter is passed in as \034
>
> > works:
> > @temparray = split(/$delimiter/, $_);
> > @temparray = split(/\034/, $_);
> > print OUTFILE1 join("\034",$rowcounter,$_)."\n";
>
> > this doesnt work :
> > print OUTFILE1 join("$delimiter",$rowcounter,$_)."\n";
> > print OUTFILE1 join("\$delimiter",$rowcounter,$_)."\n";
> > print OUTFILE1 join($delimiter,$rowcounter,$_)."\n";
> > print OUTFILE1 join($$delimiter,$rowcounter,$_)."\n";
> > or any variation of above ...
>
> So, in the bit that allegedly works, the value of $delimiter (passed
> in but we don't see how) is totally ignored. I'd like to see the sub
> call and sub declaration.- Hide quoted text -
>
> - Show quoted text -
Hey does anyone know how do the join on the non printable /034 ?
Thanks in advance
------------------------------
Date: Thu, 04 Oct 2007 15:55:50 GMT
From: "John W. Krahn" <dummy@example.com>
Subject: Re: perl join on a non printable variable character ?
Message-Id: <a28Ni.144429$bO6.94246@edtnps89>
Jack wrote:
> Hi I am trying to join on decimal 28, or \034 the non printable field
> delimiter. I cant get this to work.. any help would be great ..
>
> assume $delimiter is passed in as \034
Do you really mean \034? \034 is a reference to a literal number.
$ perl -MData::Dumper -le'$x = \034; print Dumper $x'
$VAR1 = \28;
"\034" is a single character with an ord() value of 28 (034 octal.)
$ perl -MData::Dumper -le'$x = "\034"; print Dumper $x'
$VAR1 = '';
> works:
> @temparray = split(/$delimiter/, $_);
> @temparray = split(/\034/, $_);
> print OUTFILE1 join("\034",$rowcounter,$_)."\n";
>
> this doesnt work :
> print OUTFILE1 join("$delimiter",$rowcounter,$_)."\n";
> print OUTFILE1 join("\$delimiter",$rowcounter,$_)."\n";
> print OUTFILE1 join($delimiter,$rowcounter,$_)."\n";
> print OUTFILE1 join($$delimiter,$rowcounter,$_)."\n";
> or any variation of above ...
Does this work?
print OUTFILE1 "$rowcounter$delimiter$_\n";
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: Thu, 04 Oct 2007 15:56:36 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: perl join on a non printable variable character ?
Message-Id: <13ga39knec77taa@corp.supernews.com>
In article <1191509666.771886.239810@19g2000hsx.googlegroups.com>,
Jack <jack_posemsky@yahoo.com> wrote:
: Hi I am trying to join on decimal 28, or \034 the non printable field
: delimiter. I cant get this to work.. any help would be great ..
:
: assume $delimiter is passed in as \034
:
: works:
: @temparray = split(/$delimiter/, $_);
: @temparray = split(/\034/, $_);
: print OUTFILE1 join("\034",$rowcounter,$_)."\n";
:
: this doesnt work :
: print OUTFILE1 join("$delimiter",$rowcounter,$_)."\n";
: print OUTFILE1 join("\$delimiter",$rowcounter,$_)."\n";
: print OUTFILE1 join($delimiter,$rowcounter,$_)."\n";
: print OUTFILE1 join($$delimiter,$rowcounter,$_)."\n";
: or any variation of above ...
Be more specific than "doesn't work." Tell us what you expected
and how the result failed your expectation.
The output below looks sensible:
$ cat try
#! /usr/bin/perl
use warnings;
use strict;
my $rowcounter = '$rowcounter';
$_ = '$_';
open my $od, "|-", "od -c" or die "$0: fork: $!";
my $separator = "\034";
print $od join($separator,$rowcounter,$_)."\n";
$ ./try
0000000 $ r o w c o u n t e r 034 $ _ \n
0000017
$ perl -v
This is perl, v5.8.8 [...]
Greg
--
Government never furthered any enterprise but by the alacrity with which
it got out of its way.
-- Henry David Thoreau
------------------------------
Date: Thu, 04 Oct 2007 17:02:26 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: perl join on a non printable variable character ?
Message-Id: <1191517346.970345.150140@57g2000hsv.googlegroups.com>
On Oct 4, 4:55 pm, "John W. Krahn" <du...@example.com> wrote:
> Jack wrote:
> > Hi I am trying to join on decimal 28, or \034 the non printable field
> > delimiter. I cant get this to work.. any help would be great ..
>
> > assume $delimiter is passed in as \034
>
> Do you really mean \034? \034 is a reference to a literal number.
> "\034" is a single character with an ord() value of 28 (034 octal.)
Using PSI::ESP I suspect the OP really meant he's doing
$delimiter='\034' which is a literal backslash character followed by a
literal zero character and so on.
This thread is a perfect example of why the posting guidelines suggest
a _minimal_ but _complete_ script to illustrate what you are talking
about.
------------------------------
Date: Thu, 04 Oct 2007 17:15:12 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: perl join on a non printable variable character ?
Message-Id: <1191518112.263604.122080@r29g2000hsg.googlegroups.com>
On Oct 4, 3:54 pm, Jack <jack_posem...@yahoo.com> wrote:
> Hi I am trying to join on decimal 28, or \034 the non printable field
> delimiter. I cant get this to work.. any help would be great ..
>
> assume $delimiter is passed in as \034
See responses elsewhere in this thread. Never ask us to assume. Show
us actual code.
> works:
> @temparray = split(/$delimiter/, $_);
> this doesnt work :
> print OUTFILE1 join($delimiter,$rowcounter,$_)."\n";
I suggest you change split(/$delimiter/, $_) to split(/\Q$delimiter/,
$_)
Then neither will work! But they would work if you'd put the right
value in $delimiter in the first place.
Actually, come to think of it, neither would have worked in your
original code if, as you claim, delimiter really contained \034 but
I'm guessing it really contained '\034'. What it _should_ contain is
"\034".
Just to re-iterate (because I think I may have been unclear
elsewhere), the following are all valid Perl but are very different
statements.
$delimiter=\034; # What you appear to claim you did
$delimiter='\034'; # What you probably actually did
$delimiter="\034"; # What you should have done
By saying in English "$delimiter is passed in as \034" you are not
telling us what you've actually done.
You could have saved us all a lot of trouble by consulting the posting
guidelines before you post.
------------------------------
Date: Thu, 04 Oct 2007 16:46:21 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: perl join on a non printable variable character ?
Message-Id: <m13awqpq02.fsf@dot-app.org>
Brian McCauley <nobull67@gmail.com> writes:
> Just to re-iterate (because I think I may have been unclear
> elsewhere), the following are all valid Perl but are very different
> statements.
>
> $delimiter=\034; # What you appear to claim you did
> $delimiter='\034'; # What you probably actually did
> $delimiter="\034"; # What you should have done
On a related note - I'm not convinced that \034 is the correct character
to use. The OP mentioned using it as a field separator, and my Unicode
reference lists 034-037 as file, group, record, and unit separators, res-
pectively.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Thu, 04 Oct 2007 16:45:44 -0700
From: benwbrewster@gmail.com
Subject: Re: perl join on a non printable variable character ?
Message-Id: <1191541544.900132.49680@k79g2000hse.googlegroups.com>
On Oct 4, 1:46 pm, Sherman Pendley <spamt...@dot-app.org> wrote:
> Brian McCauley <nobul...@gmail.com> writes:
> > Just to re-iterate (because I think I may have been unclear
> > elsewhere), the following are all valid Perl but are very different
> > statements.
>
> > $delimiter=\034; # What you appear to claim you did
> > $delimiter='\034'; # What you probably actually did
> > $delimiter="\034"; # What you should have done
>
> On a related note - I'm not convinced that \034 is the correct character
> to use. The OP mentioned using it as a field separator, and my Unicode
> reference lists 034-037 as file, group, record, and unit separators, res-
> pectively.
>
> sherm--
>
> --
> Web Hosting by West Virginians, for West Virginians:http://wv-www.net
> Cocoa programming in Perl:http://camelbones.sourceforge.net
ok sorry for not being specific - tried suggestions above and none
worked here is code. my fault for not starting with this - command:
perl e:\add_uniquekeyfield.pl e:\tmp\file1.txt e:\tmp\file2.txt \034
if (@ARGV[0] eq undef) {
$filename="no source filename" ;
} else {
$filename=@ARGV[0];
}
if (@ARGV[1] eq undef) {
$outfilename="no dest filename" ;
} else {
$outfilename=@ARGV[1];
}
if (@ARGV[2] eq undef) {
$delimiter="no dest filename" ;
} else {
$delimiter=@ARGV[2];
}
open(OUTFILE1,">$outfilename")|| die 'ERROR : external table not
found :'.$outfilename."\n";
open(SOURCE,$filename) || die 'ERROR : external table not found :'.
$filename."\n";
while (<SOURCE>) {
chomp; #remove the newline from the line
$rowcounter++;
print OUTFILE1 join("$delimiter",$rowcounter,$_)."\n";
@temparray = split(/$delimiter/, $_); # works for life of me cant
figure out why join doesnt work, shoot me now:)
# print OUTFILE1 "$rowcounter$delimiter$_\n";
} #end while
close SOURCE;
close OUTFILE1;
------------------------------
Date: Thu, 04 Oct 2007 16:51:48 -0700
From: Jack <jack_posemsky@yahoo.com>
Subject: Re: perl join on a non printable variable character ?
Message-Id: <1191541908.174400.184160@o80g2000hse.googlegroups.com>
On Oct 4, 1:46 pm, Sherman Pendley <spamt...@dot-app.org> wrote:
> Brian McCauley <nobul...@gmail.com> writes:
> > Just to re-iterate (because I think I may have been unclear
> > elsewhere), the following are all valid Perl but are very different
> > statements.
>
> > $delimiter=3D\034; # What you appear to claim you did
> > $delimiter=3D'\034'; # What you probably actually did
> > $delimiter=3D"\034"; # What you should have done
>
> On a related note - I'm not convinced that \034 is the correct character
> to use. The OP mentioned using it as a field separator, and my Unicode
> reference lists 034-037 as file, group, record, and unit separators, res-
> pectively.
>
> sherm--
>
> --
> Web Hosting by West Virginians, for West Virginians:http://wv-www.net
> Cocoa programming in Perl:http://camelbones.sourceforge.net
sorry all, tried everything no luck here is the code. output should
be : 1IDTERM or put otherwise-
rowcounter[nonprintabledelimiter]field1[nonprintabledelimiter]field2
which is visible in the text file perl e:\add_uniquekeyfield.pl e:\tmp
\file1.txt e:\tmp\file2.txt \034
if (@ARGV[0] eq undef) {
$filename=3D"no source filename" ;
} else {
$filename=3D@ARGV[0];
}
if (@ARGV[1] eq undef) {
$outfilename=3D"no dest filename" ;
} else {
$outfilename=3D@ARGV[1];
}
if (@ARGV[2] eq undef) {
$delimiter=3D"no dest filename" ;
} else {
$delimiter=3D@ARGV[2];
}
open(OUTFILE1,">$outfilename")|| die 'ERROR : external table not
found :'.$outfilename."\n";
open(SOURCE,$filename) || die 'ERROR : external table not found :'.
$filename."\n";
while (<SOURCE>) {
chomp; #remove the newline from the line
if (length($_) =3D=3D 1 or length($_) =3D=3D 0) { next; }; # skip the row
# @temparray =3D split(/$delimiter/, $_); # works !!
$rowcounter++;
print OUTFILE1 join("$delimiter",$rowcounter,$_)."\n"; # doesnt work
shoot me now !
print OUTFILE1 "$rowcounter$delimiter$_\n"; # no luck !
} #end while
# print $#temparray;
close SOURCE;
close OUTFILE1;
close OUTFILE2;
------------------------------
Date: Thu, 4 Oct 2007 17:07:53 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: SIG{'PIPE'}
Message-Id: <fe2vse$f5j$1@ns.felk.cvut.cz>
Ben Morrow wrote:
> Quoth "Petr Vileta" <stoupa@practisoft.cz>:
>> I wrote some script to grab web pages, parse and store data to MySQL
>> database. On my local PC script work fine but on hosting server many
>> times fail for ungnown reason. So I write this to script
>>
>> $SIG{'QUIT'}=sub {errexit("SIG-QUIT");};
>> $SIG{'TERM'}=sub {errexit("SIG-TERM")};
>> $SIG{'PIPE'}=sub {errexit("SIG-PIPE")};
>> $SIG{'__DIE__'}=sub {errexit("SIG-DIE")};
>>
>> where errxit() is my function to write text to log file and exit.
>> Now I know that script fail for SIG{'PIPE'} but I don't know why.
>> For get webpage I use LWP module and I get from 20 to 50 pages
>> before SIG{'PIPE'} terminate my script.
>> Can anybody describe me in which cases SIG{'PIPE'} can occur?
>
> SIGPIPE is sent if you attempt to write to a pipe which has been
> closed. 'Pipe' here includes SOCK_STREAM sockets, at least on some
> systems. If you ignore SIGPIPE ($SIG{PIPE} = 'IGNORE';) then instead
> of the signal the write will fail with EPIPE.
>
> A wild guess: is this a CGI script, and the browser is timing out the
> request before you've finished, so you get a SIGPIPE trying to write
> to STDOUT?
>
Thanks for your response. This script is not a CGI but a cron job. Is
possible to get a line number where script got SIGPIPE?
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Thu, 04 Oct 2007 08:30:02 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: SIG{'PIPE'}
Message-Id: <1191511802.641278.29260@57g2000hsv.googlegroups.com>
On Oct 4, 11:07 am, "Petr Vileta" <sto...@practisoft.cz> wrote:
> Is possible to get a line number where script got SIGPIPE?
perldoc -f caller
Paul Lalli
------------------------------
Date: Thu, 4 Oct 2007 17:11:21 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: SIG{'PIPE'}
Message-Id: <9ufft4-id5.ln1@osiris.mauzo.dyndns.org>
Quoth "Petr Vileta" <stoupa@practisoft.cz>:
>
> Thanks for your response. This script is not a CGI but a cron job. Is
> possible to get a line number where script got SIGPIPE?
use Carp qw/confess/;
$SIG{PIPE} = sub { confess 'SIGPIPE'; };
will give you a whole stacktrace.
Ben
------------------------------
Date: Fri, 05 Oct 2007 00:56:46 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: SIG{'PIPE'}
Message-Id: <4cadnfdib6tb4JjanZ2dnUVZ8sHinZ2d@pipex.net>
Petr Vileta wrote:
> I wrote some script to grab web pages, parse and store data to MySQL
> database. On my local PC script work fine but on hosting server many
> times fail for ungnown reason.
One thing to bear in mind is that you can have a script that sometimes gets
SIGPIPE and sometimes doesn't.
As has been noted, it happens if you write to a closed pipe, e.g. a
filehandle open by:
open FH, "| command to run";
But pipes have buffers, so if the amount of data you write to it is small
you may get it into the buffer before the pipe is closed. So if you don't
see it as you start debugging, try writing more data to it.
--
Just because I've written it doesn't mean that
either you or I have to believe it.
------------------------------
Date: Thu, 04 Oct 2007 20:39:16 -0400
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: The Modernization of Emacs: terminology buffer and keybinding
Message-Id: <VIfNi.46$wm7.6@newsfe12.lga>
Tim X wrote:
> Although I have no
> evidence to support it, I suspect that 'free' wold have been more commonly
> associated with meanings other than 'free of cost' pre-capitalism.
C. S. Lewis has a whole chapter on "free", "liberal", "ελευθεριος",
"frank", etc., in "Studies in Words".
--
John W. Kennedy
"Those in the seat of power oft forget their failings and seek only the
obeisance of others! Thus is bad government born! Hold in your heart
that you and the people are one, human beings all, and good government
shall arise of its own accord! Such is the path of virtue!"
-- Kazuo Koike. "Lone Wolf and Cub: Thirteen Strings" (tr. Dana Lewis)
------------------------------
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 906
**************************************