[12204] in Perl-Users-Digest
Perl-Users Digest, Issue: 5804 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 27 13:07:29 1999
Date: Thu, 27 May 99 10:01:28 -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 Thu, 27 May 1999 Volume: 8 Number: 5804
Today's topics:
Timeout question..(Code included)... <portboy@home.com>
Uploading image files.. <terral@cyberplex.com>
Re: using zipcodes to graphically desplay survey result <dhenders@cpsgroup.com>
Re: What's wrong with this hit counter? <matt-news@sergeant.org>
Re: why doesn't my first program work?? (ok , third or <upsetter@ziplink.net>
Re: why doesn't my first program work?? (ok , third or <fruffet@kaptech.com>
Re: why doesn't my first program work?? (ok , third or <tchrist@mox.perl.com>
Re: Win32::OLE build 515 <matt-news@sergeant.org>
Re: workarounds for prototypes <jdporter@min.net>
Writing a Form Validation Script simchadov@my-deja.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 27 May 1999 16:00:05 GMT
From: Mitch <portboy@home.com>
Subject: Timeout question..(Code included)...
Message-Id: <374CFC41.40A74327@home.com>
I'm working on a timeout issue. Here's how the problem is setup. There
are two files, one contains daemon code, and the other contains the
"commands" code. When the daemon is fired up, it fires up the commands
code. After that is fired up, it does a &print_welcome; Here's the
print_welcome code:
sub print_welcome
{
my $an;
my $cfg_pass;
&welcome; #shows all that welcome b.s.
# Get the password from the config file
open(CONFIG, "/foo/bar/config");
while(<CONFIG>) {
if ($_ =~ /^pass (.*)/) {
$cfg_pass = $1;
}
}
close(CONFIG);
do
{
&show("password: ");
ReadMode 'noecho';
$an = ReadLine 0;
chomp $an;
ReadMode 'normal';
&show("\n");
} while ($an ne $cfg_pass); #keep doing until they get it right
}
All this code does is show a pretty banner, and then ask the user for a
password where it then compares the inputted password with the one
contained in the config file. Assuming the user's inputted password
matches the one contained in the config, we then get to a console>
prompt where the users is able touse the scripts commands. Assuming the
welcome banner and login go ok, I then send it to &poll. Code is
below...
sub poll
{
eval {
alarm(5);
&loop;
alarm(0);
};
if ($@) {
if ($@ =~ /timeout/) {
&foo;
} else {
alarm(0);
die;
}
}
}
As you see in poll, there is &loop (code below), which monitors what the
user is inputting and if a proper command is inputted, it heads off to
execute it. However, if there is no input from the user, the script
should essentially log the user out, print the banner, and ask them to
log-in again (i've tried doing this by calling foo - code below).
sub loop {
while (1)
{
&show(&prompt);
my($an) = &get_line;
# next if ($an[0] =~ /^\s*$/);
($cmd, @args) = split(/\s+/, $an);
if (!$commands{$cmd})
{
&bad_input;
}
else
{
&{$commands{$cmd}{sub}}(@args);
}
}
}
sub foo{
&print_welcome;
&poll;
}
This doesn't seem to be working. Everything fires up fine, but after 5
seconds, the script dies.
Any suggestions on what I'm doing wrong?
Thanks again,
Mitch
p.s. if you need clarification let me know
------------------------------
Date: Thu, 27 May 1999 13:16:55 -0300
From: "Terra Landry" <terral@cyberplex.com>
Subject: Uploading image files..
Message-Id: <7ijr91$72u$1@bignews.fundy.net>
I want to upload images in perl... I have it uploading, but it saves an
empty file, so I'm not sure what I'm doing wrong... can anyone help me by
giving me an example of a file upload??
Thank you,
Terra
------------------------------
Date: Thu, 27 May 1999 16:15:45 GMT
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: using zipcodes to graphically desplay survey results online
Message-Id: <7ijr3e$seb$1@nnrp1.deja.com>
In article <7iijcj$g4b$1@usenet01.srv.cis.pitt.edu>,
"Dan Foley" <djfst34@pitt.edu> wrote:
> Ok.. here is what I am trying to do:
>
>
> I wish to display the results geographically baised on the zipcode
that goes
> along with each answer.
>
> either i will use javascript or perl to do this. I know javascript
better,
> but i don't know too much about it's abilty to deal with files and
such...
>
> my thought is that i am going to need some exteral database of zipcode
and
> somehow corrorlate them to a map. My current thought is that The only
way to
> really do this is with a zipcode data base that gives longitude and
> latitude.. then i can just plot the results on my map.. no matter how
zoomed
> in or out you are.. i can always have an equation that plots the
longitude
> and latitude correctly..
>
> i looked on the web and see such databases cost money, and this is
just a
> pet project of mine.. so is there another way..? Also.. lets say i did
get
> the longitute and latitute... how would i plot this.. do i do it real
time
> each time a user request the results? plot an overlay over a map?? I
can't
> think of how else i'd do it.. (javascript can do that. but we are
talking a
> database search for each entry.. and then a plot.. how long might this
> take.. ?)
>
We do something similar to this at work using a perl cgi and a postgres
database of zipcodes to lon,lat. The zipcode lookup's are fairly quick.
And I wouldn't thing plotting would be such a daunting task in perl. I
don't know much about javascript. But it seems one would have trouble
connecting to a database with javascript.
If you're looking for US zipcodes you can get the information you need
for free from the Census Bureau or the Postal Service. The Census Bureau
will give them in an electronic format, But the zipcodes or current as
of 1990. The USPS will give you up-to-date records, but in a printed
volume.
If you want Canadian zipcodes you have to buy them I think. (If you can
find a way to get them for free let me know. :)
> So. i would like to just hear people's thoughts on how i might do
this.. by
> the way i also have server side includes in my toolbox that i can
use.. if
> that would help any (i don't think it would in this case)
>
> ----Dan
>
> djfst34@pitt.edu (please cc my email a copy of all reply's.. thanks)
>
> --
> ------------------------------------------------------------
> - Dan Foley -
> - music, resume, more on me -
> - www.pitt.edu/~djfst34 -
> ------------------------------------------------------------
>
>
--
Dale Henderson <mailto:dhenders@cpsgroup.com>
"Imaginary universes are so much more beautiful
than this stupidly- constructed 'real' one..." --
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Thu, 27 May 1999 16:54:53 +0100
From: Matt Sergeant <matt-news@sergeant.org>
Subject: Re: What's wrong with this hit counter?
Message-Id: <374D6ACD.8F889131@sergeant.org>
"Randal L. Schwartz" wrote:
>
> You can also read my WebTechniques columns online, where I cover this
> very issue in one of my first rants about how stupid visitor counters
> are, and even describe the parody I have on my homepage (the
> "non-visitor" counter).
Sadly an awful lot of web sites don't have access to thier access log. I
didn't before I setup a proper domain with a hoster (I just had my
homepage on my ISP's service) so a home page counter is useful. (it's
nice for me to know that 20,000 people have hit my Perl page :)).
However my argument is a moot point, since anyone without proper access
logs is also unlikely to have CGI access too - so they'll have to use
someone else's hit counter - I use WebTracker for mine
(http://www.fxweb.com).
Matt. (who looks forward to web techniques each month)... :)
------------------------------
Date: Thu, 27 May 1999 15:00:06 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: why doesn't my first program work?? (ok , third or something)
Message-Id: <W5d33.859$nn.257212@news.shore.net>
Tom Christiansen <tchrist@mox.perl.com> wrote:
: In comp.lang.perl.misc, therzog@knotech.com (Tim Herzog) writes:
: :The volume of perl documentation doesn't mean that
: :the language is accessible. Quite the contrary.
: I guess you'd say the same thing about the Oxford English Dictionary,
: the Encyclopaedia Britannnica, Tolstoy's War and Peace, Thoreau's
: Walden, Bach's Bm Mass, Mendelssohn's Midsummer Night's Dream, or
: Mozart's Requiem.
Exactly. English is not an easy language to learn (so I'm told), in spite
of the documentation. Neither is music.
If a foreigner is having trouble learning English, do you say "Idiot! Why
don't you just go read the dictionary?"
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Thu, 27 May 1999 16:36:00 +0200
From: "Fred Ruffet" <fruffet@kaptech.com>
Subject: Re: why doesn't my first program work?? (ok , third or something)
Message-Id: <7ijl8r$cm9$1@gatekeeper.ornano.kapt.com>
Situation may never influence judgment. You only had to tell us you made a
mistake. Lack of documentation is the most common error of a programmer, and
IMHO, the worst.
Fred
Tim Herzog a icrit dans le message ...
>In article <therzog-2705990323010001@therzog-host105.dsl.visi.com>,
>therzog@knotech.com (Tim Herzog) wrote:
>
>
>>Bravo! Personally, I'm getting really sick of the lack of civility and
>>decency in this forum. The volume of perl documentation doesn't mean that
>>the language is accessible. Quite the contrary.
>
>Before I get massively flamed, I apologize to the group at large for that
>last post. I meant to email it only to the author, but it's 3:30 AM and I
>accidently posted it as well. The time of day may also have influenced my
>comments.
>
>--
>Tim Herzog
------------------------------
Date: 27 May 1999 09:29:13 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: why doesn't my first program work?? (ok , third or something)
Message-Id: <374d64c9@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Scratchie <upsetter@ziplink.net> writes:
:Tom Christiansen <tchrist@mox.perl.com> wrote:
:If a foreigner is having trouble learning English, do you say "Idiot! Why
:don't you just go read the dictionary?"
I don't believe that this is a comparable situation, but in general,
yes, looking things up is better as a first approximation. The problem
with these Prisoners of Bill is that they come from the anti-literate
culture of begging answers from others rather than doing their own
research into available documentation and examples on their own system.
It's a crime that carries with it its own punishment, pre-packaged.
--tom
--
I know I'm a pig-ignorant slut. --Andrew Hume
------------------------------
Date: Thu, 27 May 1999 17:05:26 +0100
From: Matt Sergeant <matt-news@sergeant.org>
Subject: Re: Win32::OLE build 515
Message-Id: <374D6D46.9AF0EFB4@sergeant.org>
Damon Torgerson wrote:
>
> Okay, two quick questions. . .
>
> 1) I've installed build 515 and I still can't "use Win32::OLE;" I have to
> continue to "use OLE;" I'm far from a Perl installation guru so any ideas?
You probably have a broken perl installation.
> 2) I can't seem to open a connection to a database. I've basically taken
> some VB code and converted it to Perl and now it doesn't want to go. My
> main problem is opening my connection to the database
>
> $conn->Open($connectionString) or die "This stupid thing won't connect: $!";
ADO::Connection::Open returns 0 on success and an error code on failure.
(and not a particularly useful one at that).
See the Perl-Win32-Database FAQ on http://come.to/fastnet
Matt.
------------------------------
Date: Thu, 27 May 1999 16:22:49 GMT
From: John Porter <jdporter@min.net>
Subject: Re: workarounds for prototypes
Message-Id: <7ijrgl$sq3$1@nnrp1.deja.com>
In article <therzog-2705990058590001@therzog-host105.dsl.visi.com>,
therzog@knotech.com (Tim Herzog) wrote:
> use utils;
>
> That seems to work, at least on my box (RedHat Linux, perl 5.005)
>
> I don't change the contents of utils.pm, don't declare it as a package
or
> export anything. For my own reasons (chiefly laziness), I'd rather
not
> reconstruct this thing as a true package: I want everything to reside
in
> global namespace.
>
> My question is: how dangerous and/or compatible is this with other
(and
> possibly future) versions of perl? Am I committing a big no-no?
This is absolutely normal, Tim; no worries.
I do it all the time. The rule is, if it works for you, it's o.k.
However, since a future version of Perl, or some other module from
e.g. CPAN, might be named utils.pm, and be found via some other
path in @INC (since dot is last), you should probably consider using
a more "unique" name, like KnoTech-Herzog-utils.pm. You get the idea.
--
John Porter
Put it on a plate, son. You'll enjoy it more.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Thu, 27 May 1999 15:16:00 GMT
From: simchadov@my-deja.com
Subject: Writing a Form Validation Script
Message-Id: <7ijnjd$pic$1@nnrp1.deja.com>
Hi,
I need to write a script that does generic CGI form validation. Are
there modules written to support this sort of thing or has anyone seen
scripts out there that do this already?
Thanks, Scott
PS- If you could email me a reply to scott@newfangled.com that would be
great.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5804
**************************************