[12306] in Perl-Users-Digest
Perl-Users Digest, Issue: 5906 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 6 19:07:14 1999
Date: Sun, 6 Jun 99 16:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 6 Jun 1999 Volume: 8 Number: 5906
Today's topics:
Re: A Perl RegEx Question (Abigail)
Afraid to ask about Y2K! (Steve Bean)
Re: Afraid to ask about Y2K! (Eric Bohlman)
Can V 4 and V.5 run concurrently? (Steve Bean)
Re: CGI.pm & submit butt...ons <unclelui@grin.net>
Re: CGI.pm & submit butt...ons (Ronald J Kimball)
Help - Convert ASP syntax to PERL (Gord MacSwain)
Help needed and much appreciated (Stuart Wright)
Re: Help needed and much appreciated (Michel Dalle)
Re: How do I ensure that the regexp DOESN'T conatin a s (Abigail)
Re: How to diff two time vars (David Efflandt)
Re: How to generate iterations of an array? (Tad McClellan)
joining multidimensional arrays <james@britlinks.co.uk>
Re: joining multidimensional arrays (Eric Bohlman)
Re: multithread perl program... <sugalskd@netserve.ous.edu>
PC carriage returns ( ^M ) in form fields. (zgott)
Re: Perl Editor... <bravo@bravodesign.com>
Re: PERL T SHIRT FOR SALE <gellyfish@gellyfish.com>
Re: PERL T SHIRT FOR SALE (brian d foy)
Probably a dumb question on "use strict;" <steadmrd@cafes.net>
Re: Probably a dumb question on "use strict;" (Eric Bohlman)
Re: Probably a dumb question on "use strict;" <aperrin@mcmahon.qal.berkeley.edu>
Re: Problem with REX (again) <gellyfish@gellyfish.com>
Proposal for Kill.pm module (Hasanuddin Tamir)
Re: REQ:>> How do the components know how to communicat <asackett@artsackett.com>
Searching a huge file <debot@xs4all.nl>
Re: Searching a huge file (Michel Dalle)
Sending LOTS of Messages by Script <rfreeman@resmatic.com>
Re: Struggling with FORMAMAIL.PL (David Efflandt)
Re: Struggling with FORMAMAIL.PL <gellyfish@gellyfish.com>
Re: Struggling with FORMAMAIL.PL (brian d foy)
Re: Total Newbie Question <unclelui@grin.net>
Re: Wanted-Web Builder Seeking Fame & Fortune <aperrin@mcmahon.qal.berkeley.edu>
Win32::EventLog & strings yellowstone@my-deja.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Jun 1999 13:34:21 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: A Perl RegEx Question
Message-Id: <slrn7llg6h.rki.abigail@alexandra.delanet.com>
Dmitry P. (dpodbori@email.msn.com) wrote on MMCV September MCMXCIII in
<URL:news:#ssb559r#GA.297@cpmsnbbsa02>:
^^ $_ = 'abbbbbc';
^^
^^ my ( $b1 ) =~ /^a(b)+c$/; # RegEx 1
^^ my ( $b2 ) =~ /^a(b+)c$/; # RegEx 2
^^ my ( $b3 ) =~ /^a(b*)c$/; # Regex 3
^^ my ( $b4 ) =~ /^a(b)*c$/; # Regex 4
^^
^^ What is the difference between these regexes and which one is better
^^ written?
Did you try reading the manual and answering the question yourself?
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 6 Jun 1999 21:40:51 GMT
From: sbean@iex.net (Steve Bean)
Subject: Afraid to ask about Y2K!
Message-Id: <7jept3$69h$2@news.iex.net>
But i WILL anyway. I can't believe someof the flameout answers to good
questions about Y2K in this section.
ARE THERE PROBLEMS WITH Y2K AND PERL?
Thanks in advance
sbean@iex.net
------------------------------
Date: Sun, 6 Jun 1999 22:41:16 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <ebohlmanFCxGCs.ABz@netcom.com>
Steve Bean (sbean@iex.net) wrote:
: But i WILL anyway. I can't believe someof the flameout answers to good
: questions about Y2K in this section.
: ARE THERE PROBLEMS WITH Y2K AND PERL?
Have you read the section in perlfaq4 entitled "Does Perl have a year
2000 problem? Is Perl Y2K compliant?"?
If so, what part of it was unclear? If not, please do so.
------------------------------
Date: 6 Jun 1999 21:35:44 GMT
From: sbean@iex.net (Steve Bean)
Subject: Can V 4 and V.5 run concurrently?
Message-Id: <7jepjg$69h$1@news.iex.net>
Using solaris 2.5 and 2.6 and version 4 and 5.003 of perl. Does anyone
know of any problems with running the two versions concurrently. Like,
are there solaris files that collide or calls that collide? Or any other
problems that come to mind. No practice machine.
Thanks in advance
sbean@iex.net
------------------------------
Date: Sun, 06 Jun 1999 13:03:42 -0700
From: "Luis F. Salas" <unclelui@grin.net>
Subject: Re: CGI.pm & submit butt...ons
Message-Id: <375AD41E.7380@grin.net>
> Does this look like syntactically correct Perl code to you?
>
> This code won't even compile.
Of course not! My intention was to show the logic, not the coding.
Think of it as pseudocode.
L.
------------------------------
Date: Sun, 6 Jun 1999 18:26:30 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: CGI.pm & submit butt...ons
Message-Id: <1dszov8.1mvdhwm4yx9k8N@p50.tc8.metro.ma.tiac.com>
Luis F. Salas <unclelui@grin.net> wrote:
> > Does this look like syntactically correct Perl code to you?
> >
> > This code won't even compile.
>
> Of course not! My intention was to show the logic, not the coding.
> Think of it as pseudocode.
Oh, sorry. Think of this as a pseudoanswer, then.
You have an error on line 17.
Okay, I'm feeling generous, so here's a better answer:
> sub reflectdata { ## second page
> ...
> submit(-name=>'abutton',-value=>'send');
> submit(-name=>'abutton',-value=>'change');
>
> moveon();
> }
>
> sub moveon { ## does not happen, get error message instead
> if $submit eq "send"
> sendentry();
> else if $submit eq "change"
> createform();
> }
You're calling moveon() from the function which outputs the submit
buttons in question. Neither button will have been pressed when
moveon() is called, because the buttons were just output in the same
invocation.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sun, 06 Jun 1999 20:44:37 GMT
From: macswain@ilap.comSPAM NO (Gord MacSwain)
Subject: Help - Convert ASP syntax to PERL
Message-Id: <375adadb.8186774@news.ilap.com>
I would sure like to find a PERL substitue for the following ASP code:
<%@ LANGUAGE="VBscript" %>
<% IF Request.FORM("pass") = "password" THEN
Response.Redirect "yes.html"
ELSE
Response.Redirect "no.html"
end IF %>
Entering a password 'posts' from HTML to the above file. If the
'password' is correct it sends you to one html page else it sends you
to another. My ISP is running Unix and I would like to find something
(PERL) that will do the job. Thanks.
<Gord> (Remove no-spam trailer if
replying via email)
------------------------------
Date: Mon, 07 Jun 1999 04:52:13 GMT
From: stuw@dial.pipex.com.remove.everything.after.the.com (Stuart Wright)
Subject: Help needed and much appreciated
Message-Id: <375b4df9.50085786@news.dial.pipex.com>
foreach $rp (sort {$a->{$sort_on} cmp $b->{$sort_on}} values %record){
similar to that found here
http://webreview.com/wr/pub/98/10/23/perl/index.html
for some reason causes a 500 error as does
$new_rec = $rp->{key};
I think it's the '->' bit.
When I comment these lines out, the script works. Perl locally
doesn't complain about these lines.
Can anyone suggest why it might not be working and an alternative so I
can get this script working (and then go back to not having anything
to do with CGI and Perl)?
Thanks
-----
Stuart Wright stu-w@usa.net.remove.everything.after.net
Software developer,
web author for the Hi-Fi and Home Cinema industries,
drummer and fast biker.
Visit my web site http://ds.dial.pipex.com/town/road/xmk67/
------------------------------
Date: Sun, 06 Jun 1999 22:51:32 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Help needed and much appreciated
Message-Id: <7jetvv$41a$1@xenon.inbe.net>
In article <375b4df9.50085786@news.dial.pipex.com>, stuw@dial.pipex.com.remove.everything.after.the.com wrote:
>foreach $rp (sort {$a->{$sort_on} cmp $b->{$sort_on}} values %record){
>
>similar to that found here
>http://webreview.com/wr/pub/98/10/23/perl/index.html
>for some reason causes a 500 error as does
>$new_rec = $rp->{key};
>
>I think it's the '->' bit.
What's in %record ? The same thing as in the example you mention ?
Seems a bit 'heavy' if you don't know much about Perl (or even if you do,
for that matter). This looks like a candidate for the (in)famous Schwartzian
Transform. Here is what Tad McClellan posted somewhere in april
(somewhat adapted for this problem) :
#!/usr/local/bin/perl -w
use strict;
my $sort = 1;
my @unsorted = <DATA>;
chomp @unsorted;
$sort++; # key is the first field here
my @sorted = # Schwartzian transform
map { $_->[0] }
sort {
$a->[$sort] cmp $b->[$sort]
}
map {
[ $_, split(/\|/) ]
} @unsorted;
foreach (@sorted) {
print "$_\n";
}
__DATA__
key1|field1-3|field2-1|field3-1
key2|field1-2|field2-2|field3-3
key3|field1-1|field2-3|field3-2
I'm not really up to this stuff, so I would have built an intermediate hash
with the keys and sorting field... (but certainly not that $record stuff).
Anyway, replace your sortdb routine with the my @sorted stuff, rename
@unsorted to @results and it should work...
>When I comment these lines out, the script works. Perl locally
>doesn't complain about these lines.
But does the script give you the right answer in command line ?
>Can anyone suggest why it might not be working and an alternative so I
>can get this script working (and then go back to not having anything
>to do with CGI and Perl)?
All of the above is probably worthless anyway, since a 500 error probably
means you can't even access the database file or something like that, and
may not be due to a script error at all. But don't loose faith :-)
Michel.
------------------------------
Date: 6 Jun 1999 14:20:07 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How do I ensure that the regexp DOESN'T conatin a string?
Message-Id: <slrn7llisb.rki.abigail@alexandra.delanet.com>
CY (k1001@netzero.net) wrote on MMCV September MCMXCIII in
<URL:news:3759F5A6.23D04FA4@netzero.net>:
&& What to do if you want to match
&&
&& /$stringA.*?(no $stringB).*?$staringC/
&&
&& in one line of regexp? (In English, that's a string with stringA,
&& stringC in the beginning and the end without $stringB inbetween.
/$stringA(?:(?!$stringB).)*$stringC/
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 06 Jun 1999 14:57:58 -0400
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to diff two time vars
Message-Id: <slrn7llhc6.44m.efflandt@efflandt.xnet.com>
On Sun, 6 Jun 1999 16:43:58 +0800, Allen zhao <Allenz@qd.lucent.com> wrote:
>Hi,u
>
>There is a problem. I don't know how to diff two time variables.For
>example:
>
>$tm1="May 5 12:0:0";
>$tm2="May 6 13:1:1";
>
>How can I get the difference between the two time points? I want to get a
>result such as "1 day 1 hour 1 min 1 sec".
>
>Thank you for your help in advance.
>
>Allen
Depending upon your original data, you may want to use or store the raw
'time' code, which makes calculations easier, and just convert it for
display.
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: Sun, 6 Jun 1999 09:54:42 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to generate iterations of an array?
Message-Id: <2judj7.j0m.ln@magna.metronet.com>
Dmitry P. (dpodbori@email.msn.com) wrote:
: I want to do something similar to
[snip]
: This should print something similar to
: A C B
: B A C
: B C A
: C A B
: C B A
: Any suggestions?
Perl FAQ, part 4:
"How do I permute N elements of a list?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 6 Jun 1999 23:03:54 +0100
From: James Stewart <james@britlinks.co.uk>
Subject: joining multidimensional arrays
Message-Id: <ant062254927Lh==@ch0128.charis.co.uk>
Hi,
I have information in a multidimensional array and want to join it
together to output to a file. I want all the data in $array[0] to be
separated by colons and then each group of those to be separated by
a newline.
I've tried:
$length = @final;
for ($loop=0; $loop<=$length-1; $loop++) {
$output[$loop] = join (":", $final[$loop]);
}
$going = join("\n",@output);
but this doesn't seem to do what I want.
James.
--
James Stewart - james@britlinks.co.uk | "Telecom ignored us and
The Britlinks - http://www.britlinks.co.uk | democracy has died."
Phantom Tollbooth - http://www.tollbooth.org | -- Fat And Frantic
Sixpence None The Richer in the UK - http://www.britlinks.co.uk/sixpence/
------------------------------
Date: Sun, 6 Jun 1999 22:34:16 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: joining multidimensional arrays
Message-Id: <ebohlmanFCxG14.9vC@netcom.com>
James Stewart (james@britlinks.co.uk) wrote:
: I have information in a multidimensional array and want to join it
: together to output to a file. I want all the data in $array[0] to be
: separated by colons and then each group of those to be separated by
: a newline.
: I've tried:
: $length = @final;
: for ($loop=0; $loop<=$length-1; $loop++) {
: $output[$loop] = join (":", $final[$loop]);
: }
: $going = join("\n",@output);
: but this doesn't seem to do what I want.
Not surprising, since it contains no references (in the vernacular, not
technical, sense) to any multi-dimensional array. Is it possible that
@final is a list of lists? If so, "$final[$loop]" needs to be replaced
with "@{$final[$loop]}" since join requires an actual list, not an array
reference.
------------------------------
Date: 6 Jun 1999 19:47:47 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: multithread perl program...
Message-Id: <7jej93$1ph$1@news.NERO.NET>
GEMINI <dennis@info4.csie.nctu.edu.tw> wrote:
: The problem is:
: The Thread module maintains a list of thread
: that currently running or exit but not join.
: Since I could never use join, I found the list
: will growing larger and larger. I'm afraid that
: it will eat all the memory eventually.
If you don't care about the return value of the thread (or have an
alternate method of snagging the return value), then use the detach
method. Something like:
$thread = new Thread(\&foo, @args);
$thread->detach;
The detach method marks the thread for destruction as soon as it
completes. This isn't the default since you normally want the return
value.
Dan
------------------------------
Date: Sun, 06 Jun 1999 20:16:03 GMT
From: zgott@hotmail.com (zgott)
Subject: PC carriage returns ( ^M ) in form fields.
Message-Id: <MPG.11c477b535dc548b989680@news.dt1.sdca.home.com>
I've got a script running on a linux machine that takes intput from a
form textarea and writes it to an html file. problem is the damn pc
carraige returns are printed out as ^M I want to replace them with \n<BR>
before writting to the file. for some reason s/\^M/\\n<BR>/; doesn't
work. Anyone have any ideas.
------------------------------
Date: Sun, 06 Jun 1999 16:30:18 -0500
From: Darrick Wolfe <bravo@bravodesign.com>
Subject: Re: Perl Editor...
Message-Id: <375AE86A.E8E93CB6@bravodesign.com>
http://www.petes-place.com/ and try CodeMagic. It still needs some work, but
it's a pretty good IDE. and it is totally free.
Also www.incatec.com CodeWiz has Perl support
David Cassell wrote:
> Darren Bennett wrote:
> >
> > Can anyone suggest a decent NT/95 based Perl editor/debugger?? Also,
>
> Go to www.perl.com and look at the page on editors. There's a good list
> there. And Perl has its own debugger. So, for all practical purposes,
> you could write your code in WordPad and debug in the command prompt.
> Many people do. Perl doesn't have the dreaded code-compile-link-run-
> curse-debug cycle of C/C++ .
>
> > does anyone have any NT Server admin scripts or links to such?? Please
> > e-mail me them if you do.
>
> There are a ton of such scripts all over the net. And there are lots
> of such scripts in O'Reilly books, like the octopus book (NT Admin.).
>
> In general, it is considered bad Netiquette to ask for spoon-feeding.
> And people expect that if you ask here, you should be willing to get
> the answers here.
>
> HTH,
> David
> --
> David Cassell, OAO cassell@mail.cor.epa.gov
> Senior Computing Specialist phone: (541) 754-4468
> mathematical statistician fax: (541) 754-4716
------------------------------
Date: 6 Jun 1999 09:45:37 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: PERL T SHIRT FOR SALE
Message-Id: <7jdg01$5j2$1@gellyfish.btinternet.com>
On Sun, 6 Jun 1999 02:32:35 -0500 Jamie Brown wrote:
> Subject: PERL T SHIRT FOR SALE
> X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
>
> <img src=http://www.spamm.net/images/geek_banner_sm.gif border=0 width=460
> height=60 alt="check out GeekWare for all your GEEK needs!">
It might have escaped comment if you had attempted to use a Newsreader that
actually works properly - leaving the presence of the HTML aside for now
(although an absolute no-no) - why has it presented non-plain test
content without the required Content-type header which would at least
give a chance to those newsreaders that reluctantly appease this stuff ?
And no this shouldnt be taken as an invitation to post again in plain text.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 06 Jun 1999 18:03:47 -0400
From: brian@pm.org (brian d foy)
Subject: Re: PERL T SHIRT FOR SALE
Message-Id: <brian-ya02408000R0606991803470001@news.panix.com>
In article <7jd7go$lmb$1@news.inc.net>, "Jamie Brown" <brownjj@iserve.net> posted:
> You won't break a sweat on your next project with our PERL shirt!
shouldn't that be "Perl"? ;)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Sun, 6 Jun 1999 17:02:22 -0500
From: "Josh Steadmon" <steadmrd@cafes.net>
Subject: Probably a dumb question on "use strict;"
Message-Id: <375aeff5.0@news.isdn.net>
I just added "use strict;" to several of my modules to make sure that I had
done everything just right. The first module worked fine. The second
module, which "uses" the first module, got a whole bunch of errors saying
that "so-and-so variable requires explicit package name" or something
similar. I understood that to mean that every variable requires:
PackageName::variablename
instead of:
variablename.
Please, someone tell me that I'm wrong, because the module is probably over
1,000 lines, and I don't care to work my way over each and every one of
those.
Also, is there a built-in Perl function to convert a character into its
ASCII value? (That would cut out the bulk of my progam.)
------------------------------
Date: Sun, 6 Jun 1999 22:30:20 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Probably a dumb question on "use strict;"
Message-Id: <ebohlmanFCxFuK.9rB@netcom.com>
Josh Steadmon (steadmrd@cafes.net) wrote:
: I just added "use strict;" to several of my modules to make sure that I had
: done everything just right. The first module worked fine. The second
: module, which "uses" the first module, got a whole bunch of errors saying
: that "so-and-so variable requires explicit package name" or something
: similar. I understood that to mean that every variable requires:
: PackageName::variablename
: instead of:
: variablename.
That's the case for undeclared variables. Declared global variables
(declared with "use vars ...") and declared lexical variables (declared
with my) don't need explicit package names.
: Please, someone tell me that I'm wrong, because the module is probably over
: 1,000 lines, and I don't care to work my way over each and every one of
: those.
The solution is to declare all your variables at the beginning of the module.
: Also, is there a built-in Perl function to convert a character into its
: ASCII value? (That would cut out the bulk of my progam.)
perldoc -f ord
------------------------------
Date: Sun, 06 Jun 1999 15:23:27 -0700
From: Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: Probably a dumb question on "use strict;"
Message-Id: <375AF4DF.38ECE36F@mcmahon.qal.berkeley.edu>
Josh Steadmon wrote:
> I just added "use strict;" to several of my modules to make sure that I had
> done everything just right. The first module worked fine. The second
> module, which "uses" the first module, got a whole bunch of errors saying
> that "so-and-so variable requires explicit package name" or something
> similar. I understood that to mean that every variable requires:
>
> PackageName::variablename
>
> instead of:
>
> variablename.
>
> Please, someone tell me that I'm wrong, because the module is probably over
> 1,000 lines, and I don't care to work my way over each and every one of
> those.
Nope, you're right:
perldoc perldiag:
Global symbol "%s" requires explicit package name
(F) You've said "use strict vars", which indicates that all variables
must either be lexically scoped (using "my"), or explicitly qualified to
say which package the global variable is in (using "::").
>
>
> Also, is there a built-in Perl function to convert a character into its
> ASCII value? (That would cut out the bulk of my progam.)
perldoc -f ord:
ord EXPR
ord Returns the numeric ascii value of the first character of
EXPR. If EXPR is omitted, uses `$_'. For the reverse,
see the chr entry elsewhere in this document .
--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting - (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: 6 Jun 1999 09:33:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Problem with REX (again)
Message-Id: <7jdf8e$5iu$1@gellyfish.btinternet.com>
On Sun, 06 Jun 1999 07:02:33 GMT Ryan Ngi wrote:
> i found this in webreview
>
> <\s*a\b[^>]+\bhref\s*=\s*(?:["\']?)([^>\s"\']+)
>
> he said
>
> [^>]+ <---- means at least one character that is not a ">"
>
> why it's not mean "the first charector must be >"...
>
> when will the "^" means the beginning of sentence?
> when will the "^" means 'not' a charector?
>
Time to read perlre again (for you that is not me :).
* At the beginning of an expression ^ anchors the pattern
to the beginning of the string
* At the beginning of a character class ^ negates that character
class (i.e. 'not in')
But please do read the perlre manpage.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 7 Jun 1999 09:53:42 GMT
From: hasant@trabas.co.id (Hasanuddin Tamir)
Subject: Proposal for Kill.pm module
Message-Id: <slrn7llk47.qrh.hasant@borg.intern.trabas.co.id>
Hi,
I was playing a bit with `kill' (both system command and
Perl function) and ended up with idea to write a little
module to perform the operation.
I surfed CPAN recently and didn't find any package solely
for this purpose (probably because nobody needs it?). But
I hope I didn't overlook something so I don't put myself
on reinventing the wheel.
So, Kill.pm -- the name I plan to use -- idea is using a
signal name (or number) as function call to send the signal
to some process(es). So the built-in kill() function that does:
kill 2, $PID or die $!;
kill TERM => $$ or die $!; # suicide?
kill -9, @childs;
can be replaced with:
hup($PID) or die $!;
TERM($$) or die $!;
_kill(@childs);
Or even:
_0($$) and print "See? I'm alive!\n";
>From examples above, we can see that case doesn't matter
as long as it's a valid signal name. If signal name is
unrecognized, Perl itself will complain (if you ask),
not Kill.pm. And the underscore preceeds the signal name
(or number) indicate to send negative signal. It will also
check (if users want it) if PID(s) contain a valid number,
i.e.: 888, -1255, etc, since kill() is considered a
``dangerous'' operation under -T switch. (Well, when `kill'
is not dangerous?).
But of course we can't use number only for function name
(execpt preceed with underscore). But I do emphasize the
use of signal name instead of number, since name is easier
to remember than number (at least, that was what people who
designed DNS said).
This all is implemented using AUTOLOAD. And here is the snip
code of the AUTOLOAD routine (oh, I forget, nothing is
exported by default).
AUTOLOAD {
my $signal = $AUTOLOAD;
$signal =~ s/.*:://;
$signal =~ tr/a-z_/A-Z-/;
*$AUTOLOAD = sub {
require Carp;
Carp::croak("usage: SIGNAME( PID )") unless @_;
if ($CheckPID) { ## $CheckPID is defined earlier
foreach (@_) {
Carp::croak("Bad PID: $_") unless /^-?\d+$/;
}
}
kill $signal, @_;
};
goto &$AUTOLOAD;
}
The rest of the module is the small import() routine (no,
no Exporter), toggle function for checking the PID, and
all necessary statements such as `package' and `$VERSION'.
I plan to propose this to modules@perl.org in the next couple
of days.
Well, any idea/input/suggestion everyone?
P.S.
My apology for making this too long.
I hope I don't offend anybody.
-hasan-
uhm, no more sig(h)
------------------------------
Date: Sun, 06 Jun 1999 19:49:02 GMT
From: Art Sackett <asackett@artsackett.com>
Subject: Re: REQ:>> How do the components know how to communicate... (-ej-)
Message-Id: <OgA63.31$E3.171005440@news.frii.net>
On Sun, 6 Jun 99 16:13:40 GMT in alt.html Euro Jake
<jde222RemovethiS@iname.com> honored us all with these words:
<snip>
EJ: All seems to work quite well as standalone applications tho
EJ: I dont seem to get how to install the links between everything
EJ: - how does html in web knows where to look for scripts
It's all in what you tell it to look for:
<a href="http://myhost.mydomain.com/cgi-bin/my_script.cgi">
EJ: - how does perl know to send back output to browser instead of dos window
Perl doesn't need to know or care -- it's the server's job to handle
that. Unless you explicitly cause it to be otherwise, all of your
output will go via the server to the client who requested it.
EJ: Looked around alot, but my prob seems so terrifying simple that
EJ: no reading or documentation is readily available...
EJ: What am i missing...?
A couple of good books, perhaps?
Hope this helps!
---- Art Sackett ----
Independent Web Developer
http://www.artsackett.com
------------------------------
Date: Sun, 06 Jun 1999 22:22:14 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Searching a huge file
Message-Id: <375AD875.9A10EF21@xs4all.nl>
How can I search as quick as possible a file that's about 30 MB's? I've
already tried it, but that gave an error (not realy an error, but it
didn't print the last line in the script. This is my script:
#!/usr/bin/perl
print "content-type: text/html\n\nFF Kijken...";
open (FILE, "/home/debot/access-log") || print "FOUT!!!";
@file = <FILE>;
close (FILE);
foreach $line(@file) {
if ($line =~ /track13/) {
print "<br><pre>$line</pre><br>";
}
}
print "<br><br>Ready!";
------------------------------
Date: Sun, 06 Jun 1999 20:43:39 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Searching a huge file
Message-Id: <7jemg8$r6q$1@xenon.inbe.net>
In article <375AD875.9A10EF21@xs4all.nl>, Frank de Bot <debot@xs4all.nl> wrote:
>How can I search as quick as possible a file that's about 30 MB's? I've
>already tried it, but that gave an error (not realy an error, but it
>didn't print the last line in the script. This is my script:
>
>#!/usr/bin/perl
>
>print "content-type: text/html\n\nFF Kijken...";
>
>open (FILE, "/home/debot/access-log") || print "FOUT!!!";
>@file = <FILE>;
>close (FILE);
>
>foreach $line(@file) {
> if ($line =~ /track13/) {
> print "<br><pre>$line</pre><br>";
> }
>}
>print "<br><br>Ready!";
Well, first of all, this doesn't generate valid HTML code. Use the CGI.pm
module if you're unsure of how to do it, and otherwise look around for
the HTML specification.
Secondly, since you don't flush your output, your webserver may chop off
the last line (but I haven't seen this yet). Using $|=1 and newlines may
help. Or CGI.pm again.
Thirdly, if you have only one line that should match 'track13', you might get
out of the foreach loop by using 'last'. Otherwise, make sure your logfile
doesn't contain track13 anywhere else, like in the referer field or something,
or use a more detailed regular expression.
Lastly, you may not want to slurp the whole file into a variable, because this
will put the whole 30 MB into memory, and you don't need that. Just use a
while (<FILE>) loop instead.
Have fun,
Michel.
--
aWebVisit - extracts visitor information from WWW logfiles and shows
the top entry, transit, exit and 'hit&run' pages, the links followed
inside your website, the time spent per page, the visit duration etc.
For more details, see http://gallery.uunet.be/Michel.Dalle/awv.html
------------------------------
Date: Sun, 06 Jun 1999 20:25:33 GMT
From: Rick Freeman <rfreeman@resmatic.com>
Subject: Sending LOTS of Messages by Script
Message-Id: <375ad733.209281@nntp1.ba.best.com>
I'm in the process of modifying a home-rolled mailing list manager
(written in Perl) which currently sends sendmail one message with all
the recipients in the bcc field. The new version will send a separate
message for each recipient to sllow for various kinds of
personalization, like a one-click unsubscribe link.
Right now I just open a pipe to sendmail and feed it the message. It
would be very easy for me to do the same thing in a loop for each
recipient in the new version, but I'm wondering if there is anything I
should do differently as there will be so many messages sent all
together (500 to 2000 messages in the current lists, though it should
be able to grow to at least 5000 addresses.).
It just seems like it might be wrong to open 2000 pipes to sendmail
and send 2000 messages all at once??? or is it???
Any advice appreciated,
Rick
------------------------------
Date: Sun, 06 Jun 1999 15:16:49 -0400
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Struggling with FORMAMAIL.PL
Message-Id: <slrn7llifg.44m.efflandt@efflandt.xnet.com>
On Sun, 06 Jun 1999 02:22:53 GMT, Mike Likvan <mlikvan@home.com> wrote:
>This is a multi-part message in MIME format. << WHY?
Please set your newsreader to use plain text.
>I've downloaded the FORMMAIL.PL from Matt's Script Archive (attached)
>and I'm having problems when referring to it in some HTML I'm writing.
(snip)
Did it run on the server when you tested it in the shell (telnet) as
./FORMMAIL.PL? Even though it does not have all of the input data, it
should at least run without perl errors, or the errors will be more
meaningful.
You might try renaming the script 'formmail.cgi', just in case the
directory is not ScriptAlias'd. Also make sure it has 755 permission (I
wouldn't have a clue what to do on a Win server).
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 6 Jun 1999 09:57:15 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Struggling with FORMAMAIL.PL
Message-Id: <7jdglr$5j8$1@gellyfish.btinternet.com>
On Sun, 06 Jun 1999 02:22:53 GMT Mike Likvan wrote:
> This is a multi-part message in MIME format.
> --------------FFEA48359401C2C777382000
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
Please dont do that - there is no need to use attachments in usenet posts
and as you can see the majority of newsreaders dont know what to do
with this stuff.
> I've downloaded the FORMMAIL.PL from Matt's Script Archive (attached)
> and I'm having problems when referring to it in some HTML I'm writing.
>
If it is a CGI or HTML problem then you might be better off taking it
to another group - If you have a problem with formmail.pl you should
refer it to its author.
>
> For some reason, the @referers doesn't seem to work. Here is why I
> think this.
@referers should contain the hostname of your server *and* its IP address
since most servers dont do reverse lookups in order to avoid that
overhead.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 06 Jun 1999 18:11:01 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Struggling with FORMAMAIL.PL
Message-Id: <brian-ya02408000R0606991811010001@news.panix.com>
In article <3759F72E.13E0820D@home.com>, Mike Likvan <mlikvan@home.com> posted:
> I've downloaded the FORMMAIL.PL from Matt's Script Archive (attached)
> and I'm having problems when referring to it in some HTML I'm writing.
> - I also have to put the hosting servers domain name in the
> @referes section of the Perl.
that feature is all hype because it doesn't provide the security it
promises. Matt's trying to lull you into a false sense of security.
anyone who wants to abuse your script to send anonymous mail (that
looks like it comes from you) only has to know that you are using
this script. circumventing this feature is trivial, even if it is
working as Matt (mis)designed it.
so, my recommendation is to not waste your time worrying about it.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Sun, 06 Jun 1999 13:23:52 -0700
From: "Luis F. Salas" <unclelui@grin.net>
Subject: Re: Total Newbie Question
Message-Id: <375AD8D8.421D@grin.net>
> Where should the cgi bin reside on my hosts server.
Maybe in host/yourhomedir/public_html/cgi-bin
Just maybe...
Luis
------------------------------
Date: Sun, 06 Jun 1999 11:56:27 -0700
From: Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: Wanted-Web Builder Seeking Fame & Fortune
Message-Id: <375AC45B.B0E10ACD@mcmahon.qal.berkeley.edu>
Ronald J Kimball wrote:
> That one was dumb luck.
>
with emphasis on the 'dumb'...
> As a matter of principle, I refuse to work for anyone who can't use
> apostrophes properly.
>
Now *theirs* a solid policy :)....
ap
> --
> _ / ' _ / - aka -
> ( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
> / http://www.tiac.net/users/chipmunk/
> "It's funny 'cause it's true ... and vice versa."
--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting - (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: Sun, 06 Jun 1999 18:20:32 GMT
From: yellowstone@my-deja.com
Subject: Win32::EventLog & strings
Message-Id: <7jee59$3av$1@nnrp1.deja.com>
I'm playing around with the Win32::EventLog module. I've been able to
mostly get it to do what I want, but I have one problem: when reading
log entries, I access the Strings entry, all the strings appear to be
concatinated together.
Is there a way to get at this data as the original individual strings?
TIA,
-y
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5906
**************************************