[21951] in Perl-Users-Digest
Perl-Users Digest, Issue: 4173 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 25 14:06:12 2002
Date: Mon, 25 Nov 2002 11:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 25 Nov 2002 Volume: 10 Number: 4173
Today's topics:
Re: @INC, use, $LD_LIBRARY_PATH, & modules <family2@aracnet.com>
A little help on a regex expression please <jane.doe@acme.com>
Re: A little help on a regex expression please <nobull@mail.com>
Re: A little help on a regex expression please <jane.doe@acme.com>
Re: A little help on a regex expression please <nobull@mail.com>
Re: A little help on a regex expression please (Tad McClellan)
Re: a question on regular expression <usenet@dwall.fastmail.fm>
Change Perl version help (Fredrik Andersson)
Re: Change Perl version help <steven.smolinski@sympatico.ca>
Re: Help with grep + hash value (Trent Hare)
MIME unpacking (Barry King)
Re: MIME unpacking <nobull@mail.com>
Re: My cgi can't write in a file <sheukels=cuthere=@yahoo.co.uk>
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
Newbie needs help- trying to submit command-line functi (D)
Re: Newbie needs help- trying to submit command-line fu <palladium@spinn.net>
Re: Newbie needs help- trying to submit command-line fu (Tad McClellan)
Pattern matching, may contain - or . (Marc Pelletier)
Re: Pattern matching, may contain - or . <nobull@mail.com>
Re: Perl Books <andrew_harton@agilent.com>
Sending errors to named file as well as stderr <william.cardwell@ericsson.com>
Re: Sending errors to named file as well as stderr <robertbu@hotmail.com>
Re: Sending errors to named file as well as stderr <stevenm@blackwater-pacific.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 25 Nov 2002 08:18:11 -0600
From: Abernathey Family <family2@aracnet.com>
Subject: Re: @INC, use, $LD_LIBRARY_PATH, & modules
Message-Id: <3DE23123.BAFBFB8A@aracnet.com>
"Steven N. Hirsch" wrote:
>
> Dave Cross wrote:
>
> >>I'm in a multi-national company with access via afs to groups with their
> >>own builds/installations of Perl.
> >>By the way, some of modules have c-libraries with them. "use lib
> >>"pathname" works for getting the path into the @INC array but I still
> >>get an error from Linux Dyna-loader that it can't find them. The error
> >>goes away when I set my LD_LIBRARY_PATH variable to point at the
> >>c-libraries. But this variable has to be set "outside" of my Perl
> >>script. Modifying my script's local copy of this variable
> >>$ENV{LD_LIBRARY_PATH} doesn't work.
> >
> >
> > Have you tried setting $ENV{LD_LIBRARY_PATH} in a BEGIN block?
> >
> > BEGIN {
> > $ENV{LD_LIBRARY_PATH} = '/path/to/shared/objects';
> > }
> >
> > use lib /path/to/perl/modules;
> >
> > use Some::Wierd::Module;
>
> I'm in the same boat at work as the original poster (we probably work at
> different sites together). We've developed some rather ugly workarounds
> involving creative use of the "pound-bang" header to run setup scripts.
> That aside, setting the LD_LIBRARY_PATH in BEGIN{} does not work on
> some architectures (security issues, I suppose), and it's often
> necessary to condition it before starting perl.
--snip--
My "ugly" solution to the this was to put a shell script wrapper around
my Perl script. The wrapper sets the variables and then executes my
script. This "ugly" approach is extended to handle multi-module scripts
where the script starts up pointing to one set of libraries and in later
execution needs to point to other libraries - although I think this
could go away by modifying LD_LIBRARY_PATH correctly so that my new path
is appended. Do you have a less "ugly" solution to this LD_LIBRARY_PATH
issue?
------------------------------
Date: Mon, 25 Nov 2002 18:24:35 +0100
From: Jane Doe <jane.doe@acme.com>
Subject: A little help on a regex expression please
Message-Id: <46n4uusutat89kacjrphkgl1mt339fnpjj@4ax.com>
Hi,
I've read the O'Reilly, but I'm not an expert, and neither do I know
Perl as I don't use it that often.
I'm trying to parse web pages, and extract the following information:
size="4"><strong>PARIS</strong></font></p>
OR
<td width="609"><font size="4">123 rue Dupont</font></td>
The part I'd like to extract in this example is "PARIS" and "123 rue
Dupont".
Here's the regex I use:
s/^.*size="4">(<strong>)?(.+)(<\/strong>)?<\/font>/$2/i;
I thought that using the ()? pattern meant : "This pattern might be
there".
Actually, I'm only interested in the (.+) part, but on some lines,
this part might be preceded and followed by <strong> (and </strong>)
tags, which I'd like to remove.
Any idea?
Thanks for any tip
JD.
------------------------------
Date: 25 Nov 2002 17:59:14 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: A little help on a regex expression please
Message-Id: <u9znrxfs3x.fsf@wcl-l.bham.ac.uk>
Jane Doe <jane.doe@acme.com> writes:
> I've read the O'Reilly, but I'm not an expert, and neither do I know
> Perl as I don't use it that often.
>
> I'm trying to parse web pages,
You should be using an HTML parser then. Trying to parse HTML with
simple regex is a lost cause except in very special cases.
> and extract the following information:
>
> size="4"><strong>PARIS</strong></font></p>
> OR
>
> <td width="609"><font size="4">123 rue Dupont</font></td>
>
> The part I'd like to extract in this example is "PARIS" and "123 rue
> Dupont".
>
> Here's the regex I use:
>
> s/^.*size="4">(<strong>)?(.+)(<\/strong>)?<\/font>/$2/i;
>
> I thought that using the ()? pattern meant : "This pattern might be
> there".
That is correct.
> Actually, I'm only interested in the (.+) part, but on some lines,
> this part might be preceded and followed by <strong> (and </strong>)
> tags, which I'd like to remove.
>
> Any idea?
Please generate a short (<~20 lines) but complete (standalone) script
that illustrates your regex not doing what you expected. Be sure to
say what you expected.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 25 Nov 2002 19:08:32 +0100
From: Jane Doe <jane.doe@acme.com>
Subject: Re: A little help on a regex expression please
Message-Id: <bgp4uu4aivlg3jium4augkaer96o8gg2ki@4ax.com>
Thanks Brian for your help
On 25 Nov 2002 17:59:14 +0000, Brian McCauley <nobull@mail.com> wrote:
>You should be using an HTML parser then. Trying to parse HTML with
>simple regex is a lost cause except in very special cases.
Yes, I heard of packages more sophisticated than LWP::Simple, but
since I don't know much about this, and I'm almost there, I'll take a
look later if I can avoid it now.
>Please generate a short (<~20 lines) but complete (standalone) script
>that illustrates your regex not doing what you expected. Be sure to
>say what you expected.
Here's the output:
PARIS</strong>
123 rue Dupont
75001
PARIS
01.12.34.56.78
<A Href="mailto:jdoe@acme.com">jdoe@acme.com</A>
All I need now, is understand why the </strong> is still around
Thx
JD.
PS: An here's the script:
---------------------- BEGIN
use strict;
use LWP::Simple;
my $iCounter;
my $stuff;
my @lines;
for ($iCounter = 1; $iCounter <= 95; $iCounter++) {
#some pages start with a leading 0
if ($iCounter >=0 && $iCounter < 10) {
$stuff = get("http://www.acme.com/ad0". $iCounter .
".htm");
} else {
$stuff = get("http://www.acme.com/ad". $iCounter .
".htm");
}
@lines = split('\n',$stuff);
foreach (@lines) {
if(/size="4"/) {
s/^.*size="4">(<strong>)?(.+)(<\/strong>)?<\/font>/$2/i;
# get rid of empty lines
if ($2 !~ /^$/){
print $2. "\n";
}
}
}
}
----------------- END-----------------------
------------------------------
Date: 25 Nov 2002 18:24:30 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: A little help on a regex expression please
Message-Id: <u9d6otfqxt.fsf@wcl-l.bham.ac.uk>
Jane Doe <jane.doe@acme.com> writes:
> Thanks Brian for your help
> Here's the output:
>
> PARIS</strong>
Ah, yes. Perl regex are greedy by default and will take the first
solution they find.
Consider a much simpler case:
'yx' =~ /(.+)(x)?/
The /x/ bit never matches 'x' because /./ can also match 'x'.
The /(.+)/ will match 'yx' and the /(x)?/ will match ''.
You need to say:
/(.+?)(x)?/
Where /.+?/ is read as "at least one character, but as few as possible".
Sorry I didn't spot this the first time.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 25 Nov 2002 12:58:56 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: A little help on a regex expression please
Message-Id: <slrnau4sng.1v2.tadmc@magna.augustmail.com>
Jane Doe <jane.doe@acme.com> wrote:
> Thanks Brian for your help
You should follow the advice he gave.
> On 25 Nov 2002 17:59:14 +0000, Brian McCauley <nobull@mail.com> wrote:
>>You should be using an HTML parser then. Trying to parse HTML with
>>simple regex is a lost cause except in very special cases.
>
> Yes, I heard of packages more sophisticated than LWP::Simple,
You are confused. The modules Brian refers to has nothing to
do with LWP::Simple.
There are 2 parts to your problem, getting the HTML from the web,
then processing that HTML to extract what you want.
LWP::Simple will get the HTML from the web for you.
An HTML parser module will help with extracting the parts you want.
> but
> since I don't know much about this,
That is an argument _for_ using a module, not against using a module.
Some who *does* know much about this has sorted out all the details
and gotchas and wrapped them up in a module so that people that
don't know much about "it" can still get "it" done.
> and I'm almost there,
You may think you are, but you may not be.
Using a regex to "parse" arbitrary HTML is hopeless. You are
not almost there if that is the case. You have not given any
indication that your HTML is not arbitrary.
Must this work on only severely restricted HTML, like that
on a single site? If so, then you might kinda sorta be able
to get it done with a regex.
When you get it done, see what your regex does with
legal HTML data such as:
<!-- <font size="4"><strong>PARIS</strong></font> -->
It will likely report a PARIS match when it shouldn't.
Or:
<font size="4"><strong>PARIS
</strong></font>
It will like not match when it should.
A Real HTML Parser would not be fooled by either of those.
There are dozens of other gotchas like this, you just haven't
found them all yet.
It will take less time to figure out how to do it correctly
using a module than it will to rediscover and repair all
of the gotchas.
> I'll take a
> look later if I can avoid it now.
That is being penny wise and pound foolish (unless it must work
only with this one site, and you don't mind your program breaking
when they change the style of their web pages).
>>Please generate a short (<~20 lines) but complete (standalone) script
You have not given us a _standalone_ script.
We cannot run your program and see the results that you see.
We do not have a string to match against.
There are two pieces of information that are critical to
analysing a pattern match, the pattern (we have that), and
the string that the pattern is to be matched against (we
do not have that, nor can we get it).
>>that illustrates your regex not doing what you expected. Be sure to
>>say what you expected.
>
> Here's the output:
If we had a complete program and _input_ then we would not need
the output, we would be able to run the program to generate
the output.
> PARIS</strong>
> 123 rue Dupont
> 75001
> PARIS
> 01.12.34.56.78
><A Href="mailto:jdoe@acme.com">jdoe@acme.com</A>
>
> All I need now, is understand why the </strong> is still around
We cannot tell you why, because we do not have the string
that you are trying to match against.
> use strict;
> use LWP::Simple;
>
> my $iCounter;
> my $stuff;
> my @lines;
>
> for ($iCounter = 1; $iCounter <= 95; $iCounter++) {
That could be replaced with:
foreach my $iCounter ( 1 .. 95 ) {
> #some pages start with a leading 0
> if ($iCounter >=0 && $iCounter < 10) {
> $stuff = get("http://www.acme.com/ad0". $iCounter .
> ".htm");
> } else {
> $stuff = get("http://www.acme.com/ad". $iCounter .
> ".htm");
> }
That entire if() could be replaced with:
$stuff = get sprintf 'http://www.acme.com/ad%02d.htm', $iCounter;
http://www.acme.com/ad01.htm
nor
http://www.acme.com/ad10.htm
returns HTML that looks like the HTML that we can surmise that
you get. ie. We do not have the string to match against, and
we cannot even "go get it", so we can't help much.
> @lines = split('\n',$stuff);
A pattern match should *look like* a pattern match:
my @lines = split( /\n/, $stuff);
> foreach (@lines) {
No need for the @lines temporary variable at all
foreach ( split( /\n/, $stuff) ) {
> if(/size="4"/) {
>
> s/^.*size="4">(<strong>)?(.+)(<\/strong>)?<\/font>/$2/i;
^^
You might want a non-greedy match there instead.
You might want a s///s option.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 25 Nov 2002 18:22:18 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: a question on regular expression
Message-Id: <Xns92D1880612B84dkwwashere@216.168.3.30>
I wrote on 24 Nov 2002:
[snip most of program]
> my $seq = substr $dna, $offset, $repeat_length;
> my $rev = reverse $seq;
Benjamin Goldberg pointed out that the program should be searching for
inverted *complements*, so the second line (above) should be changed to
(my $rev = reverse $seq) =~ tr/atcg/tagc/;
--
David K. Wall - usenet@dwall.fastmail.fm
"Oook."
------------------------------
Date: 25 Nov 2002 06:55:00 -0800
From: fredrik.andersson@avionics.saab.se (Fredrik Andersson)
Subject: Change Perl version help
Message-Id: <9df19bab.0211250655.22c42a1d@posting.google.com>
We are using an internally built verifying tool to verify our program code.
This tool is made by employees no longer employed by the company.
Our code needs extremely thorough verification in order to be allowed to
be used and part of the verification program is written in Perl 5.004,
now my question is if anyone could please give me some advice what to
consider when changing version to Perl 5.8? Which syntax must be most
thoroughly checked etc. I have found the pages on the Internet
describing the difference between the versions, but since neither me nor
my colleagues are "Perl-experts" we find this information very difficult
to interpret. I would be very grateful for your help.
Best regards,
Fredrik Andersson
------------------------------
Date: Mon, 25 Nov 2002 15:14:54 GMT
From: Steven Smolinski <steven.smolinski@sympatico.ca>
Subject: Re: Change Perl version help
Message-Id: <O7rE9.60068$e%.379885@news20.bellglobal.com>
Fredrik Andersson <fredrik.andersson@avionics.saab.se> wrote:
> [...] Our code needs extremely thorough verification in order to
> be allowed to be used and part of the verification program is written
> in Perl 5.004, now my question is if anyone could please give me some
> advice what to consider when changing version to Perl 5.8? Which
> syntax must be most thoroughly checked etc.
The perldelta manpage has a succint but extended list of changes between
versions.
> [...] since neither me nor my colleagues are "Perl-experts" we find
> this information very difficult to interpret.
I find it hard to believe that a company with a process which requires
'extremely thorough verification' won't spring for some expertise. If
you require extreme thoroughness, usenet is not the proper place to get
it; there are lots of great programmers for hire who have excellent
knowledge of Perl.
Steve
------------------------------
Date: 25 Nov 2002 06:54:14 -0800
From: trent@autoimages.com (Trent Hare)
Subject: Re: Help with grep + hash value
Message-Id: <bc421eed.0211250654.3e72cff5@posting.google.com>
Bob Walton <bwalton@rochester.rr.com> wrote in message news:<3DE182B9.2040904@rochester.rr.com>...
> Trent Hare wrote:
>
> ...
>
>
> > I'm trying get the grep to be more "lenient" in it's tossing out
> > photos...
> > I have photos that are named "12345C.jpg" that belong to car "12345C",
> > (which has been temporarily appended ".jpg" for the array matching
> > purposes) and I also have photos named "12345_2.jpg" "12345_3.jpg"
> > etc., that I don't want placed into the @orphanpics.
> >
> > So, when the hash value = "12345C.jpg" how do I get it to allow
> > 12345C_2.jpg as well using this type of array matching?
> >
> > push @orphanpics, grep {not exists $h{$_}} @pictures;
> ...
>
>
> > Trent
> >
>
> I'm confused by your problem statement. You have an array @pictures
> with a bunch of strings in it. You have a hash %h with some keys stored
> in it (values irrelevent). You want to create another array @orphanpics
> containing those strings in @pictures which are not keys of %h. So the
> keys of %h are strings you do not want to appear in @orphanpics. Now
> you say you want to "allow" 12345C_2.jpg, for example, when 12345C.jpg
> appears in %h. Does that mean you want 12345C_2.jpg to also not appear
> in @orphanpics? If the above is a correct interpretation, one could so
> something like:
>
> Example program:
>
> use Data::Dumper;
> use strict;
> use warnings;
> my @pictures=('12345C.jpg','abcde.jpg','54321C.jpg',
> '12345C_2.jpg','12345_2.jpg','12345C_3.jpg',
> 'abced.jpg','abcdef.jpg');
> my %h=('12345C.jpg'=>0,'abcd.jpg'=>0);
> my @orphanpics;
> my @keys=keys %h;
> for(@keys){$_=quotemeta}
> my $regex='^(?:'.join('|',@keys).')';
> $regex=~s/\\\.jpg//g;
> for(@pictures){push @orphanpics,$_ unless /$regex/}
> print Dumper(\@orphanpics);
>
> Output:
>
> D:\junk>perl junk234.pl
> $VAR1 = [
> '54321C.jpg',
> '12345_2.jpg',
> 'abced.jpg'
> ];
>
> D:\junk>
>
> That would exclude any string starting with whatever is in any key of %h
> from appearing in @orphanpics (with the .jpg extension removed from the
> keys). Is that what you want?
Hi Bob,
Works like a charm sir - very much appreciated.
Now I'll have to read carefully and try to educate myself *why* it works :)
Thanks again,
Trent
------------------------------
Date: 25 Nov 2002 08:01:53 -0800
From: barry_king@hotmail.com (Barry King)
Subject: MIME unpacking
Message-Id: <838d54f3.0211250801.6ca3c7f@posting.google.com>
To rephrase an earlier question, is there an easy way to unpack a MIME
file that I have as a string, a file, or a filehandle?
I'm trying to unpack an MHTML file on upload, and I understand MHTML
to be MIME format.
Thanks!
Barry
------------------------------
Date: 25 Nov 2002 17:45:15 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: MIME unpacking
Message-Id: <u94ra5h7bo.fsf@wcl-l.bham.ac.uk>
barry_king@hotmail.com (Barry King) writes:
> To rephrase an earlier question...
...should be done without starting a new thread unless the old thread
has been inactive for a resonable time. I'm not sure what would be a
resonable time but at lest a few days.
> is there an easy way to unpack a MIME
> file that I have as a string, a file, or a filehandle?
Yes. As I told you already (in defunct newsgroup c.l.p) there are
modules to do that.
Looking them up is left as an exercise for the reader.
Hint - see FAQ: "What modules and extensions are available for Perl?..."
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 25 Nov 2002 18:50:05 +0100
From: "Seansan" <sheukels=cuthere=@yahoo.co.uk>
Subject: Re: My cgi can't write in a file
Message-Id: <3de262db$0$2234$e4fe514c@dreader6.news.xs4all.nl>
Echo the user permissions (uid) the script runs with, the error could be in
there. This often occurs when a scipt is run inside a wrapper.
print setuid; (or my $var=setuid;echo $var;)
I had some problems with that. My uid was 002. When I created files with a
0666 mask, they ended up not writeable for public (664). So I set the uid to
000 (setuid 000), saved the original value, created the file, and set uid to
its original value.
Maybe this is the error.
Grtz, Sean
"Alvaro Giratá" <agirata@escolombia.net> wrote in message
news:ef53bf3a.0211241744.4f116fe3@posting.google.com...
> I have a simple cgi script counter that reads the counter value and
> writes the new value in the same counter file. The script can read the
> file info but cannot write on it. The file's path is correct and the
> cgi's permissions are setup to 755.
>
> What could be wrong ?
>
> This is the script!
> ========================================
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
> $counterFile = '/home/sites/mydomainname/web/cgi-bin/counter.dat';
> open (input,"$counterFile") or die "die";
> $/ = undef;
> $counterValue = <input>;
> close (input);
> $counterValue++;
> open (output,">$counterFile") or die "die";
> print output $counterValue;
> close (output);
> exit;
> ========================================
------------------------------
Date: Mon, 25 Nov 2002 14:55:20 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <uu4eeojj6grmfe@corp.supernews.com>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 18 Nov 2002 15:51:35 GMT and ending at
25 Nov 2002 13:32:48 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 2002 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 72 (29.4% of all posters)
Articles: 126 (16.0% of all articles)
Volume generated: 212.4 kb (13.4% of total volume)
- headers: 103.7 kb (2,105 lines)
- bodies: 105.0 kb (3,772 lines)
- original: 64.8 kb (2,468 lines)
- signatures: 3.6 kb (95 lines)
Original Content Rating: 0.618
Averages
========
Posts per poster: 1.8
median: 1.0 post
mode: 1 post - 51 posters
s: 2.4 posts
Message size: 1726.1 bytes
- header: 842.6 bytes (16.7 lines)
- body: 853.2 bytes (29.9 lines)
- original: 526.9 bytes (19.6 lines)
- signature: 29.3 bytes (0.8 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
16 35.9 ( 15.8/ 17.5/ 10.6) Ian . H <ian@WINDOZEdigiserv.net>
6 10.8 ( 4.9/ 5.9/ 1.4) "Kurt Gong" <gongwm@163.net>
5 6.8 ( 4.3/ 2.5/ 0.9) Kirk McElhearn <kirk@mcelhearn.com>
5 12.1 ( 3.9/ 8.2/ 3.3) Dave E <fixerdave@hot-NoSpamPlease-mail.com>
5 8.7 ( 5.0/ 3.6/ 1.3) "News" <tjalbout@hotmail.com>
3 6.0 ( 2.4/ 3.6/ 2.0) "Seansan" <sheukels=cuthere=@yahoo.co.uk>
3 5.1 ( 2.3/ 2.8/ 0.5) default <default@nih.gov>
3 7.5 ( 2.4/ 5.1/ 2.6) "Steve Patterson" <sfsdf@sdf.com>
3 7.1 ( 2.7/ 4.4/ 2.8) n_joeller@sharaziilyar.com
3 3.5 ( 2.1/ 1.3/ 1.0) Micke <renjuman@hotmail.com>
These posters accounted for 6.6% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
35.9 ( 15.8/ 17.5/ 10.6) 16 Ian . H <ian@WINDOZEdigiserv.net>
12.1 ( 3.9/ 8.2/ 3.3) 5 Dave E <fixerdave@hot-NoSpamPlease-mail.com>
10.8 ( 4.9/ 5.9/ 1.4) 6 "Kurt Gong" <gongwm@163.net>
8.7 ( 5.0/ 3.6/ 1.3) 5 "News" <tjalbout@hotmail.com>
7.5 ( 2.4/ 5.1/ 2.6) 3 "Steve Patterson" <sfsdf@sdf.com>
7.1 ( 2.7/ 4.4/ 2.8) 3 n_joeller@sharaziilyar.com
6.8 ( 4.3/ 2.5/ 0.9) 5 Kirk McElhearn <kirk@mcelhearn.com>
6.0 ( 2.4/ 3.6/ 2.0) 3 "Seansan" <sheukels=cuthere=@yahoo.co.uk>
5.9 ( 3.1/ 2.9/ 0.9) 3 "NeTedix" <tedtdhoang@hotmail.com>
5.1 ( 2.3/ 2.8/ 0.5) 3 default <default@nih.gov>
These posters accounted for 6.7% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.753 ( 1.0 / 1.3) 3 Micke <renjuman@hotmail.com>
0.630 ( 2.8 / 4.4) 3 n_joeller@sharaziilyar.com
0.610 ( 10.6 / 17.5) 16 Ian . H <ian@WINDOZEdigiserv.net>
0.547 ( 2.0 / 3.6) 3 "Seansan" <sheukels=cuthere=@yahoo.co.uk>
0.508 ( 2.6 / 5.1) 3 "Steve Patterson" <sfsdf@sdf.com>
0.406 ( 3.3 / 8.2) 5 Dave E <fixerdave@hot-NoSpamPlease-mail.com>
0.369 ( 0.9 / 2.5) 5 Kirk McElhearn <kirk@mcelhearn.com>
0.346 ( 1.3 / 3.6) 5 "News" <tjalbout@hotmail.com>
0.303 ( 0.9 / 2.9) 3 "NeTedix" <tedtdhoang@hotmail.com>
0.239 ( 1.4 / 5.9) 6 "Kurt Gong" <gongwm@163.net>
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.630 ( 2.8 / 4.4) 3 n_joeller@sharaziilyar.com
0.610 ( 10.6 / 17.5) 16 Ian . H <ian@WINDOZEdigiserv.net>
0.547 ( 2.0 / 3.6) 3 "Seansan" <sheukels=cuthere=@yahoo.co.uk>
0.508 ( 2.6 / 5.1) 3 "Steve Patterson" <sfsdf@sdf.com>
0.406 ( 3.3 / 8.2) 5 Dave E <fixerdave@hot-NoSpamPlease-mail.com>
0.369 ( 0.9 / 2.5) 5 Kirk McElhearn <kirk@mcelhearn.com>
0.346 ( 1.3 / 3.6) 5 "News" <tjalbout@hotmail.com>
0.303 ( 0.9 / 2.9) 3 "NeTedix" <tedtdhoang@hotmail.com>
0.239 ( 1.4 / 5.9) 6 "Kurt Gong" <gongwm@163.net>
0.181 ( 0.5 / 2.8) 3 default <default@nih.gov>
11 posters (15%) had at least three posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
6 comp.lang.perl.modules
2 comp.lang.perl
1 comp.lang.python
1 comp.programming
1 comp.lang.perl.moderated
Top 10 Crossposters
===================
Articles Address
-------- -------
1 christophe@all4website.com
1 JimL. <jimr.long@worldnet.att.net>
1 Zach Jones <Zachary_E_Jones@raytheon.com>
1 C G Kolar <ckolarNOSPAM@imsa.edu>
1 Salve J. Nilsen <sjn+njus@pvv.org.invalid>
------------------------------
Date: 25 Nov 2002 08:27:21 -0800
From: bbcrock@hotmail.com (D)
Subject: Newbie needs help- trying to submit command-line function to perl script via web
Message-Id: <22e171df.0211250827.6d91a156@posting.google.com>
I want to write a VERY simple and quick Perl file that creates an HTML
form to send information to another Perl script that already exists.
I want to write an interface to a perl script that I call on the
command line.
The entire site will be rewritten for a CMS but for right now it's in
perl.
I am not sending in the information right and I want to save all the
information that the perl script I want to run would normally send to
the command line to a file.
here is what I wrote:
################
open ('deletessn.pl', ' ' . $ssn . ' delete');
$myresponse = ???
#right here I want to set a variable called myresponse that takes the
information that deletessn.pl sends back to the screen/command line
and then save it to the file below- will $STDOUT work?
open(OUT, ">>/opt/ns-server/www/hrsc/error.txt");
print OUT "$myresponse\n";
close(OUT);
################
THANKS for any help from a non-Perl programmer!!!!!!!
Don
------------------------------
Date: Mon, 25 Nov 2002 09:37:49 -0700
From: "Palladium Solutions" <palladium@spinn.net>
Subject: Re: Newbie needs help- trying to submit command-line function to perl script via web
Message-Id: <uu4ki59su99424@corp.supernews.com>
Is everyone as confused as I am?
Do you mean that you want to post a url form to the web from command line,
and then grab the response and save to a file?
If so try the LWP::Simple module from CPAN.
If not you need to clarify more for this blockhead.
Thanks,
Rodney
"D" <bbcrock@hotmail.com> wrote in message
news:22e171df.0211250827.6d91a156@posting.google.com...
> I want to write a VERY simple and quick Perl file that creates an HTML
> form to send information to another Perl script that already exists.
> I want to write an interface to a perl script that I call on the
> command line.
>
> The entire site will be rewritten for a CMS but for right now it's in
> perl.
>
> I am not sending in the information right and I want to save all the
> information that the perl script I want to run would normally send to
> the command line to a file.
>
> here is what I wrote:
> ################
> open ('deletessn.pl', ' ' . $ssn . ' delete');
>
> $myresponse = ???
> #right here I want to set a variable called myresponse that takes the
> information that deletessn.pl sends back to the screen/command line
> and then save it to the file below- will $STDOUT work?
>
>
> open(OUT, ">>/opt/ns-server/www/hrsc/error.txt");
> print OUT "$myresponse\n";
> close(OUT);
> ################
>
> THANKS for any help from a non-Perl programmer!!!!!!!
>
> Don
------------------------------
Date: Mon, 25 Nov 2002 11:46:41 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Newbie needs help- trying to submit command-line function to perl script via web
Message-Id: <slrnau4og1.1pd.tadmc@magna.augustmail.com>
D <bbcrock@hotmail.com> wrote:
> I want to write a VERY simple and quick Perl file that creates an HTML
> form to send information to another Perl script that already exists.
To send the info to a *CGI program* or to a Perl script?
They are not the same thing. They take input differently.
The answer will be different depending on which it is that
your really want.
Which one do you really want?
If you want to "fill out" forms and submit the info to a CGI
program (whether written in Perl or not), you can use this
module to make your Perl program "look like" a web browser
to the CGI program's web server:
use LWP::UserAgent;
http://search.cpan.org/author/GAAS/libwww-perl-5.65/lib/LWP/UserAgent.pm
If you want to run a Perl script, then use system() or backticks.
> The entire site
What site?
Your site or the site that you want to communicate with?
> will be rewritten for a CMS
What is a CMS?
> I am not sending in the information right and I want to save all the
> information that the perl script I want to run would normally send to
> the command line to a file.
Huh?
> here is what I wrote:
> ################
> open ('deletessn.pl', ' ' . $ssn . ' delete');
That does not run the deletessn.pl program.
Does deletessn.pl support GET or POST or both?
Is it written using the CGI.pm module?
Or is it written as a command line program that takes
command line arguments?
> $myresponse = ???
If deletessn.pl is a normal (non-CGI) program, then
you can run it and capture its outputs using backwards
single quotes (backticks):
my $output_from_deletessn = `deletessn.pl $ssn delete`;
or
my $output_from_deletessn = qx/deletessn.pl $ssn delete/;
If it is a CGI program that you don't want to run in a CGI
environment, then you must supply its input in an env var
(GET) or from STDIN (POST). This will be really easy to do
if deletessn.pl uses the CGI.pm module.
If it is a CGI program that you want to run in a CGI
environment, then use UserAgent.
> open(OUT, ">>/opt/ns-server/www/hrsc/error.txt");
You should always, yes *always*, check the return value from open():
open(OUT, ">>/opt/ns-server/www/hrsc/error.txt")
or die "could not open '/opt/ns-server/www/hrsc/error.txt' $!";
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 25 Nov 2002 10:19:47 -0800
From: mpelleti@nortelnetworks.com (Marc Pelletier)
Subject: Pattern matching, may contain - or .
Message-Id: <85967fca.0211251019.3c9bd883@posting.google.com>
Hi there,
I have a program that connects to a device and runs a few commands. I
set the prompt for it like so:
$prompt='\w+\(\w+\)#';
Reason being is that MOST of the time the prompts look like this:
DeviceName(SSU)#
Recently I've come across people naming (which I have no control over)
devices with '-' or '.' in the name. For example:
Device-Name(SSU)#
And of course the prompt above isn't a perfect match. Can anyone
recomment a way around something like this. Doesn't look I can do
anything like \S+
Thanks in advance!
/Marc
------------------------------
Date: 25 Nov 2002 18:31:14 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Pattern matching, may contain - or .
Message-Id: <u98yzhfqml.fsf@wcl-l.bham.ac.uk>
mpelleti@nortelnetworks.com (Marc Pelletier) writes:
> I have a program that connects to a device and runs a few commands. I
> set the prompt for it like so:
>
> $prompt='\w+\(\w+\)#';
>
> Reason being is that MOST of the time the prompts look like this:
>
> DeviceName(SSU)#
>
> Recently I've come across people naming (which I have no control over)
> devices with '-' or '.' in the name. For example:
>
> Device-Name(SSU)#
>
> And of course the prompt above isn't a perfect match. Can anyone
> recomment a way around something like this. Doesn't look I can do
> anything like \S+
You may constuct arbitrary chracter clases using [].
If you do not know what characters you want in your class then this
has nothing to do with Perl.
You may also be able to use something like:
$prompt = qr/\S+?\(\S+?\)#/;
Note: Unless there's a compelling reson not to you should always use
qr// rather than '' to quote regexes.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 25 Nov 2002 16:57:09 -0000
From: "Andrew Harton" <andrew_harton@agilent.com>
Subject: Re: Perl Books
Message-Id: <1038243439.651062@cswreg.cos.agilent.com>
PerlFAQ Server wrote:
>
> 2.11: Perl Books
>
>
At the risk of being called pedantic, 'Perl Books' isn't a question. Since
virtually everything else in the FAQ is expressed as a question, this
probably should be too - "Which books are recommended for learning Perl?",
for example.
Andrew
--
$s="acehJklnoPrstu ";$_="4dbce078c32ae92a6e30152a";
split//;for(0..$#_){print substr($s,hex $_[$_],1);}
------------------------------
Date: Mon, 25 Nov 2002 10:49:09 -0500
From: Will Cardwell <william.cardwell@ericsson.com>
Subject: Sending errors to named file as well as stderr
Message-Id: <3DE24675.A7B41889@ericsson.com>
I would like to know the easiest way to change a script so that all
errors that normally go to stderr also go to another file, say
"myerrfile".
Any ideas appreciated.
Thank you,
Will Cardwell
------------------------------
Date: Mon, 25 Nov 2002 16:40:46 GMT
From: "robertbu" <robertbu@hotmail.com>
Subject: Re: Sending errors to named file as well as stderr
Message-Id: <iosE9.28052$hi6.25298@nwrddc02.gnilink.net>
"Will Cardwell" <william.cardwell@ericsson.com> wrote in message
news:3DE24675.A7B41889@ericsson.com...
> I would like to know the easiest way to change a script so that all
> errors that normally go to stderr also go to another file, say
> "myerrfile".
>
IO::Tee from CPAN
== Rob ==
------------------------------
Date: Mon, 25 Nov 2002 08:53:05 -0800
From: Steven May <stevenm@blackwater-pacific.com>
Subject: Re: Sending errors to named file as well as stderr
Message-Id: <artk87$hpa$1@quark.scn.rain.com>
Will Cardwell wrote:
> I would like to know the easiest way to change a script so that all
> errors that normally go to stderr also go to another file, say
> "myerrfile".
>
> Any ideas appreciated.
>
> Thank you,
> Will Cardwell
>
Placed at start of script or program, will catch errors
that occur after it....
$SIG{'__DIE__'} = $SIG{'__WARN__'} = sub {
my $error = shift;
chomp $error;
&print_to_file( $error ); # does what you'd think
print $error;
exit 0;
};
hth,
s.
------------------------------
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 4173
***************************************