[23337] in Perl-Users-Digest
Perl-Users Digest, Issue: 5557 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 24 18:06:04 2003
Date: Wed, 24 Sep 2003 15:05: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 Wed, 24 Sep 2003 Volume: 10 Number: 5557
Today's topics:
Re: add half an hour to all times in file <krahnj@acm.org>
Re: Baffled newbie SNMP script (Steve The Geek)
Re: class methods <tore@aursand.no>
Re: cron/http absolute directories <Juha.Laiho@iki.fi>
Re: Determine connection status on Linux (PS) <kalinabears@iinet.net.au>
Expert: What is wrong here? (Great Deals)
Re: Expert: What is wrong here? (Gary E. Ansok)
Re: Fetching ActiveState PPD files without Installing t <kalinabears@iinet.net.au>
Re: How do I pass a value to a PERL script from an <a h <No_4@dsl.pipex.com>
Mapping characters in a string (Alfred von Campe)
Re: Mapping characters in a string <uri@stemsystems.com>
Re: Mapping characters in a string <abigail@abigail.nl>
Re: Mapping characters in a string <krahnj@acm.org>
module installing <samj2@austarmetro.com.au>
Re: module installing <samj2@austarmetro.com.au>
Re: Newbie: form checkboxes & param <noone@nowhere.com>
Re: Newbie: form checkboxes & param <tore@aursand.no>
Re: Setting Win32 priority from within a process <ThomasKratz@REMOVEwebCAPS.de>
Re: Split variable into fields ? <uri@stemsystems.com>
Re: Split variable into fields ? <dave.nospam@ntlworld.com>
Re: SSL with Perl <rhersiczky@nospam-hotmail.com>
strip given HTML tags <jidanni@jidanni.org>
Re: Trouble with 0 ctcgag@hotmail.com
Re: Why do these "?:" conditionals work differently? (malgosia askanas)
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 24 Sep 2003 20:52:52 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: add half an hour to all times in file
Message-Id: <3F72040A.153765D2@acm.org>
Dan Jacobson wrote:
>
> $ cat file
> 18:25
> 18:56
> $ perl -wlpe 'Please tell me what to write here to get the following' file
> 18:55
> 19:26
> Maybe perldoc Date::Parse has something to do with this.
> In Unix I can do $ date +%H:%M -d '22:22 + 30 minutes'.
$ perl -e'
use Time::Local;
my @times = qw/ 18:25 18:56 23:42 /;
for my $time ( @times ) {
print "$time ";
$time = join":",(gmtime(timegm(0,(reverse $time=~/\d+/g),(gmtime)[3,4,5])+1800))[2,1];
print "$time\n";
}
'
18:25 18:55
18:56 19:26
23:42 0:12
John
--
use Perl;
program
fulfillment
------------------------------
Date: 24 Sep 2003 11:24:31 -0700
From: slkleine@hotmail.com (Steve The Geek)
Subject: Re: Baffled newbie SNMP script
Message-Id: <863f122c.0309241024.7eace7bf@posting.google.com>
slkleine@hotmail.com (Steve The Geek) wrote in message news:<863f122c.0309240511.48b8948d@posting.google.com>...
> I grabbed SNMP_Session-0.98 and well, wow. :-)
>
> What I'm trying to do is read an iplist from file and set the time on
> the devices using the snmpset subroutine. The module compiles, but
> terminates with error **Undefined subroutine &main::snmpset called at
> Set-time-all.pl line 31, <IPLIST> line 139.**
<<much snippage>>
Never mind. I'm an idiot.
It woulda helped if I actually put the subroutines in.
Steve the (embarrassed) Geek
------------------------------
Date: Wed, 24 Sep 2003 23:55:24 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: class methods
Message-Id: <pan.2003.09.24.18.31.03.543131@aursand.no>
On Wed, 24 Sep 2003 18:55:38 +0200, Matija Papec wrote:
>> Seems like bad behaviour in my eyes, but then again I've never used
>> anything else than this syntax:
>>
>> my $MyObject = MyClass->new();
>> $MyObject->foo();
> Even in cases when method isn't directly manipulating $MyObject but
> impacting a whole class?
I'll be the first to admit that I'm not an OO guru; I've never been
teached "proper OO" (if there's such a thing) by a teacher (never attended
computer science at school), and I might not be familiar with the OO
terminology. I have, however, been programming "OO-style" for several
years (since the early 90's). And I've read Damian Conway's excellent
book about OO programming in Perl. :-)
And:
There is no such thing as "manipulating a whole class", or - as you
describe it - impacting a whole class. You never work with _classes_.
You work with objects, which are _instances of classes_.
Therefore, IMO, one should avoid calling a class' method without going
through an instance of the class (even if this is possible in Perl).
If you're "manipulating a class directly", there is no need for objects
(or classes) in the first place. You would be dealing with "ordinary Perl
modules", which _will_ be troublesome in the long run.
Cutting from an other post from you:
> So basicaly it would be safest to call Foo()
> $self->Foo(); within the package [...]
Yes. If the method 'Foo()' is a member of the same _class_. Please be
specific when you're talking about packages/modules and/or classes. There
is a difference.
> [...] and SomeClass->Foo(); from other packages?
No. You _should not_ call the class' method directly. You should rather,
as I've already pointed out, call the method on an instance (ie. an
object) of the class.
--
Tore Aursand <tore@aursand.no>
------------------------------
Date: Wed, 24 Sep 2003 18:57:00 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: cron/http absolute directories
Message-Id: <bkspag$go1$1@ichaos.ichaos-int>
"D Borland" <no.name@eidosnet.co.uk> said:
>well if people had actualy just said that it was my quoting style that they
>were upset with, rather than "top posting" which to me sounds totaly
No, quoting style is a different issue. Above you see one quoting style
(just > to indicate the part written by you), which more or less is the
preferred one.
:un-related and didn't have a clue what you were talking about then i could
:have sorted the problem and everyone would have been ok. Ok so i spell
This above would be another quoting style. At times you see quoting style
like the one below:
DB>wrong when i typing fast sometimes, but using "top posting" instead of
DB>"quoting style" is the real problem here. And having read through the
DB>posting guidelines, i notice the following :-
>Oh, now there's something. So all these people who drop first-timers in
>their kill file because of this (this and the fact they can't just say
>"quoting style" rather than "top posting" [...]
It shouldn't be that hard to do a google search on "top posting" to
find f.ex. the ones below. Btw. please make your mind up whether you're
a first-timer or a veteran here (I recall seeing another message where
you said you've been around for more than 10 years, which wouldn't
make you a first-timer). But then, if you are a first-timer around,
then I guess I should understand you're not yet familiar with Google,
either. It is a very nice and easy-to-use information search engine
available at http://google.com/ .
Bottom vs. top posting and quotation style on Usenet
Bottom vs. top posting and quotation style on Usenet. This document
was ... as well. This can't at all be done in a top-posting. Also ...
www.cs.tut.fi/~jkorpela/usenet/brox.html - 6k - Cached - Similar pages
Why is Bottom-posting better than Top-posting
Why is Bottom-posting better than Top-posting. ... Top-posting:
Writing the message above
the original text, when one replies to an email or a post in a
newsgroup. ...
Top Posting
Top Posting. by David Stevenson, Liverpool, England, UK. ... The best
way is to answer
the post underneath as here. Top posting means putting the answer
first. ...
www.blakjak.demon.co.uk/gey_stv0.htm - 7k - Cached - Similar pages
The Absolute Beginners Guide to Usenet - FAQ - Top Posting
The Absolute Beginner's Guide to Usenet. Absolute Beginner's
Frequently
Asked Questions. 8. What is Top-Posting and why is it considered bad?
...
www.dickalba.demon.co.uk/usenet/guide/faq_topp.html - 8k - 23 Sep 2003
- Cached - Similar pages
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: Thu, 25 Sep 2003 04:56:12 +1000
From: Sisyphus <kalinabears@iinet.net.au>
Subject: Re: Determine connection status on Linux (PS)
Message-Id: <3f71e97e$0$23589$5a62ac22@freenews.iinet.net.au>
David Efflandt wrote:
> One other note is that if you specifically want to do something whenever
> Linux pppd connects, do it from /etc/ppp/ip-up (or ip-up.local). This
> runs whever pppd gets an IP address. But use full paths, because
> environment is minimal (also note that anything there would run as root).
>
Thanks David.
Cheers,
Rob
------------------------------
Date: 24 Sep 2003 12:18:09 -0700
From: deals@slip-12-64-108-121.mis.prserv.net (Great Deals)
Subject: Expert: What is wrong here?
Message-Id: <cafe07c7.0309241118.159fc2dd@posting.google.com>
#!/usr/bin/perl
use HTML::LinkExtor;
$input='<a href=hreflink></a> <img src=imglink>';
getlink ('img');
getlink ('a');
sub getlink{
my $matchkey = $_[0];
print "matchkey outsite callback $matchkey \n";
sub callback {
print "matchkey inside callback $matchkey\n";
return;
}
my $p = HTML::LinkExtor->new(\&callback);
$p->parse($input);
}
The output is:
matchkey outsite callback img
matchkey inside callback img
matchkey inside callback img
matchkey outsite callback a
matchkey inside callback img
matchkey inside callback img
But it should be
matchkey outsite callback img
matchkey inside callback img
matchkey inside callback img
matchkey outsite callback a
matchkey inside callback a
matchkey inside callback a
What's wrong here?
------------------------------
Date: Wed, 24 Sep 2003 22:04:15 +0000 (UTC)
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: Expert: What is wrong here?
Message-Id: <bkt4cv$prd$1@naig.caltech.edu>
In article <cafe07c7.0309241118.159fc2dd@posting.google.com>,
Great Deals <deals@slip-12-64-108-121.mis.prserv.net> wrote:
>#!/usr/bin/perl
> use HTML::LinkExtor;
If you'd asked Perl, it would have told you what was wrong.
Although in this case, the short message you get from -w or
use warnings is rather cryptic. However, the longer message
you get from use diagnostics is quite specific on what the
problem is and how to fix it.
>$input='<a href=hreflink></a> <img src=imglink>';
>
>getlink ('img');
>getlink ('a');
>
>sub getlink{
> my $matchkey = $_[0];
> print "matchkey outsite callback $matchkey \n";
>
> sub callback {
>
> print "matchkey inside callback $matchkey\n";
> return;
> }
>
Here's the problem... make this
my $callback = sub { print "matchkey in $matchkey\n"; };
> my $p = HTML::LinkExtor->new(\&callback);
And then this needs to be
my $p = HTML::LinkExtor->new($callback);
Or you can combine them:
my $p = HTML::LinkExtor->new(sub { print "in\n" });
> $p->parse($input);
>}
Gary
--
10:26 a.m. A tan-sweatered hacky sack player allegedly offered marijuana
for sale to the wrong person, who told a shop owner, who called police.
The wacky terbacky hacky lackey fast slacked back sack-smacking heels in
the Pink House, and that's a fact. - Arcata Eye Police Log, 13 Aug 2003
------------------------------
Date: Thu, 25 Sep 2003 05:14:41 +1000
From: Sisyphus <kalinabears@iinet.net.au>
Subject: Re: Fetching ActiveState PPD files without Installing them
Message-Id: <3f71edd3$0$23589$5a62ac22@freenews.iinet.net.au>
Graham Wood wrote:
> John Ramsden wrote:
> <snipped>
>
>>Is there a way to retrieve the ppd file from whichever repository a normal
>>'install' would have obtained it
>
>
> ActiveState's website has a repository of zipped ppd archives that you
> can download and install using ppm from a local folder.
>
> http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/Zips
>
> Just look for the zipfile that corresponds to the modules you're looking
> for.
>
> Hope this helps
>
> Graham
One (minor?) problem with this is that (afaik) the zips aren't updated
all that often, so you might miss out on the most recent version of the
module that you're installing. (Otoh, the ppm's get updated regularly.)
With my version of ppm I can run:
ppm set clean 0
ppm set build C:\ppms
and the ppm's of any packages that I install will be saved in C:\ppms.
I think the ppm's can also be grabbed without doing an install - but I'm
not sure how.
My version of ppm is not the most recent, and I'm unsure of how it has
changed. To see the various options that I can set I run:
ppm help set
ActiveState now hosts a ppm-specific mailing list. You might also try there.
Hth.
Cheers,
Rob
------------------------------
Date: Wed, 24 Sep 2003 19:36:09 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: How do I pass a value to a PERL script from an <a href?
Message-Id: <3f71e41b$0$15780$cc9e4d1f@news.dial.pipex.com>
Barry Kimelman wrote:
> Now with that having been said to pass a parameter value to a Perl
> script you can do the following :
>
> <a href="/cgi-local/PerlScript.pl?parm1=567&parm2=999">
Well, not exactly (although we are still on HTML-authoring rather
than Perl here).
'&' is an active character in HTML, so you should actually use:
<a href="/cgi-local/PerlScript.pl?parm1=567&parm2=999">
when putting this into HTML text. The fact that not doing so usually
works is only because browsers seems to assume you mean a raw & if they
don't find the matching ';' within a few chars.
Now (back more towards Perl here) if you are using the CGI.pm module
to handle this on the server side it allows you to use ';' as the
parameter delimiter so that you don't need to html_escape it (but you
should take care that you do html_escape the separate parts of the URI
if necesaary).
--
-*- Just because I've written it here doesn't -*-
-*- mean that you should, or I do, believe it. -*-
------------------------------
Date: 24 Sep 2003 11:18:50 -0700
From: alfred@110.net (Alfred von Campe)
Subject: Mapping characters in a string
Message-Id: <4d599f95.0309241018.497db020@posting.google.com>
I must have a brain cramp today, because I can not figure out an
elegant way to do the following. I have a 16 byte, binary MD5 digest
(generated with Digest::MD5) in one scalar, and another scalar
containing exactly 256 printable characters. I want to create a
printable version of the MD5 digest by using the bytes of the digest
as an index into the string of printable characters. I can do this in
a loop one byte at a time, but there must be a solution using map
and/or pack/unpack to do this more elegantly. Any ideas?
Alfred
------------------------------
Date: Wed, 24 Sep 2003 18:50:35 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Mapping characters in a string
Message-Id: <x7u172c96t.fsf@mail.sysarch.com>
>>>>> "AvC" == Alfred von Campe <alfred@110.net> writes:
AvC> I must have a brain cramp today, because I can not figure out an
AvC> elegant way to do the following. I have a 16 byte, binary MD5 digest
AvC> (generated with Digest::MD5) in one scalar, and another scalar
AvC> containing exactly 256 printable characters. I want to create a
AvC> printable version of the MD5 digest by using the bytes of the digest
AvC> as an index into the string of printable characters. I can do this in
AvC> a loop one byte at a time, but there must be a solution using map
AvC> and/or pack/unpack to do this more elegantly. Any ideas?
slice to the (double) rescue!!
<untested>
my $encoded_md5 = join( '', (split //, $md5_map)[ split //, $md5_digest ] ) ;
<aside to lame flamer>
oh, borland, where is thy limp flame now? any answers from you?
typical flame but no help.
</aside to lame flamer>
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Damian Conway Class in Boston - Sept 2003 -- http://www.stemsystems.com/class
------------------------------
Date: 24 Sep 2003 19:18:21 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Mapping characters in a string
Message-Id: <slrnbn3rft.eem.abigail@alexandra.abigail.nl>
Alfred von Campe (alfred@110.net) wrote on MMMDCLXXVI September MCMXCIII
in <URL:news:4d599f95.0309241018.497db020@posting.google.com>:
== I must have a brain cramp today, because I can not figure out an
== elegant way to do the following. I have a 16 byte, binary MD5 digest
== (generated with Digest::MD5) in one scalar, and another scalar
== containing exactly 256 printable characters. I want to create a
== printable version of the MD5 digest by using the bytes of the digest
== as an index into the string of printable characters. I can do this in
== a loop one byte at a time, but there must be a solution using map
== and/or pack/unpack to do this more elegantly. Any ideas?
Untested:
use bytes; # Just in case.
$digest = "........"; # 16 bytes.
$chars = "........"; # 256 chars.
my $str = join "" => (split // => $chars) [map {ord} split // => $digest];
Abigail
--
perl -swleprint -- -_=Just\ another\ Perl\ Hacker
------------------------------
Date: Wed, 24 Sep 2003 21:13:07 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Mapping characters in a string
Message-Id: <3F7208C7.D4E19CD4@acm.org>
Alfred von Campe wrote:
>
> I must have a brain cramp today, because I can not figure out an
> elegant way to do the following. I have a 16 byte, binary MD5 digest
> (generated with Digest::MD5) in one scalar, and another scalar
> containing exactly 256 printable characters. I want to create a
> printable version of the MD5 digest by using the bytes of the digest
> as an index into the string of printable characters. I can do this in
> a loop one byte at a time, but there must be a solution using map
> and/or pack/unpack to do this more elegantly. Any ideas?
Did you try Digest::MD5::md5_hex() or Digest::MD5::md5_base64() for a
printable version?
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 24 Sep 2003 19:03:32 GMT
From: Sam <samj2@austarmetro.com.au>
Subject: module installing
Message-Id: <3F71EC71.1080504@austarmetro.com.au>
Hello
after I installed DBI
$dh-make-perl --cpan DBI
done
~/.cpan/build/DBI$perl Makefile.PL
$make
$make test --all ok
$make intall
$perldoc DBI
No documentation found for "DBI"
does that mean I did not install the module or the module is installed
with no docs. and how can I truble shoot this, I need the module working.
thanks alot
------------------------------
Date: Wed, 24 Sep 2003 21:49:01 GMT
From: Sam <samj2@austarmetro.com.au>
Subject: Re: module installing
Message-Id: <3F721158.6050507@austarmetro.com.au>
Sam wrote:
> Hello
> after I installed DBI
> $dh-make-perl --cpan DBI
> done
> ~/.cpan/build/DBI$perl Makefile.PL
> $make
> $make test --all ok
> $make intall
>
> $perldoc DBI
> No documentation found for "DBI"
>
> does that mean I did not install the module or the module is installed
> with no docs. and how can I truble shoot this, I need the module working.
>
> thanks alot
>
$man DBI
shows the docs
well, why perldoc DBI did not show it?
------------------------------
Date: Wed, 24 Sep 2003 21:40:12 GMT
From: "gibbering poster" <noone@nowhere.com>
Subject: Re: Newbie: form checkboxes & param
Message-Id: <%aocb.557$yJ5.116329725@newssvr13.news.prodigy.com>
"Nadine" <nadine@mail.sdsu.edu> wrote in message
news:bksk5j$to3$1@gondor.sdsu.edu...
> I have a script to print out the values of a form's fields to a file.
> That works fine. However I wanted to print out the values of all the
> checkboxes, not just the ones checked, to make analysis easier. I
> shortened my script to deal with just the checkboxes until I got this
> matter settled. I found several ideas on the web about using param
> with checkboxes. I tried two but, being a newbie, I do not know how
to
> fix the script. Debug says I have compilation errors near line 24 and
> "0". I tried a couple things but got nowhere.
Untested:
#!/usr/bin/perl -l
use CGI qw ':standard';
use strict;
use warnings;
print header, start_html;
print title ('Results');
print '<body>';
print h2 ('Results');
print "$_ => @{[ param ($_) ]}" for grep /^c/, param();
print '</body></html>';
if you name all your checkboxes starting with a 'c' ... you will get the
name, and values of only those parameters...
------------------------------
Date: Wed, 24 Sep 2003 23:55:25 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: Newbie: form checkboxes & param
Message-Id: <pan.2003.09.24.18.38.34.715656@aursand.no>
On Wed, 24 Sep 2003 10:33:02 -0700, Nadine wrote:
> #!/usr/bin/perl -w
> use CGI qw(:standard);
Good! You're using the CGI module. You should, however, use the strict
module as well;
#!/usr/bin/perl
#
use strict;
use warnings;
> print "Content-type:text/html\n\n";
You could also let the CGI module do this work for you:
print $cgi->header(-type => 'text/html');
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs = split(/&/, $buffer);
> foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $FORM{$name} = $value;
> }
Aaaargh! Earlier on you declared that you wanted to use the CGI module,
but you're not! Do _not_ parse STDIN yourself. Instead use the famous
CGI module. Example:
my $cgi = CGI->new();
my $value = $cgi->param( 'keyword' ) || '';
> @boxes = ("c1", "c2", "c3", "c4");
> my $key;
> my $box;
> foreach $key(@boxes) {
> $box=param($FORM{$key})||'0'; # print value or zero
> print "$box|\n";
> }
Use the CGI.pm module and rewrite this as something like this:
foreach my $box ( qw(c1 c2 c3 c4) ) {
my $value = $cgi->param( $box ) || 0;
print $value . "|\n";
}
--
Tore Aursand <tore@aursand.no>
------------------------------
Date: Wed, 24 Sep 2003 20:31:48 +0200
From: Thomas <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: Setting Win32 priority from within a process
Message-Id: <3f71e38a.0@juno.wiesbaden.netsurf.de>
Curufin wrote:
> Hi,
>
> Is there a simple way for a perl process to change its own priority on Win32
> ?
> From what I understand Win32::Process works only on child processes and
> getpriority()/setpriority() are not available on Win32.
Win32::Process is the right module. Use something like this:
use Win32;
use Win32::Process;
my(%PVal) = (
IDLE => IDLE_PRIORITY_CLASS,
HIGH => HIGH_PRIORITY_CLASS,
NORMAL => NORMAL_PRIORITY_CLASS,
REALTIME => REALTIME_PRIORITY_CLASS,
);
sub SetOwnProcessPriority {
my($prio) = @_;
my($obj);
Win32::Process::Open($obj, $$, 0);
unless ($obj) {
print "error creating Win32::Process object",
Win32::FormatMessage(Win32::GetLastError());
return;
}
unless ( $obj->SetPriorityClass($PVal{$prio}) ) {
print "error setting process priority $prio\n",
Win32::FormatMessage(Win32::GetLastError());
return;
}
print "successfully set process priority to $prio\n";
}
then you can use:
SetOwnProcessPriority('IDLE');
somewhere in your script.
Thomas
------------------------------
Date: Wed, 24 Sep 2003 18:44:55 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Split variable into fields ?
Message-Id: <x7wubyc9g8.fsf@mail.sysarch.com>
>>>>> "DB" == D Borland <no.name@eidosnet.co.uk> writes:
DB> You are right though, i agree. But like i tried to say - Just
DB> don't answer it if you think it's stupid. But hey then again who
DB> am i to tell people right from wrong. You do whatever you want to
DB> do dude :)
and how does your post contributes to this thread? well, you obviously
want to volunteer to answer all newbie questions here in the most kind
and accurate way you can. we give this job to all the guys who flame
about the style of answers. you know what? they never do the job. all
they do is flame some more and then leave (us in peace). you have been
plonked by many already and haven't helped anyone at all. yet you claim
the right to flame. hahahahaha
go join moronzilla over there in the lamer line. perl and intelligent
discussion of it are beyond your skills.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Damian Conway Class in Boston - Sept 2003 -- http://www.stemsystems.com/class
------------------------------
Date: Wed, 24 Sep 2003 20:45:54 +0100 (BST)
From: "Dave Saville" <dave.nospam@ntlworld.com>
Subject: Re: Split variable into fields ?
Message-Id: <qnirfnivyyragyjbeyqpbz.hlqvgif.pminews@text.news.ntlworld.com>
On Wed, 24 Sep 2003 12:02:32 -0500, Eric J. Roode wrote:
<snip>
>Surely you must admit that asking what is the perl operator to *split* data
>up into fields is a stupid question? Or asking what the Perl equivalent to
>awk's -F is?
There are *no* stupid questions, only stupid answers :-)
Just because the operation he wants to do and the perl operator to do
it happen, in this instance, to be the same word, does not make it a
stupid question. What if he had said "chop" the data up? It is only
"stupid" in that *the perl experts* know there is a function called
split and *the newbie* does not. So to the experts it is a funny in
joke. If he knew he would not have asked. I hope :-)
And before anyone starts jumping up and down and shouting "perldoc -q",
sometimes it is not that easy to find something, especially if you have
no idea what a particular process is called in a given language - it is
the same problem with indexes in a book - if you are looking for "foo"
and the author decided it belongs under "bar" you don't stand much
chance of finding it.
Now I agree that a "perldoc -q split" was not too great a leap of
imagination in this case, but sometimes I have been unable to find the
docs for something that I *knew* was there - but how it was keyed, or
under which part of the documentation system it was hidden eluded me.
So looking for something that *might* be there can be a bit daunting.
Cut the guy a little slack - we all were beginners once and hopefully
we never stop learning. Don't forget that to the newbie a FAQ isn't -
it is something he does not understand or know how to do. It is only a
FAQ to the rest of us. Be gentle and they will most likely find it
themselves next time. Now if they *keep* coming back with essentially
the same type of question - that is an entirely different matter and
they need jumping on.
Just my 2cents.
Regards
Dave Saville
NB switch saville for nospam in address
------------------------------
Date: Wed, 24 Sep 2003 22:00:55 +0200
From: "Reto H." <rhersiczky@nospam-hotmail.com>
Subject: Re: SSL with Perl
Message-Id: <3f71f7fc$0$3665$5402220f@news.sunrise.ch>
See http://lamps.efactory.de/lamps-2-0.shtml [German :-o]
--
"Franklin Lee" <pengtaoli@hotmail.com> wrote
> I will implement SSL with apache.
>
> Do you know where I can find some reference?
------------------------------
Date: Thu, 25 Sep 2003 02:27:36 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: strip given HTML tags
Message-Id: <87r826vy7b.fsf@jidanni.org>
This solution posted two months ago was supposed to strip all the HTML
tags given on the command line, but it turns out it strips all the
tags whatsoever. Help.
#!/usr/bin/perl -w
# striptag -- strip given tags out of HTML
#Usage example: striptag font div < file.html
use strict;
use HTML::Parser;
my $parser = HTML::Parser->new( text_h => [ sub { print shift; },"dtext" ]);
$parser->parse_file(*STDIN);
------------------------------
Date: 24 Sep 2003 19:59:57 GMT
From: ctcgag@hotmail.com
Subject: Re: Trouble with 0
Message-Id: <20030924155957.687$w8@newsreader.com>
"Richard S Beckett" <spikey-wan@bigfoot.com> wrote:
> Guys,
>
> I have managed to get this far in my quest to capture data sent into the
> serial port with windows...
>
> use strict;
> use warnings;
> use Win32::SerialPort;
> my $port = new Win32::SerialPort ("COM1") || die "can't open COM1\n";
> open (FILE, ">file.txt");
> foreach (1..100000) {
> my $input;
> if ($input = $port->input) {print FILE "$input\n"}
> }
> print "Finished\n";
> close FILE;
>
> This seems to work OK, unless I get a zero sent into the port. I can't
> work out how to trap the zero, and distinguish it from no input.
test $input with either "defined" or "length", depending on whether the
input you wish to skip is undef, or the empty string, respectively.
Or, just take out the "if" altogether, as printing either an empty string
or an undef is pretty much the same as not printing it.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: 24 Sep 2003 14:09:13 -0400
From: ma@panix.com (malgosia askanas)
Subject: Re: Why do these "?:" conditionals work differently?
Message-Id: <bksmk9$222$1@panix1.panix.com>
I wrote:
>> In perl5.6.1, this code:
>>
>> $DEBUG = 1;
>> $DEBUG ? $prefix = 'foo' : $prefix = 'bar';
>> print $prefix
>>
>> prints "foo", even though $DEBUG is set to 1.
I meant, of course, that it prints "bar", even though $DEBUG is set to 1.
Many thanks to Glenn Jackman for seeing beyond my error and for explaining the
mechanism:
>The ?: operator has higher precedence than =, so I think your first
>example is equivalent to
> ($DEBUG ? $prefix = 'foo' : $prefix) = 'bar';
>Which evaluates to
> $prefix = 'foo' = 'bar';
>
>You probably want:
> $prefix = $DEBUG ? 'foo' : 'bar';
>
-malgosia
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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.
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 5557
***************************************