[8825] in Perl-Users-Digest
Perl-Users Digest, Issue: 2442 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 28 14:07:46 1998
Date: Tue, 28 Apr 98 11:00:48 -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 Tue, 28 Apr 1998 Volume: 8 Number: 2442
Today's topics:
Re: ANNOUNCE: Perl Builder IDE Now Available <rootbeer@teleport.com>
Re: Defending Perl <tchrist@mox.perl.com>
Re: Defending Perl <grinch@whoville.com>
Re: Getting the filehandle from a typeglob <fecund@fatnet.net>
Re: Getting the filehandle from a typeglob <tchrist@mox.perl.com>
Re: help for beginer .. <rootbeer@teleport.com>
Help with Win32::Registry:: how to set REG_BINARY key t <kairys@mi.sl.com>
Re: How do you make delay program? otis@POPULUS.net
Re: How to edit a file most efficiently? <tchrist@mox.perl.com>
Re: How to read command line literally? <kairys@mi.sl.com>
Re: http Reg Exp (brian d foy)
Re: http Reg Exp (brian d foy)
me again: snprint() question <fil@amnh.org>
Re: message board question (brian d foy)
Re: message board question <rootbeer@teleport.com>
Re: Mutliple emails (brian d foy)
New Index maker on your web site! <laberov@macs.biu.ac.il>
Re: Opening another browser (brian d foy)
Re: Perl/Wall lingo question (brian d foy)
Re: Permutations in hashes make Perl hurt (Mark-Jason Dominus)
Re: Permutations in hashes make Perl hurt (Mark-Jason Dominus)
Re: Radio buttons and check boxes (brian d foy)
Re: Radio buttons and check boxes <Rosie@dozyrosy.demon.co.uk>
rename funciton (was: Re: Dummie question) <rootbeer@teleport.com>
Re: Submit <rootbeer@teleport.com>
Re: Text file transfers between OS's <jim.michael@gecm.com>
Re: using perl as a script <rootbeer@teleport.com>
Re: using perl as a script (brian d foy)
While Loop Gets Skipped <rxruck2@uswest.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 28 Apr 1998 17:44:25 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Marty Ford <perl@solutionsoft.com>
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <Pine.GSO.3.96.980428104024.15049M-100000@user2.teleport.com>
On Mon, 27 Apr 1998, Marty Ford wrote:
> Key features include:
>
> * Integrated Editor/Debugger with color syntax
> highlighting,
Of course, there's no way to always get the colors correct unless you have
an error-proof way of parsing Perl - which no one has yet invented. :-)
> breakpoints, single step, watches,
> and "tool tip" variable inspection.
I don't know what that last is, but you can do all those others through
the Perl debugger already.
> * CGI Simulation lets you test and debug CGI scripts
> right on the Windows 95/NT desktop. Script output, such
> as dynamic HTML and email messages, can be examined visually.
> No webserver is required.
That's something that the standard Perl distribution can do, although it
works on more platforms. :-)
> * Supports both CGI and general purpose (non-CGI) Perl
> development.
This is like saying, "This car can drive to both kinds of destinations,
pizza restaurants and other places." :-)
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 28 Apr 1998 16:59:10 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Defending Perl
Message-Id: <6i51su$51t$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
abigail@fnx.com writes:
:I dunno about you, but I generally download software for the sake
:of using it, not to get a kick out of compiling it.
Well, Configure has special and perhaps unique appeal.
The "I spell a Eunice" stuff is terribly funny (see Wumpus).
The source code his a hoot. (== hilarious)
:I *do* want to install Perl, but I have to run Configure to get
:it installed right.
With Configure (as opposed to configure), installation on er,
interestingly configured systems is at least possible. Without it,
this would be impossible. I know which I prefer. :-)
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
I don't believe it's written in Perl, though it probably
ought to have been. :-)
--Larry Wall in <1995Feb21.180249.25507@netlabs.com>
------------------------------
Date: Tue, 28 Apr 1998 13:16:02 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: Defending Perl
Message-Id: <6i51v8$4ej@fridge.shore.net>
Ilya Zakharevich wrote in message
<6i3nof$5ek$1@mathserv.mps.ohio-state.edu>...
><abigail@fnx.com>],
>who wrote in article <6i3iur$ltl$2@client3.news.psi.net>:
>> That doesn't work in my case; that is, if I want to make it pass the
>> make install stage.
>
>Abigail, what happened to you? If you do not want `make install', do
>not type it.
>
>Or did I misparse what you said?
Not to put words in her mouth, but I think Abigail meant pass as in
"succeed," not as in "skip"...
FWIW, 5.003 was a BEAR to compile on Solaris w/GCC & dynamic linking.
Fortunately, a lot of people had tried it before I did, and I was able to
find help using DejaNews. Even more fortunate, the fixes that were discussed
were apparently incorporated into the 5.004 configure script, because the
hints worked for that one.
If you're having trouble parsing the Q&A during the Perl installation, the
"Porting UNIX Software" book from O'Reilly (who else?) discusses many of the
issues that it asks about. It may or may not have the specific answers you
need for your particular platform, but at least you'll understand the
questions a bit better... :-)
-grinch
--
-----
"Yes, I'm paranoid, but that doesn't mean
no one's out to get me." - me
Sherm Pendley
grinch@whoville.com
http://www.whoville.com
------------------------------
Date: Tue, 28 Apr 1998 09:41:57 -0700
From: "yary h." <fecund@fatnet.net>
Subject: Re: Getting the filehandle from a typeglob
Message-Id: <354606D5.6356@fatnet.net>
Oh Drats.
I just realized that the method I posted returns the same filehandle
over and over.
Any suggestions? (as I go back to the drawing board...)
-yary
------------------------------
Date: 28 Apr 1998 17:30:05 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Getting the filehandle from a typeglob
Message-Id: <6i53mt$7np$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"yary h." <fecund@fatnet.net> writes:
:I just realized that the method I posted returns the same filehandle
:over and over.
:
:Any suggestions? (as I go back to the drawing board...)
I'm not really sure what the trouble is:
sub open_it {
local *FH;
my $file = shift;
$file =~ s#^(\s)#./$1#;
return open(FH, "< $file\0") && *FH;
}
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
There's going to be no serious problem after this. --Ken Thompson
------------------------------
Date: Tue, 28 Apr 1998 17:54:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Steve Hardy <steve.hardy@wipo.int>
Subject: Re: help for beginer ..
Message-Id: <Pine.GSO.3.96.980428105228.15049P-100000@user2.teleport.com>
On Tue, 28 Apr 1998, Steve Hardy wrote:
> I'm a beginer I know how to create html tag but now I want to start
> creating forms on my inet page. I've seen a lot of pgm in CGI and Perl
> but I dont understand the difference.
Perl: A programming language.
HTML: A markup language.
CGI: The common gateway interface between webservers and a program.
> Please give me advice on how I should procede to be able to create forms
> for my home page.
Learn about HTML and programming. If you wish to write your programs in
Perl, learn that. Then study the common gateway interface, or use a Perl
module which implements it.
> Where I could find the references...
Start with the FAQs and go from there. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 28 Apr 1998 08:14:42 -0400
From: "Michael Kairys" <kairys@mi.sl.com>
Subject: Help with Win32::Registry:: how to set REG_BINARY key to nothing??
Message-Id: <3545d44e.0@news.ic.net>
How do I set a REG_BINARY key to nothing (i.e. "zero-length binary value")?
If you're curious, I'm trying to write a script that will go through my
MenuOrder keys and clear out the Order values. (Anyone wanting to know why I
want to do that may e-mail me :-)
I'm calling $key->SetValueEx( "Order", NULL, REG_BINARY, $value ) with
various flavors of $value and watching in RegEdit to see what happens, and I
can't find a way to clear the value, except $key->SetValueEx( "Order", NULL,
REG_BINARY, undef ), which makes me nervous and makes Perl warn "Use of
uninitialized value at ...lib\site/Win32/Registry.pm line 292 "
Looking at the code (registry.xs out of Libwin32) I find:
case REG_BINARY:
buffer = SvPV(data, size);
if (type != REG_BINARY)
size++; /* include null terminator in size */
RETVAL = SUCCESS(RegSetValueEx(hkey,valname,0,type,
(PBYTE) buffer, size));
break;
This is what led me to try undef; somehow I want size to end up zero.
Can anyone suggest a cleaner way to do this than the above?
------------------------------
Date: Tue, 28 Apr 1998 12:10:24 -0600
From: otis@POPULUS.net
Subject: Re: How do you make delay program?
Message-Id: <6i52i3$p3m$1@nnrp1.dejanews.com>
sleep(N) where N is the number in seconds.
But do check those man pages or www.dejanews.com before posting, please.
Otis
P.S.
to the person who replied to this - it also takes less time to just give the
right answer.
In article <35453BFB.4D27@juicepigs.com>,
Bob Trieger <sowmaster@juicepigs.com> wrote:
>
> Seong Y. Kim wrote:
> >
> > This would delay my program for a while
> >
> > for ($a=0; $a<100000;$a++){;}
> >
> > Does anyone know how to make delay without running loops?
> > Is there any delay modules or subroutines like delay(10000) in C
> > language?
>
> When looking for a funtion in perl, it usually helps to search
> perlfunc.html which was included with your perl distribution. In the
> case of "delay" I turned up 2 functions in less than 10 seconds. Which
> is a lot less time consuming than posting to c.l.p.m and waiting for a
> sarcastic reply.
>
> If you installed the standard port of perl for win32 without changing
> any paths you can find perlfunc.html at
> file://c:/perl/html/lib/pod/perlfunc.html . Once you load that page, do
> cntl-f to search it.
>
> HTH
>
> --
> Bob Trieger | Titanic: big boat, bigger
> sowmaster@juicepigs.com | iceberg, big deal
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 28 Apr 1998 17:22:47 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to edit a file most efficiently?
Message-Id: <6i5397$7np$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Yong Huang <yong@shell.com> writes:
:But this opens two files and does a rename. I suspect this won't be very
:efficient. Is there a better way? Thanks for any advice.
No, that *is* the best way!
See perlfaq5, question 2.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"If you only have a nail, you tend to see every hammer as a problem."
--Larry Wall
------------------------------
Date: Tue, 28 Apr 1998 08:01:12 -0400
From: "Michael Kairys" <kairys@mi.sl.com>
Subject: Re: How to read command line literally?
Message-Id: <3545d125.0@news.ic.net>
>>:ARGV expands into all the .txt files. I want $ARGV[0] =
>>:"*.txt". How can I do that ?
Note that, as has been discussed in several recent threads in this group,
the ActiveState Win32 Perl performs automatic filename globbing on the
command line but the standard distributution does not. So one answer to the
above question is "use the standard distribution".
------------------------------
Date: Tue, 28 Apr 1998 13:17:46 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: http Reg Exp
Message-Id: <comdog-ya02408000R2804981317460001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6i3et4$f2r$4@comdyn.comdyn.com.au>, mgjv@comdyn.com.au (Martien Verbruggen) posted:
>In article <6i3cu0$jmp$4@client3.news.psi.net>,
> abigail@fnx.com (Abigail) writes:
>> RFC translates easily into a regex.
>> See <URL:http://cthulhu.mandrake.net/%7Eabigail/Perl/url2.pl>
>
>Indeed, The RFC can be translated into a regex, but that still doesn't
>make the original problem possible; Extract URLs from some plain text
>If you hadn't conveniently snipped the examples I put in my post, you
>would have known what I meant. How do you extract the following URLs?
>
>URL1: http://myserver.com/dir/file.
>URL2: http://myserver.com/dir/file
>
>(note the minimal difference?)
i would think that from a purist standpoint you'd have to follow the
RFCs to the letter (which is probably what Abigail does :) and write
the URLs as
yadda yadda <URL:http://myserver.com/dir/file> yadda
extracting URLs not written according to the RFC is, of course, much
more difficult to deal with, but then so is everything not done the
way it should be :).
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Tue, 28 Apr 1998 13:20:28 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: http Reg Exp
Message-Id: <comdog-ya02408000R2804981320280001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6i3ofp$g0l$1@comdyn.comdyn.com.au>, mgjv@comdyn.com.au (Martien Verbruggen) posted:
>In article <354346F0.CCC9CA0@cglis.com>,
> Chris Lambrou <archive@cglis.com> writes:
>
>> $msg =~ s!(ftp|https?)://([^\s]+)!<a href="$1://$2">$1://$2<\/a>!gsi;
>
>You might want to have a look at
>http://language.perl.com/all_about/regexps.html
>(search for 'urlify').
>
>This does a pretty good job in the assumptions it makes about what is
>part of a URL and what isn't.
i like Tom's regex, but i would also recommend URI::URL once one has
extracted the URL from whatever mess it came out of. if it's coming
out of HTML, HTML::Parser makes a really good link extractor :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 28 Apr 1998 13:13:59 -0400
From: Fil Krohnengold <fil@amnh.org>
Subject: me again: snprint() question
Message-Id: <ehpvi1oomg.fsf@hammond.amnh.org>
[compiling perl5.004_04 (or perl5.004_03) on Solaris 2.5]
I hate to sound desperate - but I'm doing that pattented sysadm dance
which involves placing forehead prints on the nearest wall.
I'll phrase my question another way: Why would perl be looking for a
function snprintf() if it's not referenced in a) any source code in the
perl src tree or b) stdio.h.
the excerpt from make test:
lib/db-btree......Can't load '../lib/auto/DB_File/DB_File.so' for module DB_File
: ld.so.1: ./perl: fatal: relocation error: symbol not found: snprintf: referenc
ed in ../lib/auto/DB_File/DB_File.so at ../lib/DynaLoader.pm line 166.
at ./lib/db-btree.t line 12
BEGIN failed--compilation aborted at ./lib/db-btree.t line 12.
FAILED at test 0
with simmilar errors for db-hash and db-recno.
help?
-fil
___________________________________________________________________________
Fil Krohnengold | UNIX Systems Administrator, Network Systems
fil@amnh.org | The American Museum of Natural History
212/769-5294 | CPW @ 79thSt / NY, New York / 10024
------------------------------
Date: Tue, 28 Apr 1998 13:40:56 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: message board question
Message-Id: <comdog-ya02408000R2804981340560001@news.panix.com>
Keywords: from just another new york perl hacker
In article <35457F7B.5ADEE0C2@idkconsulting.com>, Matthew Wheeler <idk@idkconsulting.com> posted:
>I have no clue of how to use newsgroups, so if this messes up, I
>apologize. I'm just pretty desperate for help here.
>We have uploaded the wwwboard.pl and associated files from Matt's
>Scripts
>If you wish for me to send you the wwwboard.pl file, I will. Nobody has
>yet replied to our plea. I hope you can. Thanks.
welcome to the nightmare that is Matt's Script Archive. too bad Matt
decided not to support his stuff, despite several security risks in
using it.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Tue, 28 Apr 1998 17:47:43 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Matthew Wheeler <idk@idkconsulting.com>
Subject: Re: message board question
Message-Id: <Pine.GSO.3.96.980428104550.15049N-100000@user2.teleport.com>
On Tue, 28 Apr 1998, Matthew Wheeler wrote:
> I have no clue of how to use newsgroups,
Then you should read news.announce.newusers before posting. It's not your
fault that you didn't know this; your ISP should have instructed you.
> We have uploaded the wwwboard.pl and associated files from Matt's
> Scripts and they work pretty well, however, when we go to read the new
> messages, it says that access to read the file is forbidden.
The docs for that script should help you out; if not, perhaps you should
complain to the author.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 28 Apr 1998 13:31:51 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Mutliple emails
Message-Id: <comdog-ya02408000R2804981331510001@news.panix.com>
Keywords: from just another new york perl hacker
In article <3545CB84.8FEBA302@sinfor.it>, "Guy Einy, EPN" <epnguy@sinfor.it> posted:
>I'm trying to write a program that will send email to multiple users.
>It woks fine - it does send the message.
>The problem is that the From:... and Subject:... gets printed in the
>BODY
>of the email rather then in the email headers.
not a Perl thingy, but...
see the man pages for your mailer program to see what you need to do
to be able to specify header lines. some mailer programs have special
command line switches and such to make this possible.
there will be better help in a newsgroup devoted to the mailer that
you are trying to use.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Tue, 28 Apr 1998 20:00:06 +0300
From: igor <laberov@macs.biu.ac.il>
Subject: New Index maker on your web site!
Message-Id: <35460B16.3FB3@macs.biu.ac.il>
This is a multi-part message in MIME format.
--------------506159D646B9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello!
Do you have huge web site with lot of pages on different levels?
Do you want make alphabetic index of pages on your Web server?
Look at : http://www.biu.ac.il/~cs240/Search-Index/ and download.
Please send any comments.
Igor Laberov
--------------506159D646B9
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Base: "http://www.biu.ac.il/~cs240/Search-Ind
ex/"
<BASE HREF="http://www.biu.ac.il/~cs240/Search-Index/">
<html>
<meta words = "Script,Index,WWW,servers,Perl">
<head>
<meta words = "Script,Index,WWW,servers,Perl">
<title>Search-Index - Igor Laberov</title>
</head>
<meta words = "Script,Index,WWW,servers,Perl">
<body bgcolor="#FFFFFF">
<p align="center"><font size="4">Search-Index by </font><a
href="http://www.cs.biu.ac.il/~laberov"><font size="4">Igor Laberov</font></a></p>
<b><p>Design:</p></B>
<blockquote>
<p>Drora Cohen: Head of Scientific Applications Department.<br>
Monik Ashkenazy: Webmaster.</p>
</blockquote>
<p><a href="http://www.biu.ac.il">Bar-Ilan University</a>,
Ramat-Gan,Israel.</p>
<p>Current script was made for creating alphabetic index of pages
on Web server .</p>
<p><br>
<br>
<b>Description:<br></b>
Script works on condition that all pages on Web site were built
as a tree.<br>
Script searches in UNIX tree files such as index.htm(l) and
others that <br>
you configured and searches in the HTML tag <TITLE>. <br>
Search-Index then performs parsing of titles found(see INSTALL),<br>
creates hyperlinks and sorts them.<br>
<br>
######## Search-Index doesn't perform any operations on searched
files!!! #########<br>
<br>
</p>
<p><strong>Features: </strong></p>
<blockquote>
<p><br>
You can configure:<br>
- Paths for excluding. Search-Index will not enter into those
<br>
directories.<br>
- Directory name excluding. All directories that contain
listed <br>
words in their names will not be included.<br>
- Title names parsing. Search-Index can exclude some words <br>
at the beginning of the title, or put them at the end.<br>
Purpose of such parsing is to guarante that the first word in
the <br>
title will be significant<br>
- Files for including. Search-Index always searches on
index.htm(l)<br>
files. You can add other file names.<br>
You can also specify paths for important files to be included<br>
(that are not in the above categories).<br>
- Additional html text that you want to add in the beginning <br>
and at the end of the index.</p>
</blockquote>
<p><br>
For more details see INSTALL.<br>
<br>
<strong>Command line:<br>
</strong>search.pl [path where start search]<br>
if "path where start search" is omitted then
Search-Index will use <br>
$site_path.<br>
<br>
<strong>Output:<br>
</strong>Output goes into standard output.<br>
<br>
</p>
<a href = final.html>See</a> Example Output.<p>
<p>Press <a href="search.tar.gz">here</a> to download.</p>
<p>Please send comments by E-mail:<a href="mailto:laberov@macs.biu.ac.il">laberov@macs.biu.ac.il</a><br>
</p>
<img src = http://students.biu.ac.il:8080/cgi-bin/cs240/script.cgi?URL=search_index>
</body>
</html>
--------------506159D646B9--
------------------------------
Date: Tue, 28 Apr 1998 13:26:57 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Opening another browser
Message-Id: <comdog-ya02408000R2804981326570001@news.panix.com>
Keywords: from just another new york perl hacker
In article <3544ef14.16080045@news.bctel.ca>, reply@silas.hypermart.net posted:
>print "<A href=\"http://u.r.l/\" target=\"_blank\">Some Text</A>";
how about some generalized quoting to make that look nicer?
print qq|<a href="...." target="_blank">Some Text</a>|;
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Tue, 28 Apr 1998 13:37:02 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl/Wall lingo question
Message-Id: <comdog-ya02408000R2804981337020001@news.panix.com>
Keywords: from just another new york perl hacker
In article <m3ogxmie6q.fsf@windlord.Stanford.EDU>, Russ Allbery <rra@stanford.edu> posted:
>RHS Linux User <humbubba@raptor.cqi.com> writes:
>
>> I've been programming for years, and I don't recognize a lot of the
>> terms, in the sense they're used there. e.g. "scalar".
>
>Well, I don't know what else you're wondering about, but a scalar is from
>mathematics and physics and simply refers to a real number (as opposed to
>a vector).
it doesn't have to be a *real* number. :) i tend to think of scalars
as non-composite, or single, thingys, but even that is imprecise.
if the original poster wants to get into the mind of Larry to figure
out how he names things, the poster should read the various articles
about or by Larry (such as the one in a recent Dr. Dobbs).
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 28 Apr 1998 13:43:00 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i54f4$paf$1@monet.op.net>
Keywords: algae ducat moribund replete
I said that Perl's has function is like:
>> for ( ; *s; s++) {
>> hash = hash * 33 + *s;
>> }
In article <6i4sa9$9ph@cello.hpl.hp.com>,
Tom Rokicki <rokicki@cello.hpl.hp.com> wrote:
>Actually, it's something like
>
> hash = strlen(s) ;
> while (*s) hash = hash * 33 + *s ;
I believe you are mistaken. Here's the #define:
#define PERL_HASH(hash,str,len) \
STMT_START { \
register char *s_PeRlHaSh = str; \
register I32 i_PeRlHaSh = len; \
register U32 hash_PeRlHaSh = 0; \
while (i_PeRlHaSh--) \
hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \
(hash) = hash_PeRlHaSh; \
} STMT_END
(Also, you forgot to advance the pointer.)
> hash = strlen(s) ;
> while (*s) hash = *s - hash * 33 ;
>
>might also work much better.
But that is the same as before! (And you forgot the pointer again.)
------------------------------
Date: 28 Apr 1998 13:46:37 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i54lt$pc1$1@monet.op.net>
Keywords: broke reject scription slur
>Mark-Jason Dominus (mjd@op.net) wrote on MDCCI September MCMXCIII in
><URL: news:6i4la8$n5p$1@monet.op.net>:
>++
>++ 5. If Perl had an operator for selecting the number of buckets or the
>++ hash function, you could use it here. Then you could say
>++
>++ number_of_buckets %hash, 33; # Instead of 8
>++
>++ and then your program wouldn't hurt so much.
In article <6i4rdg$2ir$2@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>
>You mean
> keys %hash = 33; # Use at least 33 buckets.
>?
No, I do not mean that. It is important here that we get exactly 33
buckets, not `at least 33'. If you do `keys %hash = 33', you get 64
buckets, which does not solve the problem.
------------------------------
Date: Tue, 28 Apr 1998 13:25:30 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Radio buttons and check boxes
Message-Id: <comdog-ya02408000R2804981325300001@news.panix.com>
Keywords: from just another new york perl hacker
In article <354537F4.B58B1A02@uidaho.edu>, Derek Blandford <blan0416@uidaho.edu> posted:
>> Can someone send me a couple of specimen lines in a perl script that
>> will read a collection of radio buttons and check boxes and relay
>> whether they are selected.
>&ReadParse(*input); # Find a cgi-lib or use one of the Perl
>modules
oy. CGI.pm comes with the standard Perl distribution. use it :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Mon, 27 Apr 1998 22:18:57 +0100
From: Rosemary I H Powell <Rosie@dozyrosy.demon.co.uk>
Subject: Re: Radio buttons and check boxes
Message-Id: <LVg+$hABZPR1Ew1T@dozyrosy.demon.co.uk>
In article <hj08pAAxyLR1EwTj@beegroup.co.uk>, Built Environment
Engineering Group <sales@beegroup.co.uk> writes
>I'm trying to make a perl script gather information from a website
>response form. Using and adapting a script from a Demon tutorial page,
>I can easily gather info from text fields, but nowhere can I find advice
>on how to read radio buttons and check boxes.
>
>Can someone send me a couple of specimen lines in a perl script that
>will read a collection of radio buttons and check boxes and relay
>whether they are selected.
>
>From another Demon user:
Get hold of CGI.pm and use that to read and process all your form data.
Read the documentation; it tells you how to do all this and lots more,
and has plenty of examples. I have it printed out and use it as my
"bible":
print $query->checkbox_group(-name=>'group_name',
-values=>['eenie','meenie','minie','moe'],
-default=>['eenie','moe'],
-linebreak=>'true',
-labels=>\%labels);
When the form is processed, all checked boxes will be returned as
a list under the parameter name 'group_name'. The values of the
"on" checkboxes can be retrieved with:
@turned_on = $query->param('group_name');
Do similar for your radio buttons.
Please note: If you are using cgi-lib.pl, this is an offense punishable
by death or worse in the eyes of this newgroup :-(
Rosemary
-------------------------------------------------------------------
| Rosemary I.H.Powell EMail: Home: rosemary@dozyrosy.demon.co.uk |
| Work: r.i.h.powell@rl.ac.uk |
| http://www.netlink.co.uk/users/dozyrosy/ |
| http://www.dozyrosy.demon.co.uk/ |
-------------------------------------------------------------------
------------------------------
Date: Tue, 28 Apr 1998 17:14:54 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: "yary h." <fecund@fatnet.net>
Subject: rename funciton (was: Re: Dummie question)
Message-Id: <Pine.GSO.3.96.980428101400.15049J-100000@user2.teleport.com>
On Mon, 27 Apr 1998, yary h. wrote:
> It always bothered me that Perl comes with "rename", but not "copy".
Give us a system call which does "copy", and we'll make a Perl built-in
which does so. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 28 Apr 1998 17:33:28 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Mikey Vaughan <mikey@in.net>
Subject: Re: Submit
Message-Id: <Pine.GSO.3.96.980428102438.15049L-100000@user2.teleport.com>
On Tue, 28 Apr 1998, Mikey Vaughan wrote:
> Does somebody have a routine that allows the submit button to be
> executed only once??
Yes. You have the user install a browser which crashes upon clicking the
submit button. :-)
> I have a bunch of people that keep hitting it and sending multiple
> forms. Has someone written a routine to only allow one form to be
> submitted??
Sure. You make a note of what they've sent. When your script sees the
exact same data from the exact same source within (say) 10 seconds, it
responds with a page which says that their request has been cancelled due
to repeated postings, and that they should pause for one minute before
continuing. If they post again within the minute, respond that they need
to pause for five minutes. Be sure to check that the data and source are
exactly the same, so that you don't deny service to everyone using a
certain proxy, for example.
Of course, this technique could be implemented in any language, not just
in Perl. So if you have questions about the technique itself, you could
ask in a newsgroup about CGI programming.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 28 Apr 1998 13:24:05 -0400
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Text file transfers between OS's
Message-Id: <354610B5.16EB@gecm.com>
Mark Schwartz wrote:
> Since I am not inclined to re-type 40 odd pages of scripts all over,
> could someone please tell
> me is there some procedure, or flag/switch that I need to toggle when
> copying text files over
> to a DOS floppy under Linux.
The simple thing to do is to ftp from a dos box to the Linux box and ftp
the files in ascii mode:
ftp myserver.somewhere
myusername
mypassword
cd /my/server/directory
lcd /my/local/directory
prompt
ascii
mget *.html
binary
mget *.jpeg
mget *.gif
bye
Help is available from the ftp prompt: help prompt, etc.
If you can't use ftp for some reason (hmm..) you can read the files in
binmode and translate LF to CR+LF.
perldoc perlfunc
perldoc perlre
perldoc -f binmode
------------------------------
Date: Tue, 28 Apr 1998 17:23:35 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: phillip@javanet.com
Subject: Re: using perl as a script
Message-Id: <Pine.GSO.3.96.980428101927.15049K-100000@user2.teleport.com>
On Mon, 27 Apr 1998 phillip@javanet.com wrote:
> Basically what I was wondering is is it possible to make a perl script
> that runs and ever 3 ours or so (or even several specified times like
> 7:30, 9:00, 12:00 and so on)
Check out cron, or your system's local equivalent.
> to count how many new messages in the mail spool, and then in turn send
> a message to a specified e-mail address formatted like this. "You
> currently have # new messages in your inbox."
You should send the number N+1 to allow for this new message. :-) But you
can check and send mail with the help of modules, which you can find on
CPAN.
http://cpan.perl.org
> Or would I have to use another language such as C or something.
Why should you need C for this? Perl is easily capable of this.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 28 Apr 1998 13:48:04 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: using perl as a script
Message-Id: <comdog-ya02408000R2804981348040001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6i3ldp$85c$1@nnrp1.dejanews.com>, phillip@javanet.com posted:
>Basically what I was wondering is is it possible to make a perl script that
>runs and ever 3 ours or so (or even several specified times like 7:30, 9:00,
>12:00 and so on) to count how many new messages in the mail spool, and then
>in turn send a message to a specified e-mail address formatted like this.
>"You currently have # new messages in your inbox."
Perl has lots of nifty modules to help with such a thing. look into
using the Mail::* modules for munging the mail spool files and such.
just for kicks, here's a quick and dirty script i wrote to help me
grep my mail:
sri[7] cat mailgrep.pl
#!/usr/bin/perl -w
use strict;
use Mail::Folder::Mbox;
my $word = $ARGV[0];
print "Looking for [$word]\n";
my $mailbox = new Mail::Folder('mbox', "$ENV{'HOME'}/mail/read-mail");
print "There are ", $mailbox->last_message, " messages\n";
my $index;
while( $index++ < $mailbox->last_message )
{
my $message = $mailbox->get_message($index);
my $body_ref = $message->body;
my $data = join "\n", @$body_ref;
#print "$data\n";
if( $data =~ /\Q$word\E/o )
{
print "Found [$word] in message [$index]!\n";
my $header = $message->head;
my $from = $header->get('From');
my $date = $header->get('Date');
my $subject = $header->get('Subject');
print "\t$date\t$from\t$subject\n";
}
}
$mailbox->close;
__END__
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Tue, 28 Apr 1998 12:07:04 -0500
From: Ryan Rucker <rxruck2@uswest.com>
Subject: While Loop Gets Skipped
Message-Id: <35460CB8.9A0044BE@uswest.com>
This is a multi-part message in MIME format.
--------------BE0279729F20C730766C85AB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello,
Attached is a (large) snippet of code that I have a question about.
This snippet is part of a much larger script.
My question is this: When I follow this with the debugger, the first
while loop gets skipped, even though all the conditions are true.
Instead, the program will jump right down to the second while loop, it
appears the first while loop isn't even getting evaluated. However, if
I comment out the second while loop, then the first while loop gets
examined.
I've run this with the -w option, but didn't see anything that hinted at
why the while loop would get skipped, and I searched the faq for "while"
but didn't see anything addressing this, and also did a quick read of
Chapter 4 (concerning control statements) in the Llama.
Any help is appreciated.
Ryan
--------------BE0279729F20C730766C85AB
Content-Type: text/plain; charset=us-ascii; name="script.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="script.txt"
if ($actdt_sot <= $end_bday && $actdt_sot >= $begin_bday && $fid_set eq 'ABC') {
print SVCL ($del, $sord_sot, "';\n", $ins, $sord_sot, "','", $ord_stat,
"',", $post_sot, "null,", $due_sot, $acty_txt, "1,", $bill_id, ",", "'", $cust_sot, "');\n");
while ($ord_set == $ord_sot && $splr_set eq $splr_sot && $typ_set eq $typ_sot && $line_sot ne "" && $line_set ne "") {
print SECL ($sord_set, $lnno_set, $actn_set, $qty_set, $fldt_set, $itm_set, $fldd_set, $lind_set, "\n");
$line_set = <SET>;
&set_varbs;
$line_sft = <SFT>;
&sft_varbs;
}
while ($ord_set < $ord_sot || ($ord_set == $ord_sot && $splr_set lt $splr_sot) || ($ord_set == $ord_sot && $splr_set eq $splr_sot && $typ_set lt $typ_sot)
&& $line_sot ne "" && $line_set ne "") {
$line_sft = <SFT>;
&sft_varbs;
}
$line_sot = <SOT>;
&sot_varbs;
} elsif (! ($actdt_sot != $prev_bday) && ($itm_set eq 'ABCDEF' || $itm_set eq 'GHIJKL')) {
print SECL ($sord_set, $lnno_set, $actn_set, $qty_set, $fldt_set, $itm_set, $fldd_set, $lind_set, "\n");
$line_set = <SET>;
&set_varbs;
} else {
$line_sot = <SOT>;
&sot_varbs;
$line_set = <SET>;
&set_varbs;
}
--------------BE0279729F20C730766C85AB--
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". 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 2442
**************************************