[25007] in Perl-Users-Digest
Perl-Users Digest, Issue: 7257 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 15 14:07:17 2004
Date: Fri, 15 Oct 2004 11:05:07 -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 Fri, 15 Oct 2004 Volume: 10 Number: 7257
Today's topics:
(Newbie) Use of uninitialized value in concatenation (. (Jesse Cary)
Re: (Newbie) Use of uninitialized value in concatenatio <mritty@gmail.com>
@INC strangeness <r.mcglue@qub.ac.uk>
Re: @INC strangeness <mritty@gmail.com>
Re: @INC strangeness <r.mcglue@qub.ac.uk>
A new module for sending SMS via applications .SMS::API (abhishek jain)
Re: A newbie question <moon@world.universe>
Re: A newbie question <mritty@gmail.com>
Re: A newbie question <moon@world.universe>
Re: A newbie question <moon@world.universe>
Re: A newbie question <tadmc@augustmail.com>
Re: A newbie question <moon@world.universe>
Re: A newbie question <1usa@llenroc.ude.invalid>
Re: Help needed replacing deprecated syntax <noreply@gunnar.cc>
Re: HTML::Parser and <p> behaviour? <tadmc@augustmail.com>
Re: HTML::Parser and <p> behaviour? <bigal187@removethis.rx.eastcoasttfc.com>
Re: HTML::Parser and <p> behaviour? <bigal187@removethis.rx.eastcoasttfc.com>
Installing extra data files with a Makefile.PL? (Erik Wasser)
Multiline die <samik@frKKshKll.org>
Re: Multiline die <1usa@llenroc.ude.invalid>
Re: Multiline die <mritty@gmail.com>
Re: python for perl programmers? (Chris Richmond - MD6-FDC ~)
Re: String and Array Programming in Perl (krakle)
Re: Top posting (was Re: Concatenating an array into on <1usa@llenroc.ude.invalid>
Re: Unlink Question <toreau@gmail.com>
Re: Win2k - Ping - improved. (Kevin Joseph)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Oct 2004 10:05:56 -0700
From: jesse.cary@unisys.com (Jesse Cary)
Subject: (Newbie) Use of uninitialized value in concatenation (.) or string
Message-Id: <9c8230e7.0410150905.4828a1cb@posting.google.com>
I am making a script that issues commands, pulls certain text from the
results and puts that text into an HTML table. I got the first two
columns to display fine and used my method as a template to fill the
third column, but I get the error stated in the subject line.
Below is the code and the text I am pulling the date from;
#CODE#
# STORE THE NAMES OF ALL THE VOBS #
@VOBS = `cleartool lsvob -s | sort`;
if ( $#VOBS == -1 )
{
printf ("INFO: No MultiSited VOBs - exiting\n");
exit 0;
}
###################################
# GET THE SPACE INFO FOR EACH VOB # this part is working fine...
###################################
foreach $VOB_NAME (@VOBS)
{
chomp ($VOB_NAME);
$VOB_SPACE{$VOB_NAME} = `cleartool space \ $VOB_NAME`;
# EXTRACT ONLY THE SPACE USED IN MB FROM THE SPACE COMMAND #
if ( $VOB_SPACE{$VOB_NAME} =~ /(\d+?\.\d)\s+?\d+?%\s+?Subtotal/ )
{
$VOB_SPACE{$VOB_NAME} = $1;
}
# IF NO INFO AVAILABLE FOR A VOB PRINT "N/A" FOR NOT AVAILABLE #
else {
$VOB_SPACE{$VOB_NAME} = "N/A";
}
}
#########################################
# GET THE DESCRIPTION INFO FOR EACH VOB #
#########################################
foreach $VOB_NAME (@VOBS)
{
#chomp ($VOB_NAME);
$VOB_DSCR{$VOB_NAME} = `cleartool describe -l vob:$VOB_NAME`;
# EXTRACTING CREATION DATE #
if ( $VOB_DSCR{$VOB_NAME} =~ /created\s(\d\d-\w{3}-\d\d)/ )
{
$VOB_DATE{$VOB_NAME} = $1;
}
}
##### THIS IS WHAT I'M PULLING THE DATE FROM #########
versioned object base "\VPPSHAREsrc"
created 16-Apr-03.14:16:58 by ustr-vp-bld.Domain Users@USTR-CMMGEN
master replica: CPG_COMMS@\VPPSHAREsrc
replica name: CPG_COMMS
VOB family feature level: 3
VOB storage host:pathname
"ustr-cpgcc:d:\ClearCase_Storage\VOBs\VPPSHAREsrc.vbs"
VOB storage global pathname
"\\ustr-cpgcc\ccstg_d\VOBs\VPPSHAREsrc.vbs"
database schema version: 54
VOB ownership:
owner NA\USTR-VP-bld
group NA\Domain Users
Attributes:
FeatureLevel = 3
Hyperlinks:
AdminVOB@40@\VPPSHAREsrc -> vob:\COMMS
###################### BACK TO THE CODE BELOW ##############
################# OPEN HTML FILE VDS.html ###################
open(HTMLDOC, ">VDS.html") or die "Can't open VDS.html";
select(HTMLDOC);
printf("<html><head><title>VOB Status Page</title></head><body> \n");
printf("<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\"> \n");
printf("<tr><td><b>VOB
Name</b></td><td><b>MBytes</b></td><td><b>Date</b></td></tr> \n");
foreach $VOB_NAME (@VOBS)
{
chomp ($VOB_NAME);
printf("<tr><td>$VOB_NAME</td><td>$VOB_SPACE{$VOB_NAME}</td><td>$VOB_DATE{VOB_NAME}</td></tr>
\n");
}
printf("</table></body></html> \n");
close(HTMLDOC);
################## DONE WITH HTML PORTION #####################
print STDOUT "\n ALL DONE! VDS.html has been updated \n";
------------------------------
Date: Fri, 15 Oct 2004 17:26:16 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: (Newbie) Use of uninitialized value in concatenation (.) or string
Message-Id: <YKTbd.283$EL5.146@trndny09>
"Jesse Cary" <jesse.cary@unisys.com> wrote in message
news:9c8230e7.0410150905.4828a1cb@posting.google.com...
> I am making a script that issues commands, pulls certain text from the
> results and puts that text into an HTML table. I got the first two
> columns to display fine and used my method as a template to fill the
> third column, but I get the error stated in the subject line.
No you don't. The error you get from perl would include the file and
line number of the error. These are vital pieces of information.
<snip>
> ###################################
> # GET THE SPACE INFO FOR EACH VOB # this part is working fine...
> ###################################
If it's working fine, why are you showing it to us? Why take up space
with code not relevant to your problem? You should always post the
shortest complete program you can which demonstrates your issue.
<snip a bunch of intermingled data and code>
> foreach $VOB_NAME (@VOBS)
> {
> chomp ($VOB_NAME);
>
printf("<tr><td>$VOB_NAME</td><td>$VOB_SPACE{$VOB_NAME}</td><td>$VOB_DAT
E{VOB_NAME}</td></tr>
Call it a hunch, but I'd bet your problem has something to do with using
$VOB_NAME twice and the string VOB_NAME another time.
Paul Lalli.
------------------------------
Date: Fri, 15 Oct 2004 16:20:04 +0100
From: R McGlue <r.mcglue@qub.ac.uk>
Subject: @INC strangeness
Message-Id: <ckopqq$rig$1@news.qub.ac.uk>
error as follows
bash-2.03$ ./!!
./spamstats0.6a.pl -help
Can't locate Compress/Zlib.pm in @INC (@INC contains:
/usr/perl5/5.00503/sun4-so
laris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site
_perl/5.005 .) at ./spamstats0.6a.pl line 155.
BEGIN failed--compilation aborted at ./spamstats0.6a.pl line 155.
so it cant find what its lookin for even though i have installed it
bash-2.03$ perl -e "print join(\"\n\", @INC);"
/usr/local/lib/perl5/5.6.1/sun4-solaris
/usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl
bash-2.03$
why is it still looking at the eralier version of perl in /usr/bin/perl
as oppossed to usr/local/bin given by
bash-2.03$ which perl
/usr/local/bin/perl
bash-2.03$ perl -v
This is perl, v5.6.1 built for sun4-solaris
Copyright 1987-2001, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
thanks for the help
help me finish the week on a positive note perlmongers!!
ronan
------------------------------
Date: Fri, 15 Oct 2004 15:37:46 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: @INC strangeness
Message-Id: <e9Sbd.14$oU3.12@trndny04>
"R McGlue" <r.mcglue@qub.ac.uk> wrote in message
news:ckopqq$rig$1@news.qub.ac.uk...
> error as follows
>
> bash-2.03$ ./!!
> ./spamstats0.6a.pl -help
> Can't locate Compress/Zlib.pm in @INC (@INC contains:
> /usr/perl5/5.00503/sun4-so
> laris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
> /usr/perl5/site
> _perl/5.005 .) at ./spamstats0.6a.pl line 155.
> BEGIN failed--compilation aborted at ./spamstats0.6a.pl line 155.
>
> so it cant find what its lookin for even though i have installed it
>
>
> bash-2.03$ perl -e "print join(\"\n\", @INC);"
> /usr/local/lib/perl5/5.6.1/sun4-solaris
> /usr/local/lib/perl5/5.6.1
> /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
> /usr/local/lib/perl5/site_perl/5.6.1
> /usr/local/lib/perl5/site_perl
> bash-2.03$
>
>
> why is it still looking at the eralier version of perl in
/usr/bin/perl
> as oppossed to usr/local/bin given by
>
> bash-2.03$ which perl
> /usr/local/bin/perl
Well, you didn't provide any code, so there's no way to be sure, but I'd
be willing to bet your shebang line in spamstats0.6a.pl is
#!/usr/bin/perl
instead of
#!/usr/local/bin/perl
Paul Lalli
------------------------------
Date: Fri, 15 Oct 2004 16:48:33 +0100
From: R McGlue <r.mcglue@qub.ac.uk>
Subject: Re: @INC strangeness
Message-Id: <ckorg6$rn4$1@news.qub.ac.uk>
yeah paul absoluly right - although i did think of that 5 seconds after
posting.... thanks fr the help though
have a good weekend all!
ronan
------------------------------
Date: Tue, 12 Oct 2004 09:45:38 GMT
From: mail@ejain.com (abhishek jain)
Subject: A new module for sending SMS via applications .SMS::API --SMS gateway and goyali.com
Message-Id: <I5MyFn.21zo@zorch.sf-bay.org>
Dear Friends,
Have you ever wanted to send SMS via your custom made applications.
Now it has become a bit easier. With a new module SMS::API you can
send SMS by just a single line in your program. Also you will be able
to track the status of the message(Delivered or not delivered.).
For more details on the module visit
http://search.cpan.org/~goyali/SMS_API_2_01/API/API.pm To use the
module you first need to register at
http://www.goyali.com/sms_gateway/index.htm where you will be given a
user name and password (means u have to become a member of their sms
gateway).Then use the module for sending SMS.
For any other details visit www.goyali.com/contact.htm .Remember it is
a serious project and www.goyali.com has a good customer support.
--
Regards
Abhishek jain
------------------------------
Date: Fri, 15 Oct 2004 17:09:55 +0200
From: Moon <moon@world.universe>
Subject: Re: A newbie question
Message-Id: <11cl5qb2gmv1y.14o3t2ehr99gq.dlg@40tude.net>
Dnia Thu, 14 Oct 2004 15:28:44 -0600, postmaniak Scott Bryce odważył się
napisać:
> But, in case I'm wrong...
> tuvwxyz{lmnopqrsqpsrmlonyx{zutwvutwvyx{zmlonqpsrmlonqpsrutwvyx{zpqrslmnoxyz{tuvwnolmrspqvwtuz{xyonmlsrqpwvut{zyxsrqponml{zyxwvut
Thanks - that's what I needed.
One last question - what does the following regular expression mean?
return chr hex sprintf "%x%x",$b,$a;
Oh BTW - full script I'm translating is at http://platnik.fork.pl
Encode routine works perfectly translated to C, but I've some problems with
decode routine (above regexp).
Big thank-you, Scott!
--
<Moon>
[adres Reply-To zaszyfrowany ROT13]
------------------------------
Date: Fri, 15 Oct 2004 15:34:45 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: A newbie question
Message-Id: <p6Sbd.28$WN5.6@trndny08>
"Moon" <moon@world.universe> wrote in message
news:11cl5qb2gmv1y.14o3t2ehr99gq.dlg@40tude.net...
> One last question - what does the following regular expression mean?
>
> return chr hex sprintf "%x%x",$b,$a;
There is no regular expression in that statement.
That statement is taking two values, $b and $a, and creating a string
out of their hexadecimal representations. It then returns the decimal
value of that hex string, and finally returns the ASCII character
associated with that decimal value.
For example, say $a = 14 and $b = 2. The program first creates the
string '2e' (14 decimal is 0xE hex). It then translates 0x2e to 46
decimal. Finally it returns the ASCII character represented by 46,
which is the period.
Paul Lalli
------------------------------
Date: Fri, 15 Oct 2004 17:39:23 +0200
From: Moon <moon@world.universe>
Subject: Re: A newbie question
Message-Id: <10wxcopw2901s$.1v9egkckuxgtq$.dlg@40tude.net>
Dnia Fri, 15 Oct 2004 15:34:45 GMT, postmaniak Paul Lalli odważył się
napisać:
> There is no regular expression in that statement.
Yes of course - I realized that already:)
> [...]
Thanks Paul. I hope that will do and I'll be able to finish that
conversion. Greetz.
--
<Moon>
[adres Reply-To zaszyfrowany ROT13]
------------------------------
Date: Fri, 15 Oct 2004 17:53:49 +0200
From: Moon <moon@world.universe>
Subject: Re: A newbie question
Message-Id: <t2yf8fm2047q$.hrbskoamm3kx$.dlg@40tude.net>
Dnia Fri, 15 Oct 2004 15:34:45 GMT, postmaniak Paul Lalli odważył się
napisać:
Duh, this is a neverending story :/
More regexps...
These two are last in the decode script and I definitely don't know how to
interpret them. What they do?
$enc =~ s/[^$k]//g;
$enc =~ s/(.)(.)/dec($1,$2)/ge;
Please be so kind and explain to me what they do with the supplied
arguments...
--
<Moon>
[adres Reply-To zaszyfrowany ROT13]
------------------------------
Date: Fri, 15 Oct 2004 11:17:39 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: A newbie question
Message-Id: <slrncmvu13.7h7.tadmc@magna.augustmail.com>
Moon <moon@world.universe> wrote:
> Dnia Fri, 15 Oct 2004 15:34:45 GMT, postmaniak Paul Lalli odważył się
> napisać:
>
> Duh, this is a neverending story :/
I get that feeling also.
We are not a substitute for the docs that came with Perl.
Consult those first, ask here only if you don't understand what
the docs say.
> These two are last in the decode script and I definitely don't know how to
> interpret them. What they do?
>
> $enc =~ s/[^$k]//g;
> $enc =~ s/(.)(.)/dec($1,$2)/ge;
>
> Please be so kind and explain to me what they do with the supplied
> arguments...
Please be so kind as to find as many explanations as you can by
yourself before asking hundreds of people around the world to
help you with it.
Do you know what s/// does?
Do you know what s///g does?
Do you know what s///e does?
Do you know what the dec() function does?
Do you know the role of parenthesis in regexes?
Do you know that a character class is?
Do you know what ^ means when it is at the beginning of a character class?
The docs answer all of those, all you have to do is read them...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 15 Oct 2004 18:28:45 +0200
From: Moon <moon@world.universe>
Subject: Re: A newbie question
Message-Id: <3pxvlvi7mugx.1fpe4m6lw3c96$.dlg@40tude.net>
Dnia Fri, 15 Oct 2004 11:17:39 -0500, postmaniak Tad McClellan odważył się
napisać:
> Please be so kind as to find as many explanations as you can by
> yourself before asking hundreds of people around the world to
> help you with it.
OK, sorry... I told earlier that learning Perl is not my goal, I just want
to know how to convert a particular Perl script into C. And as in C there
are no *regexps*, I wanted to avoid (by asking experts) getting through
hundredths of Perl docs and examples about regexps.
Anyway-thank you all!
--
<Moon>
[adres Reply-To zaszyfrowany ROT13]
------------------------------
Date: 15 Oct 2004 17:58:42 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: A newbie question
Message-Id: <Xns95838E31F886asu1cornelledu@132.236.56.8>
Moon <moon@world.universe> wrote in
news:3pxvlvi7mugx.1fpe4m6lw3c96$.dlg@40tude.net:
> Dnia Fri, 15 Oct 2004 11:17:39 -0500, postmaniak Tad McClellan odważył
> się napisać:
>
>> Please be so kind as to find as many explanations as you can by
>> yourself before asking hundreds of people around the world to
>> help you with it.
>
> OK, sorry... I told earlier that learning Perl is not my goal, I just
> want to know how to convert a particular Perl script into C.
Then youshould pay someone to do it for you.
Sinan.
------------------------------
Date: Fri, 15 Oct 2004 15:54:43 GMT
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Help needed replacing deprecated syntax
Message-Id: <7pSbd.6253$d5.52165@newsb.telia.net>
Page wrote:
> Ben Morrow wrote:
>> Quoth dummymb@hotmail.com (Page):
>>>
>>> Here is the offending line:
>>> my $msg = @_->[0];
>>>
>>> What is the current proper syntax for such a statement?
>>
>> That depends on what you meant it to do. If you wanted the first
>> item in @_, you meant $_[0] (perlsyn). If you wanted to deref an
>> array ref in $_ then you meant $_->[0] (perlref). If you wanted
>> something else you will have to tell us what that was.
>
> Ok. It's the first line of a function that may or may not have a
> string value parameter passed to it.
In that case you should learn about subroutines in Perl instead of
just guessing.
perldoc perlsub
The @_ array is explained there, and you also find a lot of
illustrative examples.
> Basically I'm just setting $msg to that parameter, then I check to
> see if it has a value like this:
> if ($msg ne "") { ... do stuff... }
That test is inappropriate, since $msg will be undef if nothing is
passed to the function. Maybe you mean:
if (defined $msg) { ... do stuff... }
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 15 Oct 2004 11:09:24 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <slrncmvthk.7h7.tadmc@magna.augustmail.com>
Geoff Cox <geoff.cox@removethisplease.freeuk.com> wrote:
> On 15 Oct 2004 13:21:18 GMT, "A. Sinan Unur"
><usa1@llenroc.ude.invalid> wrote:
>
> I have offered you my apology which I stand by and will certainly
> provide code when asking a code question in any future postings, but
>
>>The fact that you did not do so is an insult.
>
> I do think you are wrong to use the term insult. The first definition
> I came across gives
>
> insult - a deliberately offensive act.
What have folks that have observed your posts here seen?
You have been asked many times to follow the guidelines,
yet you come back again and again without following them.
It appears as a deliberately offensive act whether deliberate or not.
We can only go by what we see.
> Let me asure you that I was not doing this.
It sure looks that way from where I am sitting.
> Apparently I made a
> mistake,
And then made it again.
And then made it again.
And then made it again.
People get annoyed when you ignore them.
> Perhaps you might withdraw that
> comment?
I wouldn't if it was my comment.
If you dont' want to be seen as rude, then don't do rude things!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 15 Oct 2004 09:39:22 -0700
From: "187" <bigal187@removethis.rx.eastcoasttfc.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <2tacq4F1suj93U1@uni-berlin.de>
Anno Siegel wrote:
> 187 <bigal187@removethis.rx.eastcoasttfc.com> wrote in
> comp.lang.perl.misc:
>> Tad McClellan wrote:
>>> Pinocchio (aka: Fred Canis, aka: 187, aka: krakle...)
>>> <spambiat@yahoo.com> wrote:
>>
>> * removes himself from that list *
>>
>> I had a bad day, I don't normally type that bad, /please/ don't
>> associate me with usenet holigans like that *shudders* :-)
>
> Eh... pinoccio? How's your nose?
A little runny lately (bad cold.) My name is Al [1] though. Not knowing
the
past deal is here (maybe I'll run a search over at Google's archives.
What ever it is, I want everyone to know my name was incorrectly placed
in Tad's little list (not sure if it was in jest or not.) any ways,
since I know I'm not a part of that, it doesn't matter much on my end,
so in the words of Paul Harvey, "Goooo'Day?!"
[1]
For those who don't like nicknames, my name is m!Al(?:fred)? Newmane)!;
------------------------------
Date: Fri, 15 Oct 2004 09:39:22 -0700
From: "187" <bigal187@removethis.rx.eastcoasttfc.com>
Subject: Re: HTML::Parser and <p> behaviour?
Message-Id: <2tactgF1rqjk8U1@uni-berlin.de>
Anno Siegel wrote:
> 187 <bigal187@removethis.rx.eastcoasttfc.com> wrote in
> comp.lang.perl.misc:
>> Tad McClellan wrote:
>>> Pinocchio (aka: Fred Canis, aka: 187, aka: krakle...)
>>> <spambiat@yahoo.com> wrote:
>>
>> * removes himself from that list *
>>
>> I had a bad day, I don't normally type that bad, /please/ don't
>> associate me with usenet holigans like that *shudders* :-)
>
> Eh... pinoccio? How's your nose?
A little runny lately (bad cold.) My name is Al [1] though. Not knowing
the
past deal is here (maybe I'll run a search over at Google's archives.
What ever it is, I want everyone to know my name was incorrectly placed
in Tad's little list (not sure if it was in jest or not.) any ways,
since I know I'm not a part of that, it doesn't matter much on my end,
so in the words of Paul Harvey, "Goooo'Day?!"
[1]
For those who don't like nicknames, my name is m!Al(?:fred)? Newmane)!;
------------------------------
Date: Fri, 15 Oct 2004 17:43:34 +0200
From: fuzz@uni-paderborn.de (Erik Wasser)
Subject: Installing extra data files with a Makefile.PL?
Message-Id: <6q7542-eq3.ln1@wasser-7359.user.cis.dfn.de>
Hi Usenet,
I have written a module with some additional files. These additional
files are some kind of text database for running the module. My question
is: how can I install these additional files with the 'Makefile.PL'? How
can I bring Makefile.PL to copy some text files to '/usr/share/foobar'?
I read the man pages of ExtUtils::MakeMaker,
ExtUtils::MakeMaker::Tutorial, perlmodstyle and perlnewmod but there was
nothing of interests for this problem (or I don't have seen them, links
are welcome).
How does others modules solve this problem of data files? I know the way
of using Data::Dumper to make a perl dump of data but I would prefer the
plain text files because so I can edit the data in a very easy way.
Does anyone know a modul with some extra-data?
--
So long... Fuzz
------------------------------
Date: Fri, 15 Oct 2004 09:59:09 -0500
From: Samik Raychaudhuri <samik@frKKshKll.org>
Subject: Multiline die
Message-Id: <ckook4$2pa$1@news.doit.wisc.edu>
Hello,
I have quick question. I want to shwo a multiline die msg, and I am not getting it.
I am trying:
$sth=$dbh->prepare($querystr) || $class->{errstr}=DBI->errstr; die "Query: $querystr, ".DBI->errstr;
AND
$sth=$dbh->prepare($querystr) || {$class->{errstr}=DBI->errstr; die "Query: $querystr, ".DBI->errstr;}
None works. What is the way?
Regards.
--
To email me, replace 'K' with 'e' in the 'From' field.
------------------------------
Date: 15 Oct 2004 15:26:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Multiline die
Message-Id: <Xns9583745BE5CF8asu1cornelledu@132.236.56.8>
Samik Raychaudhuri <samik@frKKshKll.org> wrote in
news:ckook4$2pa$1@news.doit.wisc.edu:
> Hello,
> I have quick question. I want to shwo a multiline die msg, and I am
> not getting it. I am trying:
> $sth=$dbh->prepare($querystr) || $class->{errstr}=DBI->errstr; die
> "Query: $querystr, ".DBI->errstr; AND
> $sth=$dbh->prepare($querystr) || {$class->{errstr}=DBI->errstr; die
> "Query: $querystr, ".DBI->errstr;}
>
> None works. What is the way?
> Regards.
Why do you want to write hard to read code?
Why don't you read the DBI docs?
The following is easy to read
$sth = $dbh->prepare($querystr)
or die $dbh->errstr;
Notice the $dbh.
Yours is not.
Life is much simpler if you use the appropriate amount of whitespace and
structure.
unless($dbh->prepare($querystr)) {
$class->{errstr} = $dbh->errstr;
die "Query: $querystr, ", $dbh->errstr;
}
Now, while I do hope this helps you, let me point out that you should
read the posting guidelines for this group before you post again. They
are posted here regularly, and can be found on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
Sinan.
------------------------------
Date: Fri, 15 Oct 2004 15:48:02 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Multiline die
Message-Id: <SiSbd.38$bV5.16@trndny07>
"Samik Raychaudhuri" <samik@frKKshKll.org> wrote in message
news:ckook4$2pa$1@news.doit.wisc.edu...
> Subject: Multiline die
Your post seems to have little to do with your Subject. Please put the
subject of your post in the Subject of your post.
> I have quick question. I want to shwo a multiline die msg, and I am
not getting it.
> I am trying:
> $sth=$dbh->prepare($querystr) || $class->{errstr}=DBI->errstr; die
"Query: $querystr, ".DBI->errstr;
> AND
> $sth=$dbh->prepare($querystr) || {$class->{errstr}=DBI->errstr; die
"Query: $querystr, ".DBI->errstr;}
I don't understand why you're bothering to set this $class->{errstr}
value when you immediately die right after it. What is the point of
this statement?
> None works.
That is a remarkably poor error description. How is it not working?
What is it doing that you didn't expect it to do?
Running your (first) code, I get
Can't modify logical or (||) in scalar assignment
That's because || has a higher precedence than =. Switching to 'or'
instead of || would at least solve the compliation error (but would not
do what you actually want it to do)
In the second example, you've forgotten the keyword 'do' before the
block.
> What is the way?
I'd recommend avoiding the "boolean operators for all control-flow"
mentality.
unless ($sth=$dbh->prepare($querystr)){
$class->{errstr}=DBI->errstr;
die "Query: $querystr, ".DBI->errstr;
}
Though, again, I don't understand the point of the first statement.
Paul Lalli
------------------------------
Date: Fri, 15 Oct 2004 17:20:14 +0000 (UTC)
From: crichmon@filc8046.fm.intel.com (Chris Richmond - MD6-FDC ~)
Subject: Re: python for perl programmers?
Message-Id: <ckp0se$2b9$1@news01.intel.com>
Thanks guys!
Chris
--
Chris Richmond | I don't speak for Intel & vise versa
------------------------------
Date: 15 Oct 2004 08:09:16 -0700
From: krakle@visto.com (krakle)
Subject: Re: String and Array Programming in Perl
Message-Id: <237aaff8.0410150709.659eb1a5@posting.google.com>
Phillip.Small@gmail.com (DeveloperGuy) wrote in message news:<64f06fa2.0410140928.22605f24@posting.google.com>...
> Okay, I finally got the script to read the file.
We'll see...
>
> #! /usr/bin/perl
Where's the -w switch?
#!/usr/bin/perl -w
> #bunch of comments here blah blah blah
> #use strict;
> #use warnings;
Why use those pragmas if you aren't going to USE them?
use strict;
use warnings;
>
> open(DataFileHandle, "/home/smallp/data.txt");
What if it doesn't exist? What if it CAN'T open??? Error handle!
open (DataFileHandle, "/home/smallp/data.txt") or die "Can't open
file: $!\n";
>
> @tmpfile = <DataFileHandle>;
Scope your variable!!!
my @tmpfile = <DataFileHandle>;
Now since you have the data in @tmpfile you might as well CLOSE the
file since you ARE done with it so:
close (DataFileHandle);
> @users;
> $users[0];
USELESS does NOTHING.. Hell, tha @users array isn't even used in this
script... OMIT it..
>
> foreach $i (@tmpfile)
Scope please...
foreach my $i (@tmpfile)
> {
> print "$i\n";
> }
So the final result is:
#!/usr/bin/perl -w
use strict;
use warnings;
open (DataFileHandle, "/home/smallp/data.txt") or die "Can't open
file: $!\n";
my @tmpfile = <DataFileHandle>;
close (DataFileHandle);
foreach my $i (@tmpfile) {
print "$i\n";
}
Or another way...
#!/usr/bin/perl -w
use strict;
use warnings;
open (FILE, "/some/where/file.ext") or die "Can't open file: $!\n";
while (<FILE>) { print "$_\n" }
close (FILE);
------------------------------
Date: 15 Oct 2004 15:07:18 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Top posting (was Re: Concatenating an array into one string?)
Message-Id: <Xns95837122BADEAasu1cornelledu@132.236.56.8>
Shawn Corey <shawn.corey@sympatico.ca> wrote in
news:e6Qbd.52314$3C6.1993463@news20.bellglobal.com:
> A. Sinan Unur wrote:
>> That is utter nonsense. Indeed, when I first installed ActivePerl on
>> my Windows computer, I was not immediately aware of perldoc. On the
>> other hand, it took no searching to find the "Documentation" link in
>> the ActivePerl program group in my start menu. Clicking on that link
>> gave me an html page with a complete table of contents.
>
> Not everyone runs Activetsate.
Precisely why you should not have snipped the rest of my post:
> I am assuming anyone who wants to program knows enough of his/her
> system to at least look in the equivalent of that location.
So, on my FreeBSD test bed running on a trusty old P133, I know to do
man perl
which then shows me a table of contents.
Since I don't have an extra grand lying around, I do not have shiny new
Mac box, so I can't describe to you where you can find the documentation
on your own computer, but I am willing to assume that if you started a
shell and typed
man perl
you would get the same table of contents.
The whole point is, if people who do not know where documentation gets
installed on their _own_ computers are choosing not to know and learn.
That is rude.
Now, there is nothing anyone can do to help those with IQs below the room
temperature.
http://www.pcmag.com/print_article/0,1761,a=49268,00.asp
Sinan
------------------------------
Date: Fri, 15 Oct 2004 17:32:08 +0200
From: Tore Aursand <toreau@gmail.com>
Subject: Re: Unlink Question
Message-Id: <pan.2004.10.15.15.32.05.550765@gmail.com>
On Thu, 14 Oct 2004 19:39:46 +0000, Scott Hoffman wrote:
> Back to the browser - No error but no results either
Please define "no result". If it doesn't work, please tell us _why_ it
doesn't work ('cause Perl will tell you in most cases).
> Changed the Permissions to from 755 to 777 (I know, I know)
I don't think you do. First of all, there is no point in changing the
permission on the CGI script; the problem is that the CGI script (or the
user running it) doesn't have access to delete the specified files.
Secondly, there _may_ be a problem with Apache in this case. There have
been issues where Apache (with a special configuration?) won't run files
with a 777 permission.
> #!/usr/bin/perl
You're missing these;
use strict;
use warnings;
> $dir = "/Library/Webserver/Documents/unlink_text" ;
No need to use double quotes;
my $dir = '/Library/Webserver/Documents/unlink_text';
> opendir (DIR, "$dir/");
> @FILES = grep(/.txt/,readdir(DIR));
> closedir (DIR);
What happens if 'opendir()' fail? Always check the result. You also,
most probably, don't want files with '(some-character)txt' _in_ their
filename, but files with '.txt' at _the end of_ their filename;
opendir( DIR, "$dir/" ) or die "$!\n";
my @FILES = grep { /\.txt$/ } readdir( DIR );
closedir( DIR );
> foreach $FILES (@FILES) {
> if (-e "$dir/$FILES") {
> unlink("$dir/$FILES");
> }
> }
Change this to:
foreach ( @FILES ) {
next unless ( -e );
unless ( unlink ) {
# An error occured
}
}
--
Tore Aursand <toreau@gmail.com>
"Anyone who slaps a 'this page is best viewed with Browser X'-label on
a web page appears to be yearning for the bad old days, before the
web, when you had very little chance of reading a document written on
another computer, another word processor or another network." (Tim
Berners-Lee, July 1996)
------------------------------
Date: 15 Oct 2004 08:38:58 -0700
From: kejoseph@hotmail.com (Kevin Joseph)
Subject: Re: Win2k - Ping - improved.
Message-Id: <54c48ac0.0410150738.2e1a69e3@posting.google.com>
Hi Sinan,
Thanks for responding. Note that when I run the exact same code on
Linux, it works just fine. Dont know why it does not work in Win2k.
A little more research revealed that the sleep statement is causing a
problem. If I dont have a sleep statement, it works fine. In place of
a sleep statement if I have a "system(pause)" statement, I get the
same results. Pretty strange.
Kevin.
> use strict;
> use warnings;
>
> which would have enabled you to detect an error below.
>
> > $p = Net::Ping->new(icmp) ;
>
> Notice something wrong here?
>
> Please do not post code without 'strict' and 'warnings'.
>
> I observed the same behavior testing on my home network. The issue
> disappears the moment I reach outside my home network. Incidentally, the
> Win32 command line ping also shows the same behavior. Thus, it appears as
> though this is not a Perl issue.
>
> Sinan.
------------------------------
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 V10 Issue 7257
***************************************