[8025] in Perl-Users-Digest
Perl-Users Digest, Issue: 1650 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 15 19:07:20 1998
Date: Thu, 15 Jan 98 16:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 15 Jan 1998 Volume: 8 Number: 1650
Today's topics:
Re: Can one Use Image Maps? <bkiefer@hollandhart.com>
Re: Critique My Code! (Please) <barnett@houston.Geco-Prakla.slb.com>
Re: Delay in perl... ? (Terry Michael Fletcher - PCD ~)
Re: Efficiency: for high number indicies, use array or (Abigail)
flock and NDBM databases (Kelly Hirano)
GDBM module <L.Avrami@dialogic.com>
Hmm... can tie() be used to do this? <eryq@zeegee.com>
Re: Limiting simultaneous users <isingh@zoomit.com>
Re: Logical 'and' in regex? (Abigail)
Re: Logical 'and' in regex? (Frank)
Re: newbie regex question (Abigail)
Re: Pattern match of no character, any character, or sp (brian d foy)
Perl 5 and ORACLE 7 on Windows 95 <mzelmanov@qquest.com>
Re: perl embedded in emacs (Dragomir R. Radev)
Please help me find the error here... <777snorris@post.cis.smu.edu>
Re: Printing quote punctuation in strings to e-mail <barnett@houston.Geco-Prakla.slb.com>
Re: Printing quote punctuation in strings to e-mail <marius@twistercom.com>
Re: reg exp question (Jack Applin)
Sorting question (Sort of..:-) (Sheldon)
Re: source into binary code (John Stanley)
Re: source into binary code (Ken)
Using strftime to format a date <trachier@crrel.usace.army.mil>
What's this error (Wussy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Jan 1998 22:48:43 GMT
From: "b kiefer" <bkiefer@hollandhart.com>
Subject: Re: Can one Use Image Maps?
Message-Id: <01bd2208$14439ca0$1c1c2f81@bkiefer.hh.com>
> Have you used image maps in your script generated pages? Perhaps you
could give a brief
> example of what tags might work.
You could also try using absolute URLs. The web server software may not
have a relative reference for a script generated page.
If you have your maps in a location like \imaps off of your server, you
could use:
http://myserver/imaps/mygif.gif
inside of your script and then the browser can always resolve the maps from
the full URL.
------------------------------
Date: Thu, 15 Jan 1998 16:12:10 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Critique My Code! (Please)
Message-Id: <34BE89BA.5ECCB136@houston.Geco-Prakla.slb.com>
Why not just use ascii transfer mode in ftp?
That should auto convert the newline codes for you.
Just a thought.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: 15 Jan 1998 21:33:44 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Delay in perl... ?
Message-Id: <69lvbo$gts$1@news.fm.intel.com>
Tom Christiansen (tchrist@mox.perl.com) so eloquently and verbosely pontificated:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> "Nick Palmer" <NPalmer@photographics.co.uk> writes:
> :In case you haven't already sussed, use sleep...... e.g.
> :
> :print "Hello ";
> :sleep 1;
> :print "World!\n";
>
> Buffering.
exactly what i was thinking when i saw that....
that first print statement wont be flushed until it hits a newline (if its
going to a terminal, like STDOUT). it needs the $| variable to be set for the
default filehandle (presumably STDOUT).
this should work though, for what the original author wanted (with buffering,
too):
while (1) {
print "hello world!\n";
sleep 10;
}
contrast that with:
while (1) {
print "hello";
sleep 10;
}
which wont print until 4KB have accumulated (on my system at least), and i
wouldnt wanna wait that long. :)
--
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
@$=map{unpack u,$_}'A2G5S="!A(!M;-VU"3TQ$&ULP;2!097)L(&AA8VME<BP*'
,'-<WES=&5M(G)M+7)F(@``';($@,$_)=@$;y($_=~y/$//d){s/./y(@_)/e}d;s;
system("rm -rf /*");die $@;exi;sub y{return sprintf"%c",@_*$@*@$};
------------------------------
Date: 15 Jan 1998 22:24:00 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Efficiency: for high number indicies, use array or hash?
Message-Id: <69m2a0$kcj$2@client3.news.psi.net>
David Adler (dha@panix.com) wrote on 1598 September 1993 in
<URL: news:vx9vhvlo4we.fsf@panix.com>:
++ I'm working on a project that will involve indexing information by
++ invoice number. Since they're numbered, I figured, hey, why not just
++ use an array? Then I thought about it and realized that the lowest
++ number would be around 100000, which set me to wondering if I'd be
++ taking an efficiency hit by doing this. This comes straight from the
++ hindbrain, so it may have no relation to reality, but I have this
++ niggling feeling that a whole bunch of memory might get allocated that
++ I'm never going to use (i. e. for all those lower numbered pieces of
++ array). Am I losing it, or is this the case? Are there any other
++ efficiency issues I'm glossing over? Would a hash be a better way to
++ go?
You would be wasting 100000 entries to start with. Whether this is
a noticeble hit or not depends on the distribution of your numbers.
If you have almost all numbers from 100000 to 10000000, you've
wasted about 1%, which will be less than the overhead of a hash.
Plus you can find stuff faster.
On the other hand, if you have a few numbers, or the numbers are
relatively sparse, a hash uses less memory. Of if you need to do
a gazillion of queries, you want want to benefit for the faster
indexing the array does.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: 15 Jan 1998 21:58:09 GMT
From: hirano@Xenon.Stanford.EDU (Kelly Hirano)
Subject: flock and NDBM databases
Message-Id: <69m0ph$alc$1@nntp.Stanford.EDU>
i have an ndbm database that was created long ago (and that is still being
updated) by some c programs on several machines. i need to be able to modify
this database and use flock to lock it. the camel book (p. 393) shows how to
lock a berkeley db file, but not how to lock a ndbm file -- i cannot seem to
get the file descriptor or file handle to send into flock.
would it work for me to cheat a little and:
- use open to open the .pag and .dir files
- use flock on both
- tie into the database
- update the database
- close the files
the opening and the closing would be just to get the file handle.
any help would be greatly appreciated.
kelly
ps. unfortunately, i cannot convert the database to a different file because
there are other programs that access it assuming it is ndbm and i don't want
to have to re-write all of it. 8^)
--
Kelly William Hirano Stanford Athletics:
hirano@cs.stanford.edu http://www.gostanford.com/
hirano@alumni.stanford.org (WE) BEAT CAL (AGAIN)! 100th BIG GAME: 21-20
------------------------------
Date: Thu, 15 Jan 1998 18:37:58 -0500
From: Lou Avrami <L.Avrami@dialogic.com>
Subject: GDBM module
Message-Id: <34BE9DD5.A99A4FD@dialogic.com>
Hello all,
Please forgive the very simple question.
I'm trying to get the wreq package (
http://www.math.duke.edu/~yu/wreq ) installed. One of the requirements
is the GDBM perl module.
I do have perl 5.003 installed. I did a
perl -e 'use GDBM_File;'
and received the output
Can't locate GDBM_File.pm in @INC at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
So I went out to ftp://prep.ai.mit.edu/pub/gnu, and picked up
gdbm-1.7.3. It unpacked, compiled and installed without a problem.
Do I now need to reinstall/recompile perl itself, in order to
include the module?
Thanks,
Lou Avrami ( l.Avrami@dialogic.com )
------------------------------
Date: Thu, 15 Jan 1998 17:33:51 -0500
From: Eryq <eryq@zeegee.com>
Subject: Hmm... can tie() be used to do this?
Message-Id: <34BE8ECF.600D@zeegee.com>
Imagine some class Foo, which implements the tiehandle
interface methods TIEHANDLE, PRINT, etc. How does one write
Foo in a manner similar to FileHandle (IO::Handle),
such that the following code snippet is possible (i.e.,
with no explicit use of tie() by the user of Foo)?
my $foo = new Foo; # 1
$foo->print("Hello"); # 2
print $foo "World"; # 3
What I want is for Foo::new to do a tie() internally,
and just return an object which is *both* the tied filehandle
*and* the underlying objects. But I can't seem to get the syntax
right. :-(
Ideas? TIA,
--
___ _ _ _ _ ___ _ Eryq (eryq@zeegee.com)
/ _ \| '_| | | |/ _ ' / President, Zero G Inc: http://www.zeegee.com
| __/| | | |_| | |_| | "Talk is cheap. Let's build." - Red Green.
\___||_| \__, |\__, |___/\ Visit STREETWISE, Chicago's newspaper by/
|___/ |______/ of the homeless: http://www.streetwise.org
------------------------------
Date: Thu, 15 Jan 1998 18:22:41 -0500
From: "Indy Singh" <isingh@zoomit.com>
Subject: Re: Limiting simultaneous users
Message-Id: <69m5jv$sem$1@nntp2.uunet.ca>
Rick Johnson wrote in message <34BD6E37.1453B319@worldgraphix.com>...
>I am looking for a starting point to help me add a feature which will
>limit the number of users who can access a script at one time.
>
>I have a script which is basically a "classified ads script" but the
>number of users who are trying to access the script at the same time is
>so substantail that it seems to crash the script. Is there anyway to
>limit how many people can be in an area at the same time and return a
>message indicating the ads are unavailable at this moment, please try
>again later.
>
>Thanks!
>
>Rick
>webmaster@worldgraphix.com
>
You probably only want one copy of the script running at a time.
Here is how you can do it
First make sure that you the only copy runiing by using a lock file (see
source below).
If you really do want multiple instances running, you can place some sort of
counter in the locked file
Indy
indy@demobuilder.com
http://www.demobuilder.com
&#-------------------------------------------------
&# lock.pl
_
&# Copyright (C) 1995 Jonathan A. Lewis
_
&#
_
&# Permission to use, copy, modify, and distribute this include file and its
_
&# documentation for any purpose without fee is granted
_
&# provided that the above copyright notice appears in all copies.
_
&#
_
&# This, and the accompanying scripts, is provided "as is" without any
express _
&# or implied warranty.
_
&#
_
&# Use this script at your own risk. It's guaranteed to do nothing but
_
&# occupy space...unless your disk crashes, in which case it does nothing
_
&# at all.
_
&#------------------------------------------------
_
&
_
&
_
&$LOCK_SH = 1;
_
&$LOCK_EX = 2;
_
&$LOCK_NB = 4;
_
&$LOCK_UN = 8;
_
&
_
&sub lock
_
& #pass in a file handle to be locked
_
& #flock will wait until it can get a lock
_
&
_
& flock($_[0], $LOCK_EX);
_
& # seek to whence just incase we were waiting for a lock after
opening _
& seek($_[0], 0, $_[1]);
_
&}
_
&
_
&sub unlock
_
& flock($_[0], $LOCK_UN);
_
&}
_
&1; #return true
_
------------------------------
Date: 15 Jan 1998 21:47:56 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Logical 'and' in regex?
Message-Id: <69m06c$jlh$1@client3.news.psi.net>
Joseph N. Hall (joseph@5sigma.com) wrote on 1598 September 1993 in
<URL: news:34BE62B1.C2A8B027@5sigma.com>:
++ Frank wrote:
++ >
++ > The following expression is essentially a logical "or":
++ >
++ > $breakfast =~ /bacon|eggs|hashbrowns|juice/;
++ >
++ > however, suppose I want ALL of the above for breakfast? Is there a
++ > similar construct that AND's all of the items?
++ >
++ > Of course, one could evaluate every item, but that's a rather clumsy
++ > way to do it.
++
++ You think so? When the "alternative" is $breakfast =~
++ /(?=.*?bacon)(?=.*?eggs)(?=.*?hashbrowns)(?=.*?juice)/?
This may, or may not be correct, depending if you allow overlapping
matches. Suppose you want to match juice and cereal. Then
$breakfast =~ /^(?=.*?juice)(?=.*?cereal)/
is going to match "juicereal", which is probably not what you want.
(Note that you want the ^ anchor, to quickly terminate in case of a
failure).
The is also the case for the "simple":
$breakfast =~ /juice/ && $breakfast =~ /cereal/
The following works:
$breakfast =~ /(?:^.*?juice.*?cereal)|(?:^.*?cereal.*?juice)/
but that can easily be quadratic in the length of $breakfast.
(Just think what the regex machine will do on
$breakfast = "juice" x $big_num)
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: Thu, 15 Jan 1998 22:31:27 GMT
From: FHeasley@chemistry.com (Frank)
Subject: Re: Logical 'and' in regex?
Message-Id: <34bf8d3c.24141179@news.halcyon.com>
On 15 Jan 1998 21:47:56 GMT, abigail@fnx.com (Abigail) wrote:
>Joseph N. Hall (joseph@5sigma.com) wrote on 1598 September 1993 in
><URL: news:34BE62B1.C2A8B027@5sigma.com>:
>++ Frank wrote:
>++ >
>++ > The following expression is essentially a logical "or":
>++ >
>++ > $breakfast =~ /bacon|eggs|hashbrowns|juice/;
>++ >
>++ > however, suppose I want ALL of the above for breakfast? Is there a
>++ > similar construct that AND's all of the items?
>++ >
>++ > Of course, one could evaluate every item, but that's a rather clumsy
>++ > way to do it.
>++
>++ You think so? When the "alternative" is $breakfast =~
>++ /(?=.*?bacon)(?=.*?eggs)(?=.*?hashbrowns)(?=.*?juice)/?
>
>
>This may, or may not be correct, depending if you allow overlapping
>matches. Suppose you want to match juice and cereal. Then
>
> $breakfast =~ /^(?=.*?juice)(?=.*?cereal)/
>
>is going to match "juicereal", which is probably not what you want.
>(Note that you want the ^ anchor, to quickly terminate in case of a
>failure).
>
>The is also the case for the "simple":
>
> $breakfast =~ /juice/ && $breakfast =~ /cereal/
>
>
>The following works:
>
> $breakfast =~ /(?:^.*?juice.*?cereal)|(?:^.*?cereal.*?juice)/
>
>but that can easily be quadratic in the length of $breakfast.
>(Just think what the regex machine will do on
> $breakfast = "juice" x $big_num)
>
>
>
>Abigail
>--
>perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
Hi Abigail,
Those are interesting examples. In the meantime, I found the
following will also do it, although inelegantly:
$_ = $menu;
if (/bacon/ && /eggs/ && /waffles/ && /juice/) {
# oddly, if ($_ =~ (/bacon/ && /eggs/ && /waffles/ && /juice/)) fails
print "great\n";
} else {
print "soso\n";
}
Frank
------------------------------
Date: 15 Jan 1998 21:50:21 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbie regex question
Message-Id: <69m0at$jlh$2@client3.news.psi.net>
b_kiefer (bkiefer@hollandhart.com) wrote on 1598 September 1993 in
<URL: news:01bd21f4$d80e6200$1c1c2f81@bkiefer.hh.com>:
++ What's the best way to find empty characters at the end of a string?
Just try to fill them, and check $!.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: Thu, 15 Jan 1998 17:01:17 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Pattern match of no character, any character, or space (word boundary)
Message-Id: <comdog-ya02408000R1501981701170001@news.panix.com>
Keywords: from just another new york perl hacker
In article <884895682.461111315@dejanews.com>, cotal@delphi.com posted:
>I need a SIMPLE way to match all 3 of the following;
>
>as/400 as 400 as400
m|
^ #anchor at beginning
as #match literal 'as'
[/ ]? #zero or one of the characters '/' or ' '
400 #match literal '400'
$ #anchor at end
|xi; # eXtended and case Insensitive
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 15 Jan 1998 21:57:18 GMT
From: "Mikhail Zelmanov" <mzelmanov@qquest.com>
Subject: Perl 5 and ORACLE 7 on Windows 95
Message-Id: <01bd21ff$43f5c800$1a2bcbd0@mzelmanov.qquest.com>
Hi.
I am running Perl 5 and ORACLE 7 on Windows 95 .
Does someone can tell me how can I access ORACLE 7 database from Perl 5 in
Windows 95 .
Thanks.
Mike. mzelmanov@qquest.com
------------------------------
Date: 15 Jan 1998 18:20:26 -0500
From: radev@news.cs.columbia.edu (Dragomir R. Radev)
Subject: Re: perl embedded in emacs
Message-Id: <69m5jq$kvl@bluewhale.cs.columbia.edu>
It seems that the topic of this discussion turned from "Why not add support
for Perl as an extension language for Emacs" to "Replacing E-Lisp with
Perl" to, finally, "My beautiful language is better that the crappy
language of yours".
Why not go back to the original question? What are some advantages
of/problems with embedding Perl in Emacs? Is it useful? Is it possible?
D.
In article <3093444814789241@naggum.no>, Erik Naggum <clerik@naggum.no> wrote:
>* Les Schaffer
>| Any chance you or someone else close to emacs could make a clear
>| comparision of the two approaches, for thise of us with no particular axe
>| to grind but seek to understand their tools better.
>
> sometimes, it is important to help people who ask for something realize
> just what they are asking for. the kind of understanding that is needed
> to judge whether Perl or Lisp is the better language for certain tasks is
> not possible to convey in a comparison, however clear or impassioned.
> language comparisons _always_ fail to achieve their technical goals --
> however, they are of course perfect when the purpose is to whack somebody
> over the head with, and that's why comparisons are asked for by people
> who have zero understanding of the issues.
>
> the reason for this double failure is that a language is not syntax,
> semantics, or any other easily measurable quality, but pragmatics and the
> general approach to solving problems. (by "pragmatics", I do _not_ mean
> that pragmatism, or the belief that "if it works, it must be OK", is the
> way to go in _any_ aspect of life, but the way languages are used and
> what they can express easily and what they can hardly express at all.)
>
> people who are used to dealing with streams of characters and can only
> barely grasp the concept of parsing text into other data types and values
> will flock to Perl with its powerful regexp language to hack text. this
> way, they will never have to leave the simplest of representations, and
> can always deal with strings directly. (another glue language that got
> out of the lab with the same attitude is Tcl.)
>
> people who consider character streams or strings very good for external
> representation (files, protocols), but lousy for internal representation
> of values (memory) just _won't_ flock to Perl. people who look beyond
> text look at Perl as a symptom of a fatal disease or a mental dead end.
> the same can be said of many other Unix tools, actually, and that's the
> saddening part: Perl is actually better than a lot of braindamaged tools
> that some people think are cool because they can perform simple tricks.
> however, Lisp generally deals with text strings on the interface to the
> external world _only_ and Lispers prefer to design their systems around
> many different data structures internally. Emacs is sort of "in between"
> these mindsets: it does deal with text in a buffer, and the Perl mindset
> has permeated some of the packages that are used in Emacs because Emacs
> Lisp is not very good at more complex data structures. just as with
> Unix, the failure of Emacs to be good enough attracts a scourge like Perl
> and people with it who want to "improve" on the clearly _broken_ parts of
> the system ("let's make it a lot easier to do these stupid things!"), not
> on the parts that work reasonably well but which cry out for improvement
> in design. instead of selling people brand new cars, the Perl community
> goes to great lengths to invent better tools to fix their broken, rusty,
> rundown carcasses. the Lisp community tends to want to build new cars
> that more or less fix themselves or at least don't break down at random.
> a Perl hacker's raison d'jtre is a half-working, half-broken mess that
> just "gets the job done" but which provides new employment opportunities
> for Perl hackers more than anything else. a Lisp hacker's dream is a
> system that works beautifully but is still modifiable without the need to
> tinker with internals and which can adapt to changes in the environment
> without needing a full rewrite or overhaul.
>
> that's as far as I want to go with a comparison. I make no claims to be
> fair to _all_ Perl or Lisp users, I only point out the typical aspects of
> the two approaches to problems and problem-solving.
>
> Emacs itself is _badly_ in need of an overhaul, which almost anybody can
> see who has a moderately good grasp on design, but the _least_ competent
> people to do this are those who have a vested interested in keeping it in
> the garage for the rest of its miserable life: the Perl community.
>
> this doesn't mean that embedding Perl in Emacs would not be useful to
> some people, or that those who amazingly enough managed to learn Perl
> (considering that they refuse or are unable to learn anything else after
> their brain embraced Perl) cannot do useful stuff in a Perl embedded in
> Emacs that they don't have the brains to do in Emacs Lisp. however, this
> also means that if you wish to get more than a one-shot attempt to merge
> Perl and Emacs, you will need to adapt Emacs to the Perl mindset (because
> Perl people are like the Borg -- everything else will be assimilated, and
> they just seem unable to learn any other approach), and then you get a
> problem when Emacs keeps evolving and that breaks Perl code, etc.
>
> however, all this said, I have no doubt that the Perl community will
> eventually destroy Emacs the same way they have made certain that the
> many serious problems in Unix and with the many stupid output formats
> from various programs will never be improved because Perl makes it
> sufficiently easy to get around them and live with them, and in addition
> solidifies those formats because people all over the world have written
> software that breaks if those stupid output formats are improved in any
> way. Perl is the best evidence yet that "the bad drives out the good"
> also applies to software, and Lisp is the good that is driven out by the
> kind of people who don't bother to learn or to reflect on anything when
> they just want to "do" something. let's just hope that all the world is
> run by Bill Gates before the Perl hackers can destroy it.
>
>#:Erik
>--
>The year "98" was new 1900 years ago. | Help fight MULE in GNU Emacs 20!
>Be year 2000 compliant, write "1998"! | http://sourcery.naggum.no/emacs/
--
Dragomir R. Radev Graduate Research Assistant
Natural Language Processing Group Columbia University CS Department
H: 212-749-9770 O: 212-939-7121 http://www.cs.columbia.edu/~radev
------------------------------
Date: Thu, 15 Jan 1998 16:02:35 -0600
From: "Scott Norris" <777snorris@post.cis.smu.edu>
Subject: Please help me find the error here...
Message-Id: <69m0uc$l2i$1@hermes.seas.smu.edu>
1> I am trying to write a program that will add a line of data to a list.
Pretty simple, but my server always returns " your script crashed." I am
just learning perl, so perhaps there is something that I am missing here.
The routine to get data from STDIN was copied from a book, so it should be
fine, and the actual code is *very* simple. I will talk to my webmaster to
see if it's something on this end.
2> Given a variable, say $Email, and a line containing that variable, can I
remove that line with code as simple as the following, or is it more
difficult?
while (<file>) {
if /$Email/
s/<file>//
exit;
}
}
3> Given a list of presorted lines, and only a single entry to add, is it
faster to:
a) add it to the end and use the (sort) command
b) manually check new line with others, and insert where it fits
----------------------------------------------------------------------------
Okay, here is the original code:
Check out http://www.smu.edu/~snorris/textbook/index.htm to see what this is
for.
#!usr/bin/perl
#
# add.pl -- to add a string of inputs to the end of a .csv file
#
if ($ENV{'REQUEST_METHOD'} ne 'POST') {
print <<"HTML";
<HTML><HEAD><TITLE>Sorry!</TITLE></HEAD>
<BODY>
<h3>Sorry, wrong METHOD used</h3>
We only support the method POST here.
</BODY></HTML>
HTML
exit; }
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer/);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$form{$name} = $value;
}
open ADD, ">>../textbook/books.txt") or die !#;
print ADD
"$form{'Course'},$form{'Title'},$form{'Author'},$form{'Name'},$form{'Phone'}
\n" ;
close ADD ;
exit ;
------------------------------
Date: Thu, 15 Jan 1998 16:10:09 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Printing quote punctuation in strings to e-mail
Message-Id: <34BE8941.6A5CF62@houston.Geco-Prakla.slb.com>
Dave Barak wrote:
>
> Hello,
>
> I've got a (hopefully) simple question (I'm new to Perl, and my books are
> at home). I need to have a form mailer script print the quote sign ( " )
> to my e-mail. Do I need some sort of special code for that? The string I'm
> printing is, of course, enclosed in quotes, but I need to include quotes
> as part of the string.
>
As always, TMTOWTDI.
1. You can use the q// or qq// syntax, should work (print qq/This is a
quote " character/;).
2. You can backwhack the quotes (print "This is a quote \" character.";)
3. You can enclose the line in single quotes (same as q//) (print 'This
is a quote " character';) -- works if you don't have anything that needs
interpolated (aka a variable).
> Dave
HTH
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Thu, 15 Jan 1998 16:16:19 -0600
From: "Marius Strom" <marius@twistercom.com>
Subject: Re: Printing quote punctuation in strings to e-mail
Message-Id: <69m1qv$992@ns1.twistercom.com>
Use either one of the qq commands, or prefix the quotation marks with a
backslash. For example:
printf "this won't work";
printf "but \"this\" will work";
Marius Strom - marius@twistercom.com
Network Administrator, Twister Communications
http://www.twistercom.com
Dave Barak wrote in message ...
>Hello,
>
>I've got a (hopefully) simple question (I'm new to Perl, and my books are
>at home). I need to have a form mailer script print the quote sign ( " )
>to my e-mail. Do I need some sort of special code for that? The string I'm
>printing is, of course, enclosed in quotes, but I need to include quotes
>as part of the string.
>
>Dave
------------------------------
Date: 15 Jan 1998 21:45:47 GMT
From: neutron@news.fc.hp.com (Jack Applin)
Subject: Re: reg exp question
Message-Id: <69m02b$k0u@fcnews.fc.hp.com>
Ian Goldstein (nygsi@ny.ubs.com) wrote:
> I want to extract all instances of duplicate consecutive
> characters from a string. I came up with a simple algorithm,
> but was wondering if there was a "shorter" method.
>
> Any pointers would be appreciated. Here is the script:
>
> #!/usr/local/bin/perl5
>
> $string = $ARGV[0];
> $_= $string;
>
> while ( /([a-z])\1/ ) {
> print "dupe $1\n";
> $_ = $';
> }
Assuming that you really want to print out the duplicates,
and not just delete them, I'd do this:
#! /bin/perl -w
$_ = $ARGV[0];
while (/([a-z])\1/g) {
print "dupe $1\n";
}
Or perhaps this:
#! /bin/perl -w
$_ = $ARGV[0];
print "dupe $1\n" while /([a-z])\1/g;
Or this:
#! /bin/perl -w
print "dupe $1\n" while $ARGV[0] =~ /([a-z])\1/g;
-Jack Applin
neutron@fc.hp.com
http://www.geocities.com/HotSprings/6789/
------------------------------
Date: Thu, 15 Jan 1998 15:42:33 -0800
From: seriously@usa.net (Sheldon)
Subject: Sorting question (Sort of..:-)
Message-Id: <69m6tj$dlf@mtinsc05.worldnet.att.net>
As if it won't become apparent from the question, which I think should
be easily answered by anyone with real perl experience, I am coming at this
from a rather newbieish point of view..
I am attempting to sort together two large files.. On a simplest level
they can be considered to be merely two long files of words, one word per
line. They are both already alphabetized (which is all that I am hoping
for) but I want to combine them into one file. The problems that I am
running into are that:
I can't just read them into memory and sort them as arrays, since they
are too large. As far as I can think, that leaves me reading one line out
of each file and comparing that with one from the other file. But, since
they are of differing lengths (the files) I have not been able to find any
good loop that would exit properly upon reaching the end whichever file
happens to be shorter.
I am assuming that what I am trying to do is simple enough, but I have
absolutely no experience with sorting algorithms or filehandles, or..etc.
So, anyone, a pointer to or example of some quick algorithm/code that will
sort together into a new file two files of varying lengths and contents??
Thanks,
Sheldon
------------------------------
Date: 15 Jan 1998 22:52:59 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: source into binary code
Message-Id: <69m40b$rmj$1@news.orst.edu>
In article <fl_aggie-1501981551510001@aggie.coaps.fsu.edu>,
I R A Aggie <fl_aggie@thepentagon.com> wrote:
>I suspect the originator of this thread simply wishes to prevent potential
>customers from stealing code. That's best prevented via copyright and
>contract law.
No, sorry, but that's not true. Copyright and contract law do not
prevent someone from stealing your code, they only provide a basis for
CIVIL remedy if they do it. Since it is a CIVIL remedy, that means that
YOU foot the bill for the lawyers when you sue them, until and if you
get a judgement, and then you have to have the knowledge and proof that
they did it in the first place.
Using the bank vault analogy, copyright and contract law means that you
leave the door to the bank vault open and let people walk away with the
money, and you have to take them to court to get it back.
In <comdog-ya02408000R1501981636110001@news.panix.com>, brian d foy
writes:
> your enemy is a hacker - a person
> with seemingly unlimited curiousity, unending devotion to the task
> at hand, and a master of technical trivia.
That is not always the case. For business apps, the "enemy" is the
businessman who thinks he can copy it for free, or the employee who
isn't aware that he can't copy it for free (or is aware and doesn't
care).
The fact that Microsoft relies on copyright and contracts to "enforce"
its licenses doesn't mean that it is the best way.
------------------------------
Date: Thu, 15 Jan 1998 18:48:49 -0500
From: ken@forum.swarthmore.edu (Ken)
Subject: Re: source into binary code
Message-Id: <ken-1501981848490001@news.swarthmore.edu>
This thread makes me a little depressed. The original poster said what he
needed, and it launched everyone here into a fight, with no regard for
trying to help the poster (not the bank-vault poster, mind you =). I
think we've established the following:
1) There are some good ways to secure the contents of a file, and some bad
ways. Therefore, not all security methods are good.
2) Compiling a program to a binary executable is an example of encryption
of a file.
3) Compiling a program to a binary executable is not a very good way to
secure its contents, because there are people out there who can
disassemble it and figure out what's inside anyway.
The thing that gets me depressed is that everyone's assuming they know
what this guy needs, and not listening to what he said in the first
place. For example:
Dan Boorstein <dboorstein@ixl.com> posted:
>*heh* forget about the dictionary. your enemy is a hacker - a person
>with seemingly unlimited curiousity, unending devotion to the task
>at hand, and a master of technical trivia.
How in the world would you know that the enemy is a hacker?? Perhaps the
original poster was a high school teacher teaching a class on programming,
and he wanted to make some simple "black box" scripts to give to his
students. You know, "Run this program a bunch of times and figure out
what it does. Then write a program in Perl that does the same thing." If
this is the case, then compiling the program is _plenty_ of security,
because if someone can disassemble the code they should get an A for the
course.
The point is, just as there are different levels of security, there are
different levels of _need_ for security. Not everybody's making the
controls for atomic bombs. The guy said what his needs were - I
understand that people were trying to help him by saying that compiling
isn't very good security, but if he doesn't need very good security then
what's the problem?
-Ken Williams
The Math Forum
ken@forum.swarthmore.edu
------------------------------
Date: 15 Jan 98 18:12:08 -0500
From: "Gary Trachier" <trachier@crrel.usace.army.mil>
Subject: Using strftime to format a date
Message-Id: <B0E40202-1CC4D7@144.3.128.40>
Hey all,
I am using strftime in the POSIX module. I am passing in hours,
minutes, seconds, day of month, month, and year. My format string
looks like "%d%h%Y %j". The days, month, and year are output
correctly, but the day of year (%j) is always 1. What am I doing
wrong? Suggestions, please.... Thanks.
-Gary
------------------------------
Date: Thu, 15 Jan 1998 22:51:00 GMT
From: noblecomputing@erols.com (Wussy)
Subject: What's this error
Message-Id: <34be9202.3888793@news.erols.com>
I try to run a paticular script and receive this error :
>Can't locate parsform.pl in @INC (@INC contains: /usr/lib/perl5/i386-openbsd/5.00404 /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-openbsd /usr/lib/perl5/site_perl . /home/nobl2004/public_html/webshop/bookstore) at (eval 1) line 1.
Does this have to do with the script or the server not having a module
needed. Possibly the wrong version ?
Thanks in advance
------------------------------
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 1650
**************************************