[12581] in Perl-Users-Digest
Perl-Users Digest, Issue: 6181 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 30 16:27:16 1999
Date: Wed, 30 Jun 99 13: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 Wed, 30 Jun 1999 Volume: 8 Number: 6181
Today's topics:
Re: "Learning Perl" exercises (Clinton Pierce)
"push" 2 dim array kgentes@gentek.net
Re: 2 simple (not to me tho) questions (Steve Lamb)
Re: 2 simple (not to me tho) questions (Bart Lateur)
Re: 2 simple (not to me tho) questions <tchrist@mox.perl.com>
Re: ==> Help! LWP Troubles <== (Brian Pontz)
Re: Apples and Oranges (M.J.T. Guy)
CGI scripting in Perl <dcohny@earthlink.net>
Re: CGI scripting in Perl <craig@mathworks.com>
Re: CGI.pm module, subroutines, can't call method. <craig@mathworks.com>
Re: Cross Reference Listing of Perl Script <hiller@email.com>
Re: Extracting specific text from specific files in a l (M.J.T. Guy)
Re: inplace edit (M.J.T. Guy)
Re: Large Volume sites using perl? (Jack Gardner)
Re: Large Volume sites using perl? <tchrist@mox.perl.com>
Re: Large Volume sites using perl? <uri@sysarch.com>
Re: Looking for a C compiler for Windows 98 <dmcg6174@yahoo.com>
Re: MIME TYPE (=?ISO-8859-1?Q?Claus_F=E4rber?=)
Modules on Win32 <hiller@email.com>
Re: Modules on Win32 <craig@mathworks.com>
Net::FTP get with space in filename? <leow@ufl.edu>
Re: Picture doesn't appear <hiller@email.com>
Piping perl to exchange for email.... chemguru@my-deja.com
Please help! <plsoucy@yahoo.com>
Re: profiling with DProf (Andrew Allen)
Re: regexp riddle <anonymous@web.remarq.com>
Re: regExpr question. <marlon@soda.CSUA.Berkeley.EDU>
Re: Robot email/poster for this group (John Stanley)
Re: Robot email/poster for this group (J. Moreno)
Re: Robot email/poster for this group <tchrist@mox.perl.com>
Re: Robot email/poster for this group <jcreed@cyclone.jprc.com>
Re: SELECT(rbits,wbits,ebits,timeout) adds blank line t pgodkin@my-deja.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 28 Jun 1999 13:56:31 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: "Learning Perl" exercises
Message-Id: <37777ef6.323750268@news.ford.com>
On Sun, 27 Jun 1999 10:14:29 GMT, bart.lateur@skynet.be (Bart Lateur)
wrote:
>Mike Dichirico wrote:
>
>>Again, please disregard this post. I unintentionally submitted this
>>post several times to this usenet. Thanks. --Mike
>>
>>Sent via Deja.com http://www.deja.com/
>>Share what you know. Learn what you don't.
>
>Deja.com URGENTLY ought to fix their soft. Multiple presses on a submit
>button should NEVER result in multiple posts. Ever.
Even the insanely stupid "Webbbs" software doesn't allow this nonsense.
--
Clinton A. Pierce "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org Miracles." -- Miracle Max, The Princess Bride
http://www.geeksalad.org
------------------------------
Date: Wed, 30 Jun 1999 19:10:52 GMT
From: kgentes@gentek.net
Subject: "push" 2 dim array
Message-Id: <7ldq3h$n6q$1@nnrp1.deja.com>
I have read the Perldocs, tested this out,
and several times searched the newsgroup
for something to help.. but alas, I ended up
reverting to an alternative method of loading
my double dimensional array (which is located
in a hash, as well)..
I have a theorectical hash that would look
like this, if Perl required me to define it
or construct it before loading (which it doesn't):
# empty the hash (TelProb record construction)
%TelProbRec = (
DateTime => "",
WaferName => "",
WaferNumber => "",
ProductID => 0,
ProcessID => 0,
ProbeMicro => [[],[],[],[]],
ProbeMicroDelta => [[],[],[],[]],
WaferMicro5Point => [[],[],[],[],[]],
Orthagonality => 0.0,
);
So if I had the intention of building the above
hash, then one of the elements in the hash is
the "ProbeMicro" multi-dimensional array.
I understand that I can use push to grow arrays
without worrying about indexes. I use push
in other areas a lot, but here I can't seem to
nail down the right permutation of syntactical
dressing to make it "see" that I am trying to grow
my first "row" into the multi-dimensional array..
# push @{$TelProbRec{ProbeMicro}}, [@fields [2..4]];
to get around my mystification of the above not
working I hard coded the slice assignment into
the first dimension of the array, as follows.
(since I was tracking the index of the
1rst dimension of the array anyways, it was
not a problem to do it this way)
$TelProbRec{ProbeMicro}[$probenum - 1] = [@fields [2..4]];
My question, though, is why does the first one not
work- or more correctly- what stupid mistake did
I make in massaging the syntactical form of the
push'es first parameter that was incorrect?
Please help..
Kim
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 30 Jun 1999 17:08:03 GMT
From: morpheus@despair.rpglink.com (Steve Lamb)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <slrn7nkjnj.9bs.morpheus@rpglink.com>
On Tue, 29 Jun 1999 19:14:46 -0400, Tad McClellan <tadmc@metronet.com> wrote:
> They mean different things.
> They are not interchangable.
The way I use them, they are. Print("$foo"); and print $foo; do the same
thing in my code because I'm not doing anything with $foo that putting the ""
there will harm.
That makes it asthetics. Page 10. READ IT. Jeezus scking christ people.
Shut up about it already.
--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
ICQ: 5107343 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------
------------------------------
Date: Wed, 30 Jun 1999 19:13:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <377d6bc7.1165673@news.skynet.be>
Tad McClellan wrote:
>: print("$foo");
>: Looks better to me than
>: print $foo;
>
>: It is ASTHETICS, nothing more.
>
> It is NOT asthetics, it is *semantics*, nothing more.
Aren't you exagerating? Say the demands change, you want an extra
newline at the end. What would you do?
print $foo."\n";
or
print "$foo\n";
I bet that often, the choice will be the latter one. The only resulting
effect is adding a newline, but yet, suddenly you accept putting the
variable between quotes.
Bart.
------------------------------
Date: 30 Jun 1999 13:47:35 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <377a7457@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, bart.lateur@skynet.be (Bart Lateur) writes:
:I bet that often, the choice will be the latter one. The only resulting
:effect is adding a newline, but yet, suddenly you accept putting the
:variable between quotes.
It's quite simply a misleading thing to write fn("$x") in lieu of fn($x).
It makes you wonder, "What the devil are they stringifying this before
passing it in to the function for?" It's not just a bad idea. It's
a FAQ. The next release will see more detail.
--tom
--
"If you substitute other kinds of intellectual property into the GNU
manifesto, it quickly becomes absurd." --Cal Keegan
------------------------------
Date: Wed, 30 Jun 1999 19:59:44 GMT
From: pontz@channel1.com (Brian Pontz)
Subject: Re: ==> Help! LWP Troubles <==
Message-Id: <377a75dc.4211960@news2.channel1.com>
On Wed, 30 Jun 1999 13:26:14 -0300, "Kevin Howe"
<khowe@performance-net.com> wrote:
I'm still new to this but I got this from the web.
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("$0/0.1 " . $ua->agent);
# $ua->agent("Mozilla/5.0") # pretend you are some very new Netscape
browser
$req = new HTTP::Request 'GET' => 'http://www.sn.no/libwww-perl';
$req->header('Accept' => 'text/html');
# send request
$res = $ua->request($req);
# check the outcome
if ($res->is_success) {
print $res->content;
} else {
print "Error: " . $res->code . " " . $res->message;
}
try this website
http://lab.dce.harvard.edu/extension/cscie13/library/LWP/
Brian Pontz
>
>
>
------------------------------
Date: 30 Jun 1999 18:32:21 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Apples and Oranges
Message-Id: <7ldnrl$5c7$1@pegasus.csx.cam.ac.uk>
William Herrera <posting.account@lynxview.com> wrote:
>
>Worse than that, it thinks it IS the $n variable It only looks at the
>leading number! Look at this:
That's what I always used to believe, but ...
>#################
>
>$t = '1 orange';
>$s = 'testing fruit';
>$s =~ /.+(es).*(fr)/;
>print "testing: $$t, $1, $2\n\n";
>
>###################
>
>prints :
>
>es, es, fr
And if you add the extra line to the end of your test
print \$$t, \$1, \$2, "\n";
you get the extra output (for example)
SCALAR(0xb3e48)SCALAR(0xb3f08)SCALAR(0xb3f44)
showing that $$t and $1 are *not* the same variable. Now I'm very
puzzled.
Mike Guy
------------------------------
Date: Wed, 30 Jun 1999 14:19:49 -0400
From: "David C" <dcohny@earthlink.net>
Subject: CGI scripting in Perl
Message-Id: <7ldn47$l9v$1@ash.prod.itd.earthlink.net>
I have a problem that I know everyone will probably be able to solve in a
second on this newsgroup. I have a CGI script that tries to restart httpd
on a BSDI 4.0.1 box using perl. I have tried everything to get this thing
to work. I have setuid on the script itself, I have set the env{'PATH"}
properly so that the command would not be considered tainted, I have
compiled a C program that is called by the script to suid the apachectl to
run as root, I have tried to use sudo as well as making a link to apachectl
and setting permissions so that the user that is running the CGI script has
full control, but still it will not kill the root httpd. Is there somthing
wrong here??? Can anyone help. Thanks in advance. I usually use this as my
last resort so please be gentle. Thanks again.
------------------------------
Date: Wed, 30 Jun 1999 14:37:32 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: CGI scripting in Perl
Message-Id: <377A63EC.ADFF44B5@mathworks.com>
David C wrote:
Not that this is the right group, but....
If you are trying to do "apachectl graceful", the root pid will not be killed.
You need to do:
kill -TERM `cat /usr/local/apache/logs/httpd.pid`
See the Apache docs for more info. They are actually included with
Apache itself.
Craig
------------------------------
Date: Wed, 30 Jun 1999 14:01:45 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: CGI.pm module, subroutines, can't call method.
Message-Id: <377A5B89.DEE1690E@mathworks.com>
Jason Lingel wrote:
> This is the error message I get:
>
> Can't call method "header" on an undefined value at Guestbook.pm line
> 31.
>
$query is global to your scipt, only. If you want your subroutine to see
it, you need to pass $query as an argumnet.
Craig
------------------------------
Date: Wed, 30 Jun 1999 19:37:22 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Re: Cross Reference Listing of Perl Script
Message-Id: <377A7174.9DC7915A@email.com>
This is in the FAQ. No I'm not gonna go b!tching about that...
http://language.perl.com/newdocs/pod/perlfaq3.html#How_do_I_cross_reference_my_Perl
--
How do I cross-reference my Perl programs?
The B::Xref module, shipped with the new, alpha-release Perl compiler (not the
general distribution prior to the 5.005 release), can be used
to generate cross-reference reports for Perl programs.
perl -MO=Xref[,OPTIONS] scriptname.plx
HTH,
Jordan
jtubaugh@my-deja.com wrote:
>
> I seem to remember reading somewhere that there was a utility that would
> read a Perl script and create a cross-reference listing. By
> "cross-reference listing" I mean something that identifies the
> functions, and variables used in the script.
>
------------------------------
Date: 30 Jun 1999 18:23:59 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Extracting specific text from specific files in a list
Message-Id: <7ldnbv$4v9$1@pegasus.csx.cam.ac.uk>
John Borwick <jobosw@unx.sas.com> wrote:
>
>if you are looking for the string
> qq{assembly (name="file}
>then you should escape your open paren, like so:
> $string = 'assembly \(name="';
While that fixes up the particular case, it's not easy to generalise.
Presumably $string will have other values in due course, else why make
it a variable?
>> print FILE <FOO> if /^$string$file/ ... eof;
Make that
print FILE <FOO> if /^\Q$string$file/ ... eof;
Rule of thumb: when substituting a variable into a regex, always
precede it by \Q.
Exception: when you *explicitly* want regex metacharacters to be
interpolated.
You might argue "I don't need to do that because I *know* the string
only contains alphanumerics", but you'll be sorry when the assumption
breaks down. Get into good habits - (almost) always use \Q.
It's a pity that \Q isn't the default, but that's history for you.
Mike Guy
------------------------------
Date: 30 Jun 1999 18:33:53 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: inplace edit
Message-Id: <7ldnuh$5dj$1@pegasus.csx.cam.ac.uk>
In article <377A3041.A8E0B85@cs.sandia.gov>,
Kenneth Massey <kpmasse@cs.sandia.gov> wrote:
>I read briefly somewhere that there is an inplace edit $^I
>that is ideal for an application like replacing one line in a long
>mailing list file. However, I can't find any detailed documentation on
>how to use this feature. Thanks,
>
>Kenneth
perldoc perlvar
perldoc perlrun
Mike Guy
------------------------------
Date: Wed, 30 Jun 1999 17:53:56 GMT
From: jjack100@yahoo.com (Jack Gardner)
Subject: Re: Large Volume sites using perl?
Message-Id: <377a58c5.508871@news.earthlink.net>
On Wed, 30 Jun 1999 10:11:07 +0100, Matt Sergeant
<matt.sergeant@ericsson.com> wrote:
>
>Then why are you asking, out of curiosity?
>
Yes. You answered the question: out of curiosity. I probably should
have mentioned in my first post that the IMDB is the one large site
that I knew was using perl. The problem is that that is THE example
that everyone uses (the first 2 replies to this post mention it
already).
Cheers,
Jack
------------------------------
Date: 30 Jun 1999 12:55:02 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Large Volume sites using perl?
Message-Id: <377a6806@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
jjack100@yahoo.com (Jack Gardner) writes:
:Yes. You answered the question: out of curiosity. I probably should
:have mentioned in my first post that the IMDB is the one large site
:that I knew was using perl. The problem is that that is THE example
:that everyone uses (the first 2 replies to this post mention it
:already).
Ok. How about Deja.COM, with "215 Linux servers and 30 Apache servers"
(whatever that really means) according to recent press.
--tom
--
if (instr(buf,sys_errlist[errno])) /* you don't see this */
--Larry Wall in eval.c from the 4.0 perl source code
------------------------------
Date: 30 Jun 1999 15:11:49 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Large Volume sites using perl?
Message-Id: <x7yah14i6i.fsf@home.sysarch.com>
>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
TC> [courtesy cc of this posting mailed to cited author]
TC> In comp.lang.perl.misc,
TC> jjack100@yahoo.com (Jack Gardner) writes:
TC> :Yes. You answered the question: out of curiosity. I probably should
TC> :have mentioned in my first post that the IMDB is the one large site
TC> :that I knew was using perl. The problem is that that is THE example
TC> :that everyone uses (the first 2 replies to this post mention it
TC> :already).
TC> Ok. How about Deja.COM, with "215 Linux servers and 30 Apache servers"
TC> (whatever that really means) according to recent press.
i bet they use many of the linux boxes as database servers. so a
bunch of apache boxes will front end (where the app code run depends on
the design: mod_perl, fastcgi, etc.) a bunch of db servers which have
all the posts from their epoch. plus they have other services that might
need dedicated servers. so the statement make sense. you just have to
know how to read between the lines.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Wed, 30 Jun 1999 14:47:45 -0400
From: "Daniel McGrath" <dmcg6174@yahoo.com>
Subject: Re: Looking for a C compiler for Windows 98
Message-Id: <7ldoqq$3q6$1@cedar.liii.com>
elephant wrote in message ...
>perl is not really designed to be used this way .. especially with I/O ..
>perl doesn't flush the output until the filehandle is closed .. { print
>"foobar"; } is actually shorthand for { print STDOUT "foobar"; } ..
>'STDOUT' being a builtin filehandle meaning the stdout (derr) .. but what
>this means is that the buffer to stdout will not be flushed until you
>close STDOUT
>
>even then .. you will not see the output in Win32 command prompt while
>STDIN is still open .. which it is while you're still entering code
>
>basically .. RTFM
Does this problem occur only if I type simply the command "perl", with no
filename? That is to say, will it always work fine if I give the "perl"
command a filename argument?
- Daniel
------------------------------
Date: 30 Jun 1999 19:30:00 +0200
From: claus+usenet@faerber.muc.de (=?ISO-8859-1?Q?Claus_F=E4rber?=)
Subject: Re: MIME TYPE
Message-Id: <7JsNyQa3cDB@faerber.muc.de>
Faisal Nasim <swiftkid@bigfoot.com> schrieb/wrote:
> print "Content-type: text/html\n\n<pre>";
>
> After that, everthing is printed in plain text !
> (<pre> is a standard html tag, you can see by view-source)
This way you are outputting invalid HTML. Worse than that, tags and
references will be interpreted thereafter.
Why not use text/plain?
--
Claus Andri Fdrber <http://www.faerber.muc.de>
PGP: ID=1024/527CADCD FP=12 20 49 F3 E1 04 9E 9E 25 56 69 A5 C6 A0 C9 DC
------------------------------
Date: Wed, 30 Jun 1999 18:12:50 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Modules on Win32
Message-Id: <377A5DA4.C5C9E0A9@email.com>
This must be a FAQ but I can't find the answer anywhere...
I run ActiveState's Perl for Win32 on my Windows 98 machine. How do I install
modules from CPAN?
TIA,
Jordan Hiller
(please cc to hiller@email.com)
:~
------------------------------
Date: Wed, 30 Jun 1999 14:19:30 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: Modules on Win32
Message-Id: <377A5FB1.4B82E62E@mathworks.com>
Jordan Hiller wrote:
> I run ActiveState's Perl for Win32 on my Windows 98 machine. How do I install
> modules from CPAN?
ppm
Craig
------------------------------
Date: Wed, 30 Jun 1999 14:23:45 -0400
From: leow <leow@ufl.edu>
Subject: Net::FTP get with space in filename?
Message-Id: <377A60AF.4A90FD7A@ufl.edu>
Hello,
I can use Net::FTP to get a file that has no spaces in its filename.
But when I try to get a file that has spaces in its filename,
I always get the following error:
Bad remote filename 'blah blah'
I've tried adding double quotes and using a backslash before each space,
but these don't help:
Bad remote filename '"blah blah"'
If you know how to do this, please email me.
Thanks....
Sincerely,
Leo Wierzbowski
Univ of Florda
leow@ufl.edu
------------------------------
Date: Wed, 30 Jun 1999 18:17:27 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Re: Picture doesn't appear
Message-Id: <377A5EB9.33791831@email.com>
Sometimes I've had trouble with permissions and such when trying to put a
picture in the cgi-bin. I would try putting your picture in a different folder.
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "<IMG SRC=\"/images/picture.gif\">";
That could would require the picture to be at /images/picture.gif
HTH,
Jordan
j_a_p@my-deja.com wrote:
>
> I am trying to show a picture from one of my perl scripts.
>
> #!/usr/local/bin/perl
>
> print "Content-type: text/html\n\n";
>
> print "<IMG SRC=\"picture.gif\">";
>
> however the picture doesn't show up. Is there something special that
> needs to be done in order to display a picture.
------------------------------
Date: Wed, 30 Jun 1999 18:15:44 GMT
From: chemguru@my-deja.com
Subject: Piping perl to exchange for email....
Message-Id: <7ldms3$lql$1@nnrp1.deja.com>
How can I pipe to exchange to send a message? I'm writing a script to
mail a multi-select form to a user. Unfortunately, I just found out that
this script is going to live on an NT IIS server with exchange.
Can anyone help?
Thanks
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 30 Jun 1999 14:30:12 -0400
From: Pierre-Luc Soucy <plsoucy@yahoo.com>
Subject: Please help!
Message-Id: <377A622A.EB801633@yahoo.com>
We are currently building a webmaster utilities site.
We already have three programmers, but we need more.
As we aren't a big company yet, we can't pay you in $$$. We will give y
ou a % of the benefits generated by what you will have created (that's
less risky for us, but can be more interesting for you).
If you are interested to learn more, contact
Pierre-Luc Soucy
plsoucy@yahoo.com
ICQ 35896247
Note : we need your help
------------------------------
Date: 30 Jun 1999 19:50:52 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: profiling with DProf
Message-Id: <7ldses$laa$1@fcnews.fc.hp.com>
interface (ywong@andrew.cmu.edu) wrote:
: I'm trying to use the Devel::DProf module to profile some code. When I
: try to use it (perl5 -d:Dprof <script.pl>) I get "Can't locate loadable
: object for module Devel::DProf in @INC (INC contains: d:/Perl/lib
: d:/Perl/site/lib .) at d:/Perl/lib/Devel/Dprof.pm line 120"
: It seems like it can't find something, but everything that came with the
: module is installed in the /Devel/DProf directory. Is there something
: missing or am I supposed to move or configure something I didn't?
make
make test
make install
Andrew
------------------------------
Date: Wed, 30 Jun 1999 10:47:48 -0800
From: Ashish Kadakia <anonymous@web.remarq.com>
Subject: Re: regexp riddle
Message-Id: <930768469.17535@www.remarq.com>
(/(?=[dxeb])([dxeb])(?!\1)([dxeb])?(?!\1|\2)([dxeb])?(?!
\1|\2|\3)([dxeb])?/
is the one which really works.. None of the solution posted
earlier really works..People can simplify further..
Look for
http://x40.deja.com/[ST_rn=md]/getdoc.xp?
AN=488977001&CONTEXT=930765714.1960116238&hitnum=4
for something similar
**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
------------------------------
Date: Wed, 30 Jun 1999 11:52:56 -0700
From: marlon <marlon@soda.CSUA.Berkeley.EDU>
Subject: Re: regExpr question.
Message-Id: <Pine.BSF.3.96.990630114702.24180A-100000@soda.CSUA.Berkeley.EDU>
On 30 Jun 1999 redmondm@yahoo.com wrote:
> Think of $foo as a string not a list of lines. Newline, \n, is just another
> characteri, though a little special. So leave $foo a scalar and use the
> /s modifier to tell . to match newline.
>
> $foo =~ /<!-- something unique 1 -->(.*?)<!-- something unique 2 -->/s;
> print $1;
Thanks for the help! A few related questions though:
1) Why do I need both the * and the ?, I've tried it with and with out
the ? and both results are the same.
2) I thought that =~ was supposed to assign $foo to the matched pattern
but when I print out $foo I get the ENTIRE html, where I tought that
$foo would get the return of the //s something very close to $1
Thanks, Marlon
> Martin
> mpr@webcamnow.com
>
> In article <Pine.BSF.3.96.990629180249.4862A-100000@soda.CSUA.Berkeley.EDU>,
> marlon wrote:
> >Im all FAQed out, I've spent some time on cpan and the examples dont seem
> >to work for my task:
> >
> >I have:
> >
> >$foo equal to
> >" a whole lot of html
> > spanning several lines, there are 2 specific unique
> > strings like <!-- something unique 1 --> and a
> > bunch of html in between <!-- something unique 2 -->
> > and then a whole lot more stuff"
> >
> >so that's what $foo looks like.
> >And what I want is to capture all the text INBETWEEN the 2 unique strings.
> >It doesn't matter if I get the 2 unique strings (they're just HTML
> >comments) but I dont know if I have to turn $foo into a file handle,
> >if so then what?
> >If I leave $foo as a scalar how do I apply a regexp accross it?
> >Thanks in advance, marlon
> >
> >
> >_
> >
>
>
_
------------------------------
Date: 30 Jun 1999 18:40:50 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Robot email/poster for this group
Message-Id: <7ldobi$d54$1@news.NERO.NET>
In article <a1u2rpeg4z.fsf@cyclone.jprc.com>,
Jason Reed <jcreed@cyclone.jprc.com> wrote:
>Where is the validity of this `all bots on Usenet are inherently
>a bad idea' argument coming from?
Ummm, maybe you like holding discussions with robots, but robots are not
typically participants in a discussion, and this one is not intended for
such.
There is a comment in one of the RFCs about having programs send mail to
people who post (against it). The .test newsgroups are a anomaly, since
they are not discussion groups. This one is.
>Assume, for the sake of argument, the bot is capable of perfectly
>discriminating between questions and non-questions, and FAQs and
>non-FAQs, etc. so that the only effect it has is to make all of the
>trivial 'see perldoc perlfoo' followups instead of various humans
>making them.
Assume for the sake of argument that the sun comes up in the west. Ok.
>The noise level is exactly the same (reduced if responses
>are emailed, though with antispam-funged addresses that's dubiously
>feasible) and less effort is wasted by human posters answering trivial
>questions.
If the answer is emailed, how will these human posters know they don't
need to waste their time? If the answer is posted, why do you think
someone will read a FAQ that is posted by the robot when they haven't
read the same FAQ posted by Tom? And why are you worried about whatever
time people choose to waste?
Why is it hard to understand the concept of communicating with a robot
via email instead of via a public discussion group?
>So, in this utopia of strong AI, it's a *good thing*, isn't it?
No.
>Isn't it at least *possible*, then, that effort in this direction
>might save some effort answering FAQs day after day, without adding
>much (if any non-negligible) noise?
As possible as if the sun actually did start coming up in the west.
>Hell, if it's just one bot making all the replies instead of a group
>of people (who also make other posts), it's all that much easier to
>killfile it.
If all you see USENET as is something to killfile, I'm sorry you've not
had a better experience. If the answer to all of USENET's problems was
"killfile", then we would simply have one large group called "net" and
be done with all this group hierarchy nonsense.
Other people actually have to pay for transporting this stuff, and
piling it all into the group and telling them to killfile what
shouldn't be there in the first place is an insult.
------------------------------
Date: Wed, 30 Jun 1999 15:24:45 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Re: Robot email/poster for this group
Message-Id: <1du7wym.1ptsfcnpc1o55N@roxboro0-0057.dyn.interpath.net>
Tad McClellan <tadmc@metronet.com> wrote:
> Abigail (abigail@delanet.com) wrote:
>
> : But bots don't belong on Usenet anyway.
>
> I agree.
While I wouldn't want the bot to be released without extensive
discussion and testing, I don't see a problem with it in theory
(although I don't think it'd be good enough in practice, OTOH I never
thought the babelfish would approximate usefulness either and it does).
If you have one poster (a bot) answering FAQs in a nice helpful manner,
it could cut down on some of the excessive traffic -- I just don't
believe this hypothetical 'bot' will ever exist in the forseable future.
OTOH, I actually think it was more appropriate for
comp.lang.perl.moderated -- a group project is what it sounded like, the
fact that it was intended for this group is really irrelevant; as long
it isn't deployed without the relevant groups permission it doesn't
matter which group it was intended for.
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
Hmn, you might want to consider upgrading to tin 1.4 which won't strip
off the trailing space in the sigdash.
--
John Moreno
------------------------------
Date: 30 Jun 1999 13:49:51 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Robot email/poster for this group
Message-Id: <377a74df@cs.colorado.edu>
You guys are all over-engineering. You need human-directed
autofaqqing. It's much more reliable. My current set it:
425traps elitism mods references
@inc-mods exe-cgi modules-group-wrong regex-html
autofaq faq-index mtg-nosale repl-email
caps filehandles multi.generic sham
card-info grinch netiquette sig-2-long
cgi-group helpme no-subject sorting
cgi-lib.txt html-mail nonfaq test
cgi-metafaq ice-age noobee uce
cgi-perl-problem ipc occur unshift-vs-use
change-file-inplace its over-quoted v5.002
clonepost its.bak pdsc virus
clp-dead licence perl-info wizquests
count-nouns line-wrap perl-source xposts
csh-faq long-lines pgp y2k
dash-w mailcc ports-perl
dot-truncate mimes post-to-cgi
dup-posting mldbm quoted-end
But that's trivially extended. Maybe I'll package it up and re-release it.
--tom
--
"I believe OS/2 is destined to be the most important operating
system, and possibly program, of all time" - Bill Gates, Nov, 1987.
------------------------------
Date: 30 Jun 1999 15:38:48 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: Robot email/poster for this group
Message-Id: <a1so79eawn.fsf@cyclone.jprc.com>
stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
> Ummm, maybe you like holding discussions with robots, but robots are not
> typically participants in a discussion, and this one is not intended for
> such.
> There is a comment in one of the RFCs about having programs send mail to
> people who post (against it). The .test newsgroups are a anomaly, since
> they are not discussion groups. This one is.
Well, not all of what actually occurs on c.l.p.m is useful discussion.
I thought the bot was supposed to allow people to do *more* discussing
and less silly question-and-answer posting.
> Assume for the sake of argument that the sun comes up in the west. Ok.
I was just trying to describe an extreme, one endpoint on a continuum
of bot effectiveness. If the endpoint (perfect bot operation) is
better than our current position on it (no bot at all), then maybe
trying to move towards the endpoint might produce a better state of
affairs; maybe not --- maybe we're at a local maximum of sorts, and it
would take a lot of effort before the bot is not more annoying than
it's worth. Maybe that's too much effort for the result to justify.
I'm not arguing that a decent bot is easy - but it might be feasible.
> If the answer is emailed, how will these human posters know they don't
> need to waste their time? If the answer is posted, why do you think
> someone will read a FAQ that is posted by the robot when they haven't
> read the same FAQ posted by Tom? And why are you worried about whatever
> time people choose to waste?
Do you mean the relevant FAQ excerpts Tom posts so frequently in
response to documented questions?
(I should hope they're read once shoved down questioner's throats,
though lamentably not before, apparently)
If they're never read, why does Tom post them?
Should Tom be told not to post them, seeing as this is a discussion group?
I would tend to think there exist *some* people who would
rather not spend the time making similar posts if a bot would do
it for them, if not Tom specifically. But hey, if every
single one of them *enjoys* answering the same questions
over and over, then sure, a bot is quite pointless.
I'm not arguing that a bot is definitely necessary - but it might be useful.
> Why is it hard to understand the concept of communicating with a
> robot via email instead of via a public discussion group?
I thought you claimed email wasn't useful, since there would be no way
for humans to know not to post anyway.
Why is it hard to understand the concept of looking for documentation
instead of asking for help via a public discussion group?
I haven't the slightest idea, but a lot of people don't understand
*that*.
> >So, in this utopia of strong AI, it's a *good thing*, isn't it?
> No.
Care to elaborate? Do you think it's a definite negative, or merely
no better?
> >Isn't it at least *possible*, then, that effort in this direction
> >might save some effort answering FAQs day after day, without adding
> >much (if any non-negligible) noise?
> As possible as if the sun actually did start coming up in the west.
Are you saying that, no matter how hard anyone tries, a bot will
always produce more noise than any convenience it might produce, or,
alternatively, that even if all of Tom's posts were coming from a bot,
that would still be bad?
> If all you see USENET as is something to killfile, I'm sorry you've not
> had a better experience. If the answer to all of USENET's problems was
Didn't say that. Some parts of it may be worth killfiling, however,
depending on users' tastes.
> Other people actually have to pay for transporting this stuff, and
> piling it all into the group and telling them to killfile what
> shouldn't be there in the first place is an insult.
So does the volume of FAQs and answers (by humans) thereto bother you
at all? (Should they '[not] be there in the first place'?)
Would it bother you more if those answers came from a bot instead,
simply because bots-have-no-place-on-usenet?
---Jason
------------------------------
Date: Wed, 30 Jun 1999 19:20:42 GMT
From: pgodkin@my-deja.com
Subject: Re: SELECT(rbits,wbits,ebits,timeout) adds blank line to file
Message-Id: <7ldqlt$nea$1@nnrp1.deja.com>
Thank you for response.
The problem with the extra blank line appearing in my STDOUT log file
was not caused by my Perl script but rather by a Shell script which
shares the same log file. The shell script checks every 60 seconds to
see that the perl script is still running.
The problem with the sleep(60); command under solaris has me stumped.
However, don't bother pursuing such any further as I have my work
around. However, if you want to see the sample code that caused the
problem, here it is:
#!/usr1/sgb/bin/perl
# Flush buffer after each print statement
$| =1;
open(STAT_LOG, ">/sw_ux/apps/DEV1/fx1/bin/p.log");
print STAT_LOG "REPORT STAT LOG\n";
print STAT_LOG `date`;
sleep(15); #causes segmentation fault
# select(undef, undef, undef, 15);
print STAT_LOG "Just woke up at:\n";
print STAT_LOG `date`;
When I run this perl script from a telenet window I see the following:
sgfs06:(dev_fx1):/sw_ux/apps/DEV1/fx1/bin> paultest.pl
Wed Jun 30 11:38:04 PDT 1999
Segmentation Fault
sgfs06:(dev_fx1):/sw_ux/apps/DEV1/fx1/bin>
_____________________________________________
In article
<Pine.GSO.4.02A.9906251934490.2676-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
> On Sat, 26 Jun 1999 pgodkin@my-deja.com wrote:
>
> > I am using the command:
> > SELECT(undef, undef, undef, 60)
>
> Maybe you mean select(). Perl is case sensitive, of course.
>
> > to implement a 60 second sleep within my perl script. This command
is
> > causing an extra blank line to appear in my STDOUT file which I do
not
> > want.
>
> Can you make a small (five lines) program which demonstrates this
> behavior?
>
> > I have found that the SLEEP 60 command causes a Core dump
>
> Maybe you mean sleep(). That's not supposed to happen. Maybe your perl
is
> miscompiled. Did it pass all tests in 'make test' before 'make
install'?
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
>
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 6181
**************************************