[13277] in Perl-Users-Digest
Perl-Users Digest, Issue: 687 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 31 12:07:19 1999
Date: Tue, 31 Aug 1999 09:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 31 Aug 1999 Volume: 9 Number: 687
Today's topics:
@INC question. <sg@midwal.ca>
[ANNOUNCE] Net::Whois version 1.6 now on CPAN <dhudes@ncdsl.com>
Re: File listing (Abigail)
Re: File listing (Gabor)
help using CGI.pm for file upload ??? <dtbaker_@busprod.com>
Re: How do I dereference in a sub? (Larry Rosler)
Re: How to process file of this format (see inside) <theglauber@my-deja.com>
LWP::Simple GET ??? <bob.freedman@eis.noaa.gov>
Re: newbie : POST cw@dwc.ch
Re: Obtaining Values from Mulitple Selects <dtbaker_@busprod.com>
Re: Perl a Black Sheep? (I.J. Garlick)
Re: Perl consuming 100% CPU on WinNT (Marcel Grunauer)
Re: Perl on PalmPilot <dtbaker_@busprod.com>
Re: Perl.exe has an interpreted mode? <kenhirsch@myself.com>
Re: Problem with <!--exec cgi="/scripts/script.pl"--> i <jpeterson@office.colt.net>
Re: Request for Comments: www.perl.com (Abigail)
Re: ROUNDING NUMBERS -- HELP ME (Marcel Grunauer)
Re: sending mail through perl on IIS 4.0 (Marcel Grunauer)
Re: STDIN, Arrays and Win32 <lit280@us.ibm.com>
Re: System command runs from command line, not from bro <jeff@vpservices.com>
Re: Testing files on cd-rom? (Abigail)
Re: Using grep to match complete words <saminma@yahoo.com>
Re: Using grep to match complete words craigl@rimpoche.chi.il.us
Re: Using grep to match complete words <bgunter@bsat.com>
using the exec command. <kenn@nacs.net>
Re: Why doesn't my undef an array? <craig@mathworks.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 31 Aug 1999 16:00:45 GMT
From: SG <sg@midwal.ca>
Subject: @INC question.
Message-Id: <37CBFAA3.8D8D1517@midwal.ca>
Dear Experts!
I moved my perl stuff from one SUN Solaris box to another similar one.
Unfortunately the directories and disk names are different at these two
machines, so the value of @INC is now wrong. How can I modify @INC to
reflect a new environment?
Regards,
Serguei.
------------------------------
Date: 31 Aug 1999 15:05:18 GMT
From: "Dana Hudes" <dhudes@ncdsl.com>
Subject: [ANNOUNCE] Net::Whois version 1.6 now on CPAN
Message-Id: <7qgqve$gco$1@play.inetarena.com>
Net::Whois version 1.6 is now on CPAN.
V1.6 Remove bogus require of 5.005 , back to require 5.004
V1.5 Fixed problem with Network Solutions change to the response for
unregistered domain.
------------------------------
Date: 31 Aug 1999 09:08:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: File listing
Message-Id: <slrn7snojk.a54.abigail@alexandra.delanet.com>
Gabor (gabor@vmunix.com) wrote on MMCXCI September MCMXCIII in
<URL:news:slrn7snhrf.4ke.gabor@vnode.vmunix.com>:
||
|| Balderdash. Both zsh and bash will let you see them nicely as they
|| should. The Bourne shell and csh won't glob them. It was merely a
|| design decision. dot files aren't inherently invisible.
$ cd /tmp
$ touch .foo.txt foo.txt
$ echo *.txt
foo.txt
$ echo $SHELL
/bin/bash
$
Unless you set some configuration parameters, bash will *NOT* expand
a leading * to include a leading .. After all, bash is supposed to
be a Bourne shell replacement; and breaking such an essential thing
as * expansion would be out of the question.
This is the first time in 15+ years of Unix usage that I've heard
someone claiming that including dotfiles in * expansion is "the way
it should". Everyone else seem to think that ignoring dotfiles on
* wildcard expansion is a feature.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\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: 31 Aug 1999 11:36:18 -0400
From: gabor@vmunix.com (Gabor)
Subject: Re: File listing
Message-Id: <slrn7sntjh.5tf.gabor@vnode.vmunix.com>
In comp.lang.perl.misc, Abigail <abigail@delanet.com> wrote :
# Gabor (gabor@vmunix.com) wrote on MMCXCI September MCMXCIII in
# <URL:news:slrn7snhrf.4ke.gabor@vnode.vmunix.com>:
# ||
# || Balderdash. Both zsh and bash will let you see them nicely as they
# || should. The Bourne shell and csh won't glob them. It was merely a
# || design decision. dot files aren't inherently invisible.
#
#
# $ cd /tmp
# $ touch .foo.txt foo.txt
# $ echo *.txt
# foo.txt
# $ echo $SHELL
# /bin/bash
# $
#
#
# Unless you set some configuration parameters, bash will *NOT* expand
Precisely. You have not proven me wrong.
# a leading * to include a leading .. After all, bash is supposed to
# be a Bourne shell replacement; and breaking such an essential thing
# as * expansion would be out of the question.
#
#
# This is the first time in 15+ years of Unix usage that I've heard
# someone claiming that including dotfiles in * expansion is "the way
# it should". Everyone else seem to think that ignoring dotfiles on
# * wildcard expansion is a feature.
Well, that's how you see it. I don't as I stated above, it was a
design decision made by the designers of early shells. Obviously,
newer shells give you the option as they should After all, that's what
makes Unix so great, nothing is forced upon you. Plus, just because
you haven't heard something, does that mean it has never been said?
Who is 'everyone else'?
------------------------------
Date: Fri, 27 Aug 1999 12:55:00 -0500
From: Dan Baker <dtbaker_@busprod.com>
Subject: help using CGI.pm for file upload ???
Message-Id: <37C6D0F4.4CB1D0B4@busprod.com>
I have been working on a script to upload image files to a server, and
am not able to get things working quite right. Unfortunately, I cant
tell if there is a bug in CGI.pm, or my local webserver, or my script. I
am hoping someone either has some really good and complete examples, OR
knows enough about how the ENCTYPE=multipart/form-data works to tell me
how to get at the uploaded file directly.
I am running everything locally on a win95 machine for testing purposes.
Using Xitami as a local webserver, and Netscape 4.6 as a browser.
- the perl cgi on the server doesnt seem to use the limit I set for
maximum POST file size. I was hoping there was a way to catch illegal
file types and sizes before they user server time and space to upload. I
have the following line in my script, but it still allows large files to
be posted:
$CGI::POST_MAX=1024 * 100 ; # limit to 100kB
- there are temp files of the multipart file being created in c:\temp
which
have names like nsformAG.TMP and contain the multipart form data. They
never get cleaned up. The temp files created by CGI.pm seem to get
cleaned up ok as long as the script gets to finish, but seem to choke if
there is already one in the tmp dir.
QUESTIONS:
- would it be safer to NOT use CGI.pm and parse the uploaded multipart
file directly? If so, how do I find out the pathname to the file (which
I know is getting created in c:\Temp)
- are there known bugs with the tmpFileName and upload functions in
CGI.pm on win95?
--
Thanx, Dan
# If you would like to reply-to directly, remove the - from my username
* no spam please... regulated by US Code Title 47, Sec.227(a)(2)(B) *
------------------------------
Date: Tue, 31 Aug 1999 07:25:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I dereference in a sub?
Message-Id: <MPG.123585a2c7bb905a989eeb@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <37CBDD44.A0DE69F@Paramin.COM> on Tue, 31 Aug 1999 07:48:53 -
0600, J. S. Jensen <jsjensen@Paramin.COM> says...
> When I try to dereference in a subroutine, it doesn't seem to work. Can
> anyone tell me why? I guess code would be the best to describe this:
>
> sub t {
> my $ret = $_[0];
> $$_[1] = $ret;
> return $ret;
> }
>
> $foo = "foo";
> print t("bar",\$foo) . $/;
> print $foo . $/;
>
> why is the output ``bar\nfoo\n'' when shouldn't it be ``bar\nbar\n'' ?
${$_[1]} = $ret;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 31 Aug 1999 14:07:35 GMT
From: The Glauber <theglauber@my-deja.com>
Subject: Re: How to process file of this format (see inside)
Message-Id: <7qgniu$ktn$1@nnrp1.deja.com>
In article <cnaqcvozarg.fhccqt0.pminews@news2.ibm.net>,
"Philip Nelson" <pandpATibm.net> wrote:
> I want to write a Perl script to process a file of the following
format -
>
> Header 1
> Header 1 Detail Line 1
> ...
> Header 1 Detail Line n
>
> Header 2
> Header 2 Detail Line 1
> ...
> Header 2 Detail Line m
If there is anything you can use in a regexp to differentiate the
record types and event types, it's simply:
while (<YOURFILE>)
{
if (/^Header 1/)
{
#process header 1
}
elsif (/^Header 2/)
{
#process header 2
}
# etc....
else
{
die "Unknown record type!\n"
}
}
g
[...]
--
Glauber Ribeiro
theglauber@my-deja.com
"Opinions stated are my own and not representative of Experian"
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 31 Aug 1999 10:23:53 -0400
From: Bob Freedman <bob.freedman@eis.noaa.gov>
Subject: LWP::Simple GET ???
Message-Id: <37CBE579.C76283CB@eis.noaa.gov>
When using LWP::Simple GET is there a way to time-out the retrevial of
the html document?
I' trying to eliminate waiting for the slowest HTML doc to return before
processing all the others and would like to kiil the get command after a
certain time.
Thanks for any help.
------------------------------
Date: Tue, 31 Aug 1999 16:30:06 +0200
From: cw@dwc.ch
Subject: Re: newbie : POST
Message-Id: <37CBE6EE.8AF82680@dwc.ch>
Sebastian wrote:
>
> my questions:
>
> 0- Is it possible to POST data from one script to another ?
> 1- Is it possible to POST data to a page and load it in the browser without
> user intervention ?
No problem - check out LWP::UserAgent
> 2- Am I a terrible english-speaker? YES.
No, quello non e vero. C'erano gia messaggi molto piu bruti :)
-w
------------------------------
Date: Sun, 29 Aug 1999 12:47:58 -0500
From: Dan Baker <dtbaker_@busprod.com>
Subject: Re: Obtaining Values from Mulitple Selects
Message-Id: <37C9724E.7B9104E2@busprod.com>
pete@pcrev.com wrote:
>
> Hi, I have a form with a multiple select which is used to put data into
> a perl script. How do i get the values (I need both the text, and the
> value of each selected entry) and use them in my CGI script?
> please email me at pete@pcrev.com if you can help, thanks a lot.
------------
perldoc CGI.pm
Dan
------------------------------
Date: Tue, 31 Aug 1999 09:31:30 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Perl a Black Sheep?
Message-Id: <FHBp4I.194@csc.liv.ac.uk>
In article <37C74FCC.84B2420E@erols.com>,
"Matthew O. Persico" <mpersico@erols.com> writes:
> Ala Qumsieh wrote:
> It's got nothing to do with age per-se. I'm 34. I've been doing 'C' since
> 17. I've been doing Perl since 33. Guess which one I love more (clue: this
> is comp.lang.PERL.misc).
I couldn't agree more Mathew. I learnt Perl last year (still learning) but
it felt like comming home. This is really strange because I had been away
from programming for 10 years or more. However I think it's due to having
learnt on a 380Z when it first became possible for schools to afford
computers.
BTW I too am 34. Like you go on to say it's all in the mindset.
> It has to do with open-mindedness though,
> admittedly, older does tend to be less open minded. It has more to do with
> whether you are a programmer/coder versus scientist/hacker. The former
> applies lessons in college to problem at hand and goes home at 5. The
> latter tinker till 3am with code just for kicks. The former see no reason
> to change. For the latter is it raison-d'atre.
True. And I thought it was just me that did 3am gigs for the fun of it :-)
--
Ian J. Garlick
ijg@csc.liv.ac.uk
Truly great madness can not be achieved without significant
intelligence.
-- Henrik Tikkanen
------------------------------
Date: Tue, 31 Aug 1999 14:44:25 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Perl consuming 100% CPU on WinNT
Message-Id: <37cef734.18862623@news>
On Tue, 31 Aug 1999 08:27:09 -0400, Sushant Gargya
<sushant@hindustan.vnet.net> wrote:
> I work for a small company that does E-commerce. Most of
> the package is written in Perl. We are using the latest perl
> executables and the necessary modules. Despite of that I
> see perl using 100% of cpu on NT. This creates side affects
> such as the Microsoft IIS 4.0 not able to respond to http
> request in time as all the cpu cycles have been hogged by perl.
> I can look at the taskmgr and see the "perl.exe" taking up all
> the cycles. For test purposes I even created some extremely
> trivial perl scripts which seem to have similar behavior.
I'm not sure, but could it be that every time a request for a Perl
script comes in, the Perl interpreter is started anew and therefore
uses all of the CPU?
If so, you could look at ActiveState's PerlEx, which is a way of
binding the Perl interpreter tighter to IIS, so it doesn't start
afresh for each request. http://www.activestate.com/plex/. Supposedly;
I've only read about it, but haven't actually played around with it.
HTH
Marcel
Perl Padawan
--
sub AUTOLOAD{($_=$AUTOLOAD)=~s,^.*::,,;y,_, ,;print} Just_Another_Perl_Hacker();
------------------------------
Date: Sun, 29 Aug 1999 12:46:48 -0500
From: Dan Baker <dtbaker_@busprod.com>
Subject: Re: Perl on PalmPilot
Message-Id: <37C97208.9C4E4AD9@busprod.com>
Asquith wrote:
>
> I thought that I heard somewhere that we can run Perl on PalmPilots. Could
> someone point me in the proper direction? If I can run Perl, what
> limitations are imposed?
----------
I dunno where you heard that.... if you find a windowsCE port, please
post!
The only free scripting language I've found there is a new one called
REBOL, which is pretty interesting, new, but not real standard. I think
python is available?!
Dan
------------------------------
Date: Tue, 31 Aug 1999 10:21:16 -0400
From: "Ken Hirsch" <kenhirsch@myself.com>
Subject: Re: Perl.exe has an interpreted mode?
Message-Id: <7qgofr$iov$1@holly.prod.itd.earthlink.net>
revjack <revjack@radix.net> wrote:
> Martien Verbruggen explains it all:
> :In article <7q528s$t6a$1@news1.radix.net>,
> : revjack <revjack@radix.net> writes:
> :> I noted that "perl.exe" was cited, and MS software was used to post the
> :> article, so I presumed an MS OS. Ctrl-Z exits perl.exe on those systems
> :> without running the program; Ctrl-D submits the program and runs it.
>
> :On NT both ^D and ^Z will end the input for perl, but they do need to
> :be followed by a return, which is slightly unnatural behaviour. ^Z is
> :the normal EOF for NT and other MS products. I suspect the allowance
> :of ^D and ^Z both is programmed as opposed to a shell thing. But I
> :might be wrong.
>
> That's true for NT, thank you for the clarification.
>
> Under Win98, ^D runs the input, ^Z exits without running.
>
> I don't know what happens under Win95.
>
> I recommend that users of any Windows-based perl use ^D.
On my Win98 system ^D does not terminate input, it is read as a normal
character. ^Z does terminate input (no carriage return is needed). I am
curious as to why your system behaves differently.
Because of a bug (apparently in ActivePerl), the first line of output is not
displayed after you do the ^Z.
I am using binary Build 518 (perl 5.005_03).
Try this from a DOS prompt under Win98:
#!perl -w
print "start\n";
while (<>) {
print;
}
print "This line is not displayed\n";
print "However, this line is displayed\n";
------------------------------
Date: Tue, 31 Aug 1999 14:47:28 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Problem with <!--exec cgi="/scripts/script.pl"--> in IIS4
Message-Id: <4WRy3.42$xa4.439@news.colt.net>
Lisa McNally <lisa_mcnally@mail.crc.com> wrote:
> Hi -
> the digits are displayed). However if I use the "<!--exec
> cgi="/server/script.pl"-->" from within a HTML document nothing happens. I
> am running IIS 4 on an NT 4.0 SP 5 server. The script ran fine before we
> upgraded the server from IIS 3. Any ideas?? This one really has me baffled.
Server Side Includes, also known as SSI, seem to have been turned off as a
side effect of your upgrade. Read the IIS documentation and turn them back
on.
FYI this is not a question about Perl, it is a question about IIS.
------------------------------
Date: 31 Aug 1999 09:13:00 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Request for Comments: www.perl.com
Message-Id: <slrn7snoss.a54.abigail@alexandra.delanet.com>
Chris Nandor (pudge@pobox.com) wrote on MMCXCI September MCMXCIII in
<URL:news:pudge-3108990747480001@192.168.0.16>:
"" In article <37cb996d.316544757@news.insnet.net>, NukeEmUp@ThePentagon.com
"" (David Cantrell) wrote:
""
"" # Private news servers are a Bad Idea, as many commonly used news
"" # clients are a right pain in the backside to configure for using more
"" # than one server
""
"" So a company that does not allow access to an external news server anyway
"" should use this as a reason not to set up a private news server
"" internally? Silliness.
Exactly how many servers are clients in such a company going to connect to?
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== 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: Tue, 31 Aug 1999 14:09:39 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: ROUNDING NUMBERS -- HELP ME
Message-Id: <37ccefad.16935972@news>
On Mon, 30 Aug 1999 11:21:48 -0500, Tom Briles <sariq@texas.net>
wrote:
> Sharif Aly wrote:
> >
> > I need to round integers off to 2 decimal places.
>
> Must be 'The New Math'.
# only works if you pass an integer as a parameter
sub roundint { "$_[0].00" };
# For example:
print roundint(9);
Marcel
Perl Padawan
--
sub AUTOLOAD{($_=$AUTOLOAD)=~s,^.*::,,;y,_, ,;print} Just_Another_Perl_Hacker();
------------------------------
Date: Tue, 31 Aug 1999 14:25:44 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: sending mail through perl on IIS 4.0
Message-Id: <37cdf211.17547211@news>
On Mon, 30 Aug 1999 21:09:57 GMT, Justin Centanni
<centja1@nich-academic.nich.edu> wrote:
> my team is in the middle of converting a website from a Unix box to an
> NT machine running Internet Information Server 4.0. My problem is that
> although i have perl running the scripts correctly and the SMTP service
> on IIS setup and working, i can't get the two to talk to each other on
> a script that needs to send email from a form.
You could use MIME::Lite.
If you have an HTML form like this:
<form method="POST" action="/cgi-bin/mailform.pl">
<input type="hidden" name="from" value="mailform@xxx.com">
<input type="hidden" name="to" value="techsupport@xxx.com">
<input type="hidden" name="subject" value="Site Feedback">
<input type="hidden" name="redirect" value="/feedback_confirm.htm">
...
</form>
then you could use a script like this:
#!/usr/local/bin/perl
use CGI::Carp qw/fatalsToBrowser/;
use CGI qw/:standard/;
use MIME::Lite;
if (!param('to')) {
print "No recipient specified.";
return;
}
my ($body, @uploads);
foreach (param) {
next if /^(from|to|subject|submit|redirect|required|error)$/;
if (uploadInfo(param($_))) {
push @uploads, $_
} else {
$body .= "$_: " . param($_) . "\n";
}
}
my $from = param('from') || 'mailform@xxx.com';
my $subject = param('subject') || 'mailform-generated message';
if (@uploads) {
# Create a multipart message
$msg = new MIME::Lite
From => $from,
To => param('to'),
Subject => $subject,
Type => 'multipart/mixed';
# Add parts (each "attach" has same arguments as "new"):
attach $msg
Type => 'TEXT',
Data => $body;
foreach (@uploads) {
my ($contents, $filename, $data);
my $file = param($_);
$filename = $2 if $file =~ m#(.*[\\/])?(.*)#;
$filename ||= 'file';
while (read($file,$data,1024)) { $contents .= $data; }
attach $msg
Type =>'BINARY',
Encoding =>'base64',
Data =>$contents,
Filename =>$filename;
}
} else {
# Create a multipart message
$msg = new MIME::Lite
From => $from,
To => param('to'),
Subject => $subject,
Type => 'text/plain',
Data => $body;
}
MIME::Lite->send('smtp', '192.168.10.1', Timeout=>60);
$msg->send || die "You don't have mail!";
if (param('redirect')) {
print redirect(param('redirect'));
} else {
print header, start_html("mailform"), h1("mailform"), "Your
message has been sent.", end_html;
}
Notes:
- The documentations for CGI.pm and MIME::Lite will tell you what's
going on here
- You need to put the IP address of your SMTP server in the line that
reads
MIME::Lite->send('smtp', '192.168.10.1', Timeout=>60);
I prefer a pure Perl solution over using CDONTS, as ASP doesn't know
how to handle uploads, which means you can't send attachments. To do
that you would have to install the Microsoft Posting Acceptor and so
on. To avoid the mess, I've written this little script.
HTH
Marcel
Perl Padawan
--
sub AUTOLOAD{($_=$AUTOLOAD)=~s,^.*::,,;y,_, ,;print} Just_Another_Perl_Hacker();
------------------------------
Date: Tue, 31 Aug 1999 11:42:41 -0400
From: "Philip M. Cohen" <lit280@us.ibm.com>
Subject: Re: STDIN, Arrays and Win32
Message-Id: <37CBF7F0.9084CE1F@us.ibm.com>
elephant wrote:
> other people have said that ^D is actually the EOF character on Win95 ..
> if you're in the experimentation mood - perhaps you could try using ^D
> as the termination character in both the "copy con" and in the STDIN
> input to perl
At least on my system, ^D is just another character; it just puts a diamond
character into the file (with copy con) or Perl STDIN array. Only ^C
(kill) and ^Z (EOF) terminate anything; everything else just seems to
stick a character into the file, unprintable in the case of ^F ^H ^I ^J ^M ^P.
(I dunno about ^F; it doesn't make a BEL sound, though.)
Always carry a grapefruit, Philip M. Cohen
------------------------------
Date: 31 Aug 1999 15:11:59 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: System command runs from command line, not from browser.
Message-Id: <37CBEFC3.EDF2C9B8@vpservices.com>
rocknclint@my-deja.com wrote:
>
> [snip comments]
>
> Following code works from the command line, not when run from browser:
>
> #!/usr/local/bin/perl -w
>
> [snip code which does stuff but doesn't print anything]
>
> print "<html>";
Try reading the perlfaq9 section whose title is almost identical to your
subject line ("My CGI script runs from the command line, but not from
the browser").
You have committed the world's most common cgi script error. Hint: how
does the browser know what content-type your script is outputting? The
answer has to do with a required part of the cgi protocol that your
script is not telling your browser and has nothing to do with the Perl
syntax of your script, so if you can't figure the answer out from the
FAQs, ask in a newsgroup related to cgi.
--
Jeff
------------------------------
Date: 31 Aug 1999 09:15:54 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Testing files on cd-rom?
Message-Id: <slrn7snp29.a54.abigail@alexandra.delanet.com>
Thomas Weholt (thomas@bibsyst.no) wrote on MMCXCI September MCMXCIII in
<URL:news:37CB7BD2.FAA9A306@bibsyst.no>:
<> Lauren Smith wrote:
<> > How would you know whether a file is corrupt or not?
<>
<> Perhaps I`ve should have said something like "readable" etc. What I mean
<> is not to check for valid file-content, but simply to check if the file
<> can be read from the disc. What I want to avoid is to have to copy all
<> files to the harddrive. I`m looking for a function/method that reads
<> each file into /dev/null or similar, just reading all available data
<> from each available file.
There isn't a magical flag that is set that will tell you there's
a bad spot on the disk; at least, not untill you found it.
To know for sure you can read all the files, you have to read all
the files. It's like painting a wall, you will have to paint each
and every spot, you can just paint the sides, or some other subset
to paint the entire wall.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\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: Tue, 31 Aug 1999 10:14:41 -0400
From: Sam Alexander <saminma@yahoo.com>
Subject: Re: Using grep to match complete words
Message-Id: <37CBE351.55F0C58D@yahoo.com>
grep " $i " uniquewords
Notice how I have the space before and after what I'm grepping for.
Will this work?
Or, if your list of words is a file with each word on a separate line,
this would work:
grep "$i " uniquewords.
In short, try using spaces.
Sam
Larry James wrote:
>
> I have a grep script to check for the presents of a word in a list
> of words. My problem is that if the current word is "hello" and the
> list has a word "hello2" because "hello2" has "hello" included, this
> will show up as found.
> My script goes as:
>
> ---------------
> for i in wordlist
> do
> if [ ! "`grep $i uniquewords`" ]
> then
> echo adding $i...
> echo $i >>uniquewords
> fi
> done
> ---------------
>
> Thanks in advance for any suggestions or comments.
>
> -- L. James
>
> --
> ______________________________________________________________________
> Apollo III Communications (Buffalo's First ISP) Larry James
> 716_896_0738 Office 716_896_0766 Fax Consultant/Programmer
> http://www.apollo3.com/~ljames ljames@apollo3.com Buffalo, New York
------------------------------
Date: 31 Aug 1999 15:04:22 GMT
From: craigl@rimpoche.chi.il.us
Subject: Re: Using grep to match complete words
Message-Id: <7qgqtm$7af$1@eve.enteract.com>
In comp.unix.programmer Larry James <ljames@apollo.apollo3.com> wrote:
> I have a grep script to check for the presents of a word in a list
> of words. My problem is that if the current word is "hello" and the
> list has a word "hello2" because "hello2" has "hello" included, this
> will show up as found.
> My script goes as:
> ---------------
> for i in wordlist
> do
> if [ ! "`grep $i uniquewords`" ]
> then
> echo adding $i...
> echo $i >>uniquewords
> fi
> done
> ---------------
Grep understands word boundaries. The ``-w'' option to grep causes
it to only match entire words. From the GNU grep man page:
-w, --word-regexp
Select only those lines containing matches that
form whole words. The test is that the matching
substring must either be at the beginning of the
line, or preceded by a non-word constituent charac-
ter. Similarly, it must be either at the end of
the line or followed by a non-word constituent
character. Word-constituent characters are let-
ters, digits, and the underscore.
The loop isn't necessary, since grep will happily search for
multiple patterns. One way is to place each word in a file
on a line by itself and then use ``grep -f file files_to_search''
Regards,
Craig
------------------------------
Date: Tue, 31 Aug 1999 11:29:09 -0400
From: "Ben Gunter" <bgunter@bsat.com>
Subject: Re: Using grep to match complete words
Message-Id: <7qgsos$n6e$1@iocextnews.bls.com>
You could also use "grep '\byourword\b'".
It looks like you're trying to get one instance of each word in a list. If
that's what you want, you could try this too:
for i in $wordlist; do echo $i; done | sort | uniq > uniquewords;
If you really want them printed to the screen, too, you can change it to:
for i in $wordlist; do echo $i; done | sort | uniq | tee uniquewords;
Hope this helps.
-Ben
craigl@rimpoche.chi.il.us wrote in message
<7qgqtm$7af$1@eve.enteract.com>...
>In comp.unix.programmer Larry James <ljames@apollo.apollo3.com> wrote:
>> I have a grep script to check for the presents of a word in a list
>> of words. My problem is that if the current word is "hello" and the
>> list has a word "hello2" because "hello2" has "hello" included, this
>> will show up as found.
>> My script goes as:
>
>> ---------------
>> for i in wordlist
>> do
>> if [ ! "`grep $i uniquewords`" ]
>> then
>> echo adding $i...
>> echo $i >>uniquewords
>> fi
>> done
>> ---------------
>
>Grep understands word boundaries. The ``-w'' option to grep causes
>it to only match entire words. From the GNU grep man page:
> -w, --word-regexp
> Select only those lines containing matches that
> form whole words. The test is that the matching
> substring must either be at the beginning of the
> line, or preceded by a non-word constituent charac-
> ter. Similarly, it must be either at the end of
> the line or followed by a non-word constituent
> character. Word-constituent characters are let-
> ters, digits, and the underscore.
>
>The loop isn't necessary, since grep will happily search for
>multiple patterns. One way is to place each word in a file
>on a line by itself and then use ``grep -f file files_to_search''
>
>Regards,
>
>Craig
------------------------------
Date: Tue, 31 Aug 1999 12:01:33 -0400
From: kenn <kenn@nacs.net>
Subject: using the exec command.
Message-Id: <37CBFC5D.67F9B4AE@nacs.net>
I am trying ot wrie a perl script to unsubscribe folks from our
mailing list and am having trouble wiht the exec command. here is the
code.
------------------snip---------------------------------------------------
#!/usr/bin/perl
print "Please enter the name of the user you wanna remove?\n";
print "Username: ";
$user = <STDIN>;
chomp($user);
exec 'echo "unsubscribe nacs-announce" | /usr/lib/sendmail -f
$user\@nacs.net majrdomo\@nacs.net\n';
print "$user has been unsuscribed from NACS mailing lists.\n";
------------------snip---------------------------------------------------
exec seems to execute the command. and I know that hte sendmail stuff is
right, not that I'm a sendmail guru, it's just sendmail 101. However it
doesn't work. I don't see anything I need to escape in the string I want
to exec. (well the @'s of course.)
Here is the error.
/usr/lib/sendmail: option requires an argument -- f
sh: @nacs.net: command not found
hmm? any suggestions?
------------------------------
Date: Tue, 31 Aug 1999 10:09:01 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: Why doesn't my undef an array?
Message-Id: <37CBE1FD.AEDD151D@mathworks.com>
perldoc -f defined was helpful in this case. You may want to take a
look.
<EXCERPT>
Currently, using defined() on an entire array or hash reports whether
memory for that aggregate has ever been allocated. So an array you set
to the empty list appears undefined initially, and one that once was
full
and that you then set to the empty list still appears defined. You
should instead use a simple test for size:
if (@an_array) { print "has array elements\n" }
if (%a_hash) { print "has hash members\n" }
Using undef() on these, however, does clear their memory and then report
them as not defined anymore, but you shoudln't do that unless you don't
plan to use them again, because it saves time when you load them up
again to have memory already ready to be filled.
This counterintuitive behaviour of defined() on aggregates may be
changed, fixed, or broken in a future release of Perl.
</EXCERPT>
Ian Smith wrote:
> I ran into a situation in Perl that I don't understand. Take the
> following code...
>
> #!/usr/local/bin/perl5 -w
> use strict;
> sub test {
> my $yn = shift;
> my @array;
> @array = ( 'A','B','C','D' ) if $yn;
> print "$yn : $array[2]\n" if defined @array;
> }
> test(0); test(1); test(0);
>
> This results in...
>
> 1 : C
> Use of uninitialized value at ./p line 10.
> 0 :
>
> Why does @array stay defined forever once it is set? The
> same thing happens if I use a hash instead.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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.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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 V9 Issue 687
*************************************