[21990] in Perl-Users-Digest
Perl-Users Digest, Issue: 4212 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 4 00:05:50 2002
Date: Tue, 3 Dec 2002 21:05:06 -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 Tue, 3 Dec 2002 Volume: 10 Number: 4212
Today's topics:
Re: [FTP] Downloading a file by matching part of its na <bobx@linuxmail.org>
[Help] Updating values of fields in a file <terachichi@yahoo.com>
Re: [Help] Updating values of fields in a file (Tad McClellan)
Re: A regex 'whoa' <wsegrave@mindspring.com>
Re: ANSWER - Closing excel spreadsheet. (Jay Tilton)
cmsg newgroup alt.racist.christina-eijkhout (Newsmeister)
Re: HELP! Looking for a cgi (Jorge Mesa)
Re: how to get it quoted? (Walter Roberson)
Re: how to: perl shell script to programaticaly submit (Jay Tilton)
HTML parse & then get text WITH tags from between tags <bla@bla.com>
Re: strange glob error (Scott Stark)
Re: strange glob error (Ben Morrow)
Re: sys/wait.ph problem <dturley@_NOSPAM_pobox.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 04 Dec 2002 00:49:38 GMT
From: "Bob X" <bobx@linuxmail.org>
Subject: Re: [FTP] Downloading a file by matching part of its name (code incl.)
Message-Id: <CicH9.5660$ov6.3066647@news2.news.adelphia.net>
"John W. Krahn" <krahnj@acm.org> wrote in message
news:3DECDCCE.D3D1E4CA@acm.org...
<snip>
>
> # pragmas
> use strict;
> use warnings;
>
> # modules
> use Net::FTP;
>
> # my declares
> my $hostname = 'ftp.symantec.com';
> my $navhome =
> '/public/english_us_canada/antivirus_definitions/norton_antivirus';
> my $username = 'anonymous';
> my $password = 'nobody@spammer.com';
> my $local_dir = 'c:\temp';
> my $net_dir = 'p:\public\navtemp';
>
> my ( $day, $month, $year ) = ( localtime( time - 86_400 ) )[3, 4, 5];
> # file name ex: 20021202-05-x86.exe
> my $fileglob = sprintf '%04d%02d%02d*x86.exe', $year + 1900, $month + 1,
> $day;
I do not see how this matches the file name example? The -05- is not a
constant and I have no way of knowing what Symantec means by it. So I need
to check for the first part of the file name (20021202) and the suffix
(EXE).
When I run a test (on just the $fileglob) I get: 20021202*x86
That will not match a file.
> # connect to the ftp site
> my $ftp = Net::FTP->new( $hostname ) or die "Cannot connect to
> $hostname: $@\n";
>
> $ftp->login( $username, $password ) or die "Cannot log in to
> $hostname\n";
> $ftp->cwd( $navhome ) or die "Cannot change to directory $navhome\n";
>
> my @files = $ftp->ls( $fileglob ) or die "Cannot list remote files\n";
> @files > 1 and warn "More than one file was found: @files\n";
I get the "Cannot list remote files" error but I think this is because the
earlier $fileglob was missing the mark some and so there isn't a list of
files to show.
Bob
------------------------------
Date: Tue, 03 Dec 2002 17:10:28 -0800
From: PL <terachichi@yahoo.com>
Subject: [Help] Updating values of fields in a file
Message-Id: <3DED5604.E7333BFA@yahoo.com>
Hi:
I want to update (or replace) values of fields in a file with new
information such as one
below in perl:
#---------------Data File-------------------
.....
FIELD_1 = something1 something2 something3 ....
FIELD_2 = something1 something2 something3.
FIELD_3 = something1
FIELD_4 = something1 something2 something3 ....
something4 something5 something6 ....
something something8 something9 ....
FIELD_5 = something1 something2
#-------------- End of data file ---------------------
How can I do this?
thanks
------------------------------
Date: Tue, 3 Dec 2002 20:29:53 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: [Help] Updating values of fields in a file
Message-Id: <slrnauqq51.1tt.tadmc@magna.augustmail.com>
PL <terachichi@yahoo.com> wrote:
Subject: [Help] Updating values of fields in a file
^^^^^^
^^^^^^
Those 6 characters contain no useful information, so why include them?
> I want to update (or replace) values of fields in a file with new
> information
Please see the answer to this FAQ:
"How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the
beginning of a file?"
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 3 Dec 2002 17:04:24 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: A regex 'whoa'
Message-Id: <asjdg4$tot$1@slb3.atl.mindspring.net>
"Bart Lateur" <bart.lateur@pandora.be> wrote in message
news:ttbquuoephbjevaeniq2g52k9lpk6i5pa8@4ax.com...
<snip>>
> Not quite... In my experience, people (i.e. me) tend to make their
> regexes too strict. In such a case, it'll fail where you don't intend it
> to fail.
<snip>
The magic words, "In my experience, ...", leave a lot of wiggle room.
The OP, IIRC, never told us the intended use of the regex. I can only
speculate that such as regex might be useful for screening out (rejecting)
data sets for a tab-sep database that have the wrong kind of separators,
i.e., white space other than tabs.
In my experience, I've seen records that were claimed to be tab-sep database
records, but which had been edited by the author, replacing one or more
required tabs with spaces. I lobbied valiantly to get the developer to
abandon tab-sep databases for his project, but to no avail.
Clearly, if the regex had \s*\t\s* replaced with \s+, as you suggested, the
regex would fail to reject records, i.e., not match, that are missing one or
more tabs. OTOH, your suggestion might be approapriate, in the scenario I've
posed, if the objective were to "repair" one or more missing tabs, as your
approach would make "$1\t$2\t$3\t$4\t$5\t$6\t$7" render a correct tab-sep
record.
As this is all speculative, let's move on to more productive endeavors.
Thanks for your comments, Bart.
Cheers.
Bill Segraves
------------------------------
Date: Tue, 03 Dec 2002 23:12:11 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: ANSWER - Closing excel spreadsheet.
Message-Id: <3ded2af3.11416107@news.erols.com>
"Richard S Beckett" <spikey-wan@bigfoot.com> wrote:
: I have finally solved my problem of closing a modified excel spreadsheet
: without getting prompted to save changes.
:
: $book -> Close (0);
: $excel -> Quit;
:
: will close the spreadsheet, no matter what, without giving a prompt, and
: then exit excel. The spreadsheet will be closed if the changes are not
: saved. Even if the spreadsheet is already closed, you will not get any kind
: of error,
But calling such a method for a disconnected workbook object _is_ an
error.
A number of other things you tried while stabbing at the problem were
errors as well.
Something is missing from this picture.
Are you, by chance, developing this program without benefit of Win32::OLE
reporting errors?
------------------------------
Date: Tue, 03 Dec 2002 23:49:31 GMT
From: nntpmeister@ncssfc.org (Newsmeister)
Subject: cmsg newgroup alt.racist.christina-eijkhout
Message-Id: <asjfub$210c_002@newsgroup.korea.com>
Keywords: racism, Islamic extremism
Christina Eijkhout removes alt.religion.christian.greek-orthodox and other
groups because she is a racist and Muslim extremist.
------------------------------
Date: 3 Dec 2002 16:02:04 -0800
From: jmesam@hotmail.com (Jorge Mesa)
Subject: Re: HELP! Looking for a cgi
Message-Id: <bf29a174.0212031602.6175e9cd@posting.google.com>
WOW!,
thank you for your answering,
I know my subject is not apropiated, my apologies.
Sincerely yours,
Jorge Mesa
------------------------------
Date: 4 Dec 2002 00:20:36 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: how to get it quoted?
Message-Id: <asjhok$lf7$1@canopus.cc.umanitoba.ca>
In article <3DED2BAA.31559954@hotmail.com>, user <du_bing@hotmail.com> wrote:
:Thanks for the response, Walter. I tried your suggestion (open(MAIL,"|mailx -s 'for test'
:'"c24b18d4bb4afdf052330678af9a601d+sent mail"\@neo.tamu.edu'")). Instead of 'User unknown', it
:returned the following errors:
:Bareword found where operator expected at ./z.pl line 5, near ""|mailx -s 'for t
Opps, you'll have to escape the internal double-quotes:
open(MAIL,"|mailx -s 'for test' '\"c24b18d4bb4afdf052330678af9a601d+sent mail\"\@neo.tamu.edu'")
--
millihamlet: the average coherency of prose created by a single monkey
typing randomly on a keyboard. Usenet postings may be rated in mHl.
-- Walter Roberson
------------------------------
Date: Wed, 04 Dec 2002 00:28:53 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: how to: perl shell script to programaticaly submit a html form?
Message-Id: <3ded49d7.19324674@news.erols.com>
"Décio Quintas" <decioquintas@sic.pt> wrote:
: I must code a script (and cron job it every 10 or 15 minutes) that
: programaticaly creates a form (like in "html" form :) and "submits" it to
: said location! There's no browser or apache intervention...
Read up on the LWP::UserAgent documentation.
: not quite sure
: if I'm explaing the problem the right way.... damn! must.... sleep...
: Is it possible?
Yes, sleep is possible.
: Please feel free to answer to decioquintasNOSPA_M@sic.pt if you find more
: convenient....just leave the "NOSPA_M" stuff out!
Would it not have been a better plan to mung your address in the article's
"From:" header line?
Too late now. The spammers have you.
------------------------------
Date: Tue, 3 Dec 2002 16:00:04 -0800
From: "John Smith" <bla@bla.com>
Subject: HTML parse & then get text WITH tags from between tags ?
Message-Id: <3ded44d1$0$2480$724ebb72@reader2.ash.ops.us.uu.net>
Do you know if there's a way using HTML Parser or TokeParser etc. to parse
an HTML document & then ask for all the text WITH tags between say <SUMMARY>
& </SUMMARY> ?
So I want to extract "<B>BOLD</B>" from between <SUMMARY></SUMMARY> below.
I can't seem to find an easy way to get all text back WITH tags.
- Sam.
<STORY>
<SUMMARY><B>BOLD</B></SUMMARY>
</STORY>
------------------------------
Date: 3 Dec 2002 15:07:37 -0800
From: sstark@us.ibm.com (Scott Stark)
Subject: Re: strange glob error
Message-Id: <ce94ec71.0212031507.2080556c@posting.google.com>
I hate to seem slow, but I don't know what "C<glob>" or "C<< <*.c>
>>." mean, and I'm not using an external program (that I know of). I
don't believe there's been any core dump either. So this perldoc
snippet makes no sense to me.
Scott
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnauaksf.45n.tadmc@magna.augustmail.com>...
> Have you looked up the error message yet?
>
> perldoc perldiag
> =item glob failed (%s)
>
> (W glob) Something went wrong with the external program(s) used for
> C<glob> and C<< <*.c> >>. Usually, this means that you supplied a
> C<glob> pattern that caused the external program to fail and exit with a
> nonzero status. If the message indicates that the abnormal exit
> resulted in a coredump, this may also mean that your csh (C shell) is
> broken. If so, you should change all of the csh-related variables in
> config.sh: If you have tcsh, make the variables refer to it as if it
> were csh (e.g. C<full_csh='/usr/bin/tcsh'>); otherwise, make them all
> empty (except that C<d_csh> should be C<'undef'>) so that Perl will
> think csh is missing. In either case, after editing config.sh, run
> C<./Configure -S> and rebuild Perl.
> -------------------------------------
------------------------------
Date: Tue, 3 Dec 2002 23:32:58 +0000 (UTC)
From: mauzo@mimosa.csv.warwick.ac.uk (Ben Morrow)
Subject: Re: strange glob error
Message-Id: <asjeva$9ae$1@wisteria.csv.warwick.ac.uk>
sstark@us.ibm.com (Scott Stark) wrote:
<perldoc perldiag and using csh for globbing>
>I hate to seem slow, but I don't know what "C<glob>" or "C<< <*.c>
>>>." mean, and I'm not using an external program (that I know of). I
>don't believe there's been any core dump either. So this perldoc
>snippet makes no sense to me.
A pattern such as '*.c 'which expands to 'all files ending in .c in the current
directory' is called a glob. Older versions of perl do globbing by invoking a
copy of csh(1) to do it for them: this can cause problems if (as is sometimes
the case) that copy of csh(1) is buggy. This can (only) be fixed by fixing your
csh(1), or by upgrading to a newer perl which uses File::Glob instead: this
means v5.6.0.
You may not think you are either invoking an external program or doing any
globbing, but one of your modules is, for some reason. The quickfix is to
install File::Glob (if it isn't) and then put
use File::Glob ':globally';
at the top of your program, before any other modules. This will override
&CORE::glob to not invoke csh(1).
HTH
Ben
------------------------------
Date: Tue, 03 Dec 2002 20:57:20 -0500
From: David Turley <dturley@_NOSPAM_pobox.com>
Subject: Re: sys/wait.ph problem
Message-Id: <pan.2002.12.04.01.57.15.414264.30423@_NOSPAM_pobox.com>
On Tue, 03 Dec 2002 08:42:17 -0500, Ben Morrow wrote:
> dturley@pobox.com (David Turley) wrote:
>>I'm trying to run a script that requires sys/wait.ph:
>
> I would strongly suggest
> use POSIX qw/:sys_wait_h/;
Thanks Ben! That did the trick. That old Perl 4 on BSD program now runs
under Perl 5 on Linux. I see lot's of other 4-isms in need of updating,
but the project's moving. (And they said it would run on Linux! :-)
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
------------------------------
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 4212
***************************************