[11558] in Perl-Users-Digest
Perl-Users Digest, Issue: 5158 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 17 15:07:19 1999
Date: Wed, 17 Mar 99 12:00:26 -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 Wed, 17 Mar 1999 Volume: 8 Number: 5158
Today's topics:
About CGI.pm <kentwang@mailcity.com>
Re: About CGI.pm <alex@kawo2.rwth-aachen.de>
Re: Are negative array indeces allowed? <droby@copyright.com>
Re: Array-Sort <cassell@mail.cor.epa.gov>
Re: Days in Month array <jglascoe@giss.nasa.gov>
Re: DUMB Newbie question <jeromeo@atrieva.com>
Re: DUMB Newbie question <cassell@mail.cor.epa.gov>
Re: Filehandle Q... <cassell@mail.cor.epa.gov>
Re: flock() on Alpha/VMS <brad@tgsmc.com>
Re: flock() on Alpha/VMS (M.J.T. Guy)
Re: Hash of structs <aqumsieh@matrox.com>
Re: Help on C-Kermit ... <cassell@mail.cor.epa.gov>
Input for PERL Course request <wredman@ycc.kodak.com>
Re: Input for PERL Course request (brian d foy)
Re: Install ActivePerl? <cassell@mail.cor.epa.gov>
Re: Login, redirect, and who is the user? <aghaeim@genesis.co.nz>
new on subroutines <bowens001nospam@hawaii.rr.com>
Re: new on subroutines <jglascoe@giss.nasa.gov>
Re: NT 4.0 Server Problems with CGI <ekkis@arix.com>
number convert <cplee@bigfoot.com>
Re: number convert <jglascoe@giss.nasa.gov>
Re: number convert <kentwang@mailcity.com>
Re: Perl Win32::ODBC Error while using MS Access ODBC d <jwarner@tivoli.com>
pls/help with anonymous nested data structures <chad@vcn.net>
Re: pls/help with anonymous nested data structures <jglascoe@giss.nasa.gov>
Re: pls/help with anonymous nested data structures <Allan@due.net>
Re: Pushing current line back onto <FILE> <Allan@due.net>
scripts to organize Radius files (Hannu)
Re: Send Form Data to the end of a URL within the HTML <Allan@due.net>
STDERR redirection <gkl200@my-dejanews.com>
Re: STDERR redirection (brian d foy)
Re: symbolic method references? <ekkis@arix.com>
the life of brian(the $dbh variable) <hojo@i-tel.com>
Re: the life of brian(the $dbh variable) (brian d foy)
Tied filhandles and Storable::store() <Jochen.Stenzel.gp@icn.siemens.de>
unlink problem (Mark P.)
Re: unlink problem <jglascoe@giss.nasa.gov>
Re: Very simple question <ekkis@arix.com>
Re: Very simple question <m-rau@gmx.de>
Re: Which OS am I in <spike_YYwhiteYY@YYdellYY.com>
Re: Which OS am I in <john.chambers@gte.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 17 Mar 1999 13:05:23 -0600
From: Kent Wang <kentwang@mailcity.com>
Subject: About CGI.pm
Message-Id: <36EFFCF3.B4BDE6B6@mailcity.com>
Just how efficient is CGI.pm? Are there alternatives? What's up with
LWP?
------------------------------
Date: Wed, 17 Mar 1999 21:02:40 -0500
From: Alex Farber <alex@kawo2.rwth-aachen.de>
To: Kent Wang <kentwang@mailcity.com>
Subject: Re: About CGI.pm
Message-Id: <36F05EC0.86ADCEC3@kawo2.rwth-aachen.de>
Kent Wang wrote:
> Just how efficient is CGI.pm? Are there alternatives?
Well, I don't know how "efficient" it is, but I'm using
CGI.pm since several years - it is very comfortable.
There's a book on it by the author - see:
http://www.wiley.com/compbooks/stein/
And a nice intro article at
http://www.zdnet.com/devhead/stories/articles/0,4413,2200068,00.html
/Alex
--
http://www.simplex.ru/pref.html
------------------------------
Date: Tue, 16 Mar 1999 22:00:06 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: Are negative array indeces allowed?
Message-Id: <7cmk90$vca$1@nnrp1.dejanews.com>
In article <36EE96C8.5735F5AD@gte.com>,
jc@eddie.mit.edu wrote:
>
> Hmmm .. You're probably right. But I'd still say, on re-reading Alex's
> question, that the answer to the question that he was asking is "No".
Curious. His question noted that perl -e '@x = qw (a b c); print $x[-3]'
prints "a", and he seemed delighted with that fact. Seems to me HE
understood that in his context $x[-3] was the same thing as $x[0] and was
happy with that.
> That is, perl does accept negative numbers as array indexes, but perl
> doesn't implement negative array indexes. It does something *very*
> different with a negative index than would be expected by anyone who
> uses the phrase "negative array index". A programmer who notices the
> use of a negative number as an index, thinks "Oh, negative indexes now
> work" and writes code to use them is in for a rather nasty surprise.
>
Only if he blithely goes ahead and uses them without bothering to figure out
what they do. Counting backward from the end of an array is quite a sensible
use for a negative array index. Creating new entries prior to the 0th might
also be useful, but it ain't what Perl does.
> (Of course, we could just post a large warning: "Perl may be dangerous
> to the mental health of people with any mathematical background. RTFM
> with great care before use." ;-)
>
Excuse me while I climb back into my straitjacket.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 17 Mar 1999 11:00:30 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Array-Sort
Message-Id: <36EFFBCE.804D08C5@mail.cor.epa.gov>
Michael C. Brittain wrote:
> I am wary of asking this question for fear of getting flamed as a moron,
> but what is a Schwartzian Transform anyway? I did look for refereneces to
> it in the camel, so please don't give me that...
>
> -mike
Well, Tad and Bart already gave you good refs for this. But the answer you
may be looking for is as follows:
Randal Schwartz began using this technique in answers to comp.lang.perl.misc
questions. Others griped a little that it was obscure enough to make new
Perlers think Perl was a write-only language. Someone other than Randal then
named this technique the Schwartzian Transform.. although IIRC, Tom
Christiansen then suggested that this was too Teutonic and that we should call
it the 'Black Transform'. :-) I love linguistic puns, but then I actually
read Ezra Pound's Cantos in college so you know I'm deeply warped.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 17 Mar 1999 14:56:05 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Craig Berry <cberry@cinenet.net>
Subject: Re: Days in Month array
Message-Id: <36F008D5.8162E20B@giss.nasa.gov>
[courtesy copy of post sent to cited author]
On Wed, 17 Mar 1999 17:58:01, Craig Berry wrote:
>
> my $isLeap = ($year % 4 == 0 &&
> $year % 100 != 0) ||
> $year % 400 == 0;
and
On Tue, 09 Mar 1999 18:19:54, Jay Glascoe wrote:
>
> print "biz!\n" unless $year % 4 or not $year % 100 and $year % 400;
however, my favorite by far was:
On Wed, 10 Mar 1999, Abigail wrote:
>
> By checking whether the day following Feb 28 is in February.
>
> sub is_leap {
> require Time::Local;
> my $year = shift;
> my $time = Time::Local::timelocal (0, 0, 12, 28, 1, $year);
> my $date = localtime ($time + 24 * 60 * 60);
>
> substr ($date, 4, 3) eq 'Feb';
> }
Jay Glascoe
--
"That which does not kill me makes me stranger."
--Larry Wall
------------------------------
Date: Wed, 17 Mar 1999 10:30:44 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: DUMB Newbie question
Message-Id: <36EFF4D4.706B45A0@atrieva.com>
John Callender wrote:
>
> Tad McClellan <tadmc@metronet.com> wrote:
>
> > You have an error on line 17.
> Lost on many of these experts is the irony inherent in their apparent
> belief that someone clueless enough to ask this sort of question will
> nevertheless be clueful enough to ask it in the way that they, by
> virtue of their expertise, deem to be appropriate.
It is self evident that one cannot debug code that one cannot see.
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Wed, 17 Mar 1999 12:01:12 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: DUMB Newbie question
Message-Id: <36F00A08.35AB23C9@mail.cor.epa.gov>
Jerome O'Neil wrote:
> John Callender wrote:
> > Tad McClellan <tadmc@metronet.com> wrote:
> > > You have an error on line 17.
>
> > Lost on many of these experts is the irony inherent in their apparent
> > belief that someone clueless enough to ask this sort of question will
> > nevertheless be clueful enough to ask it in the way that they, by
> > virtue of their expertise, deem to be appropriate.
>
> It is self evident that one cannot debug code that one cannot see.
IMHO, it *should* *be* self-evident that one cannot debug such code..
but clearly it is not self-evident to many people still getting their
feet wet. (Assuming that they're diving for Perls :-)
Perhaps they have heard of the Telnet::ESP module?
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 17 Mar 1999 11:33:48 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Filehandle Q...
Message-Id: <36F0039C.FC133419@mail.cor.epa.gov>
Morris wrote:
> I figure this will be easy to someone...
> I want a script to call an external program (whois), write the output that
> would normally be echoed to the screen to a file, and then return to normal
> behavior.
> [snip]
> Any insight/lesson would be great... Ive checked in Programming Perl
> (O'Reilly), which has never failed me before, but Im /obviously/ missing
> something. Thanks in advance...
I see your problem. You're looking in the wrong part of the Camel.
You're thinking of this as a filehandle problem, rather than as a
system interaction problem. Check out 'system'. You can make the
system call without doing any redirection of STDOUT. Something like
the example given in the docs:
system("insert_command_and_redirect_here") == 0
or die "System failed, doggone it, $?";
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 17 Mar 1999 10:13:28 PST
From: Brad Hughes <brad@tgsmc.com>
To: Techno <techno@umbriel.demon.co.uk>
Subject: Re: flock() on Alpha/VMS
Message-Id: <36EFF1A1.3313C251@tgsmc.com>
Look at VMS::Lock on CPAN:
ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/VMS/vms_lock-0.80.tar.gz
Perl will complain if you run under -w (as you should), and I have
a fix for it, which I will post to CPAN when I can find my PAUSE password...
Techno wrote:
>
> Hi,
>
> I've written a perl script that needs to be multi-platform (HP-UX, NT,
> Alpha/VMS). It works fine on HP-UX & NT, but on Alpha/VMS, it crashes when
> I attempt to use flock(HANDLE, LOCK_EX). Since multiple copies of the
> script can be running, I need to ensure exclusive access to the file in
> question.
>
> Any help/workarounds/alternative suggestions would be appreciated (I'm
> already doing some OS-specific stuff for NT, so I'm quite happy to code an
> alternative locking mechanism for VMS if that's what's needed, but I don't
> know what would be required off-hand).
>
> I'm using Perl 5.005_02 on Alpha/VMS, and perl 5.004_02 on NT & HP.
>
> Thanks in advance,
> Techno.
------------------------------
Date: 17 Mar 1999 17:55:24 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: flock() on Alpha/VMS
Message-Id: <7coqac$610$1@pegasus.csx.cam.ac.uk>
Dan Sugalski <sugalskd@netserve.ous.edu> wrote:
>
>The VMS port of perl doesn't support flock or fcntl at the moment.
>However... VMS has mandatory file locking--if you open a file for write,
>nobody else will be able to. (The open call will throw an error) You'll
>need a bit more checking on open to detect a locked file error, but you
>can skip flock entirely on VMS.
Wouldn't it be politer, and assist portability, if flock() was implemented
as a no-op on this platform, since that is what it effectively is with
mandatory locking?
Mike Guy
------------------------------
Date: Wed, 17 Mar 1999 10:10:40 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Hash of structs
Message-Id: <x3yd8288840.fsf@tigre.matrox.com>
Prem Gangalakunta <pgangala@i2.com> writes:
> push(
> @HoH{$fields[$idx_date]}{$fields[$idx_model_size]},
> ($fields[$idx_duration], $fields[idx_process_size])
> );
>
> The Error encountered is:
> Can't use subscript on associative array slice at
> BenchmarkIndustryByDate.pl line 110, near "]}"
> Type of arg 1 to push must be array (not associative array elem) at
> BenchmarkIndustryByDate.pl line
> 110, near ") )"
> ....
> (line 110 is the above push statement)
>
> HoH is declared as just "my %HoH;"
>
> What am I missing here? Is there a better way of doing it?
You are missing a very good read. Have a look at perldsc, which should
be included in the standard Perl documentation that should be
installed on your system.
It will clarify everything for you.
HTH,
Ala
------------------------------
Date: Wed, 17 Mar 1999 11:14:03 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Help on C-Kermit ...
Message-Id: <36EFFEFB.ECF588D3@mail.cor.epa.gov>
Victor Acevedo wrote:
> Hello :
> I have a problem , I'm using C-Kermit to make a phone connection,
> but I can't configure my modem properly, I think the problem is related
> to the assignation of the port .. Any idea ?
So why on earth did you cross-post this to a Perl newsgroup? I
don't want to appear rude or anything, but this really is a
violation of good Netiquette. It is possible that your question
may not be appropriate for *any* of the newsgroups you hit.
Please be careful in future. It would be embarrassing if you
gained a reputation as a net-abuser.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 17 Mar 1999 13:53:07 -0500
From: "William D. Redman" <wredman@ycc.kodak.com>
To: wredman@kodak.com
Subject: Input for PERL Course request
Message-Id: <36EFFA13.F751C60E@ycc.kodak.com>
I am working on putting together an introduction class for scripting in
awk and PERL. The focus is for students that have already completed an
introductory sequence that includes Bash scripting. They already
understand programming structures. This course is to be an offering in
IT, and within the System Administration concentration. I am looking
forward to putting together some fun labs with SA tasks. I need some
help starting out simply. What I am looking for is resources, besides
CPAN, for material. I am an avid reader of the ORA's PERL books. I am
looking for another training material source. Book review/suggestions
would also be appreciated.
Is there anyone with experience with the PERL Certification offered by
Ezone through Marquette University? Or PERL for Dummies? Programming
with AWK? others?
Thanks.
--
===============================================================================
William D. Redman ph: (716) 726-6315
wredman@kodak.com Fx: (716) 726-0002
pgr: (97)-53850
Work Schedule : http://www.rit.edu/~wdr3016
Eastman Kodak Company, 2-5-EP 901 Elmgrove Road, Rochester, NY
,14653-5401
Picture me saying these things, not Kodak.
No negative comments please
===============================================================================
------------------------------
Date: Wed, 17 Mar 1999 14:10:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Input for PERL Course request
Message-Id: <comdog-ya02408000R1703991410370001@news.panix.com>
In article <36EFFA13.F751C60E@ycc.kodak.com>, wredman@kodak.com posted:
> Is there anyone with experience with the PERL Certification offered by
> Ezone through Marquette University?
i guess you can get anyone to certify anything. i wonder who accredited
them to do that ;)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 17 Mar 1999 11:20:27 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Install ActivePerl?
Message-Id: <36F0007B.6C385D1C@mail.cor.epa.gov>
Michael Stevens wrote:
> Hi, I'm a Window95 user just starting with Perl. I have Perl for Win32
> build 315 installed on my computer. I have noticed a download from
> Activestate called ActivePerl. Could someone tell me if this would be
> better than my current installation? I know it comes with more tools but
> I'm not sure what they all do.
>
> If I do install ActivePerl do I need to uninstall my current interpreter
> first?
[1] Definitely get the current version of ActivePerl. Build 509.
FTP it down - it's faster that way. It installs really easily.
And it lets you install more cool modules right off of CPAN.
[2] If you want to be cautious (a reasonable approach), keep your
old build too.. for a while. Let the build 509 installer re-assign
your .pl extension to the new build. Then test Perl out on your
old scripts to see if everything works right. Once you have
confidence that the new build is doing what you want, then wipe
your old build off the face of the earth. Or store it on backup
tape in case of emergency. Whichever you feel more comfortable
doing.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 18 Mar 1999 08:45:29 +1300
From: Meh <aghaeim@genesis.co.nz>
Subject: Re: Login, redirect, and who is the user?
Message-Id: <36F00659.8C25AA0F@genesis.co.nz>
"Todd P." wrote:
>
> Im trying to get the user login information from Netscape Enterprise
> server 3.5.1. What I would like to do is, after the person logs in, they
> will be redirected to an specific area for them. I have tried the
> environment variables remote_user, auth_type, and remote_ident, but I get
> nothing. I have set the restriced areas up with the admin server that
> comes with netscape....
>
> Is there something that I am missing, do I need to set somthing up on the
> server?
>
> Pleas help...
>
> Todd
--
I you can't get REMOTE_HOST and REMOTE_ADDR, you may need look at your
server.
eg. my $remoteHost = $ENV{"REMOTE_HOST"};
---------------------------------------------------------------------
Protect privacy, boycott Intel PIII: http://www.bigbrotherinside.org
---------------------------------------------------------------------
------------------------------
Date: Wed, 17 Mar 1999 09:17:04 -1000
From: "Steve Bowen" <bowens001nospam@hawaii.rr.com>
Subject: new on subroutines
Message-Id: <36efe47b.0@news.hawaii.rr.com>
Well Im trying to learn perl
and
am using these modules:
main
#!/usr/bin/perl
# hellowww.pl
require "htmlend.pl";
print "Content-type: text/html", "\n\n";
print "<HTML>", "\n";
print "<TITLE>Perl meets the World Wide Web</TITLE>", "\n";
print "</HEAD>", "\n";
print "BODY>", "\n";
print "<H1>Hello, World!</H1>", "\n";
&HTML_Footer;
# End hellowww.pl
subroutine
#!/usr/bin/perl
# htmlend.pl
sub HTML_Footer
{
print "\n", "</BODY>", "\n";
print "</HTML>", "\n";
} #End HTML_Footer
but it doesnt work I get 500 errors
Am i messing up in the main module by specifying the location of the
subroutine file? I have tried several different things
Also one other question. If I say print COUNT 1;
does this store the value one in a file called COUNT and if so where is the
file located?
------------------------------
Date: Wed, 17 Mar 1999 14:39:52 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Steve Bowen <bowens001nospam@hawaii.rr.com>
Subject: Re: new on subroutines
Message-Id: <36F00508.B16DAAAC@giss.nasa.gov>
[courtesy copy of post sent to cited author]
Steve Bowen wrote:
>
> #!/usr/bin/perl
use the warnings switch:
#!/usr/bin/perl -w
> # hellowww.pl
> require "htmlend.pl";
<snip>
> &HTML_Footer;
> # End hellowww.pl
> #!/usr/bin/perl
#!/usr/bin/perl -w
> # htmlend.pl
> sub HTML_Footer
> {
> print "\n", "</BODY>", "\n";
print "\n</BODY>\n"; # no need to split your string
> print "</HTML>", "\n";
> } #End HTML_Footer
1; # always put this at the end of perl libs/mods
> but it doesnt work I get 500 errors
check that everyone has read permission for these files.
try running the code from the command line.
> Also one other question. If I say print COUNT 1;
> does this store the value one in a file called COUNT <sniP>
no.
> [...] and if so where is the
> file located?
Jay Glascoe
--
Narf!
--Pinky
------------------------------
Date: Wed, 17 Mar 1999 10:38:49 -0800
From: "Ekkis" <ekkis@arix.com>
Subject: Re: NT 4.0 Server Problems with CGI
Message-Id: <LESH2.10825$TD3.114319@typhoon-sf.pbi.net>
vtomchal@my-dejanews.com wrote in message
<7cm8os$k8f$1@nnrp1.dejanews.com>...
>I have an NT 4.0 Server with Active Perl. I am having problems running a
>simple perl CGI script and a simple NT batch CGI script from an HTML page.
I
>get the following error message:
>
>HTTP 1.0 / 501 Not Supported
>
>Is there something else that I need to be running at the server end, in
order
>for even a simple CGI batch file to be executed.
Vance,
You have to go tweak the registry to make it work. Below is a link to a
page that describes the process for the MS Private Web server. There are
similar instructions for IIS, etc.
http://dynamicnet.net/support/fp/perlwithPWS.htm
- e
------------------------------
Date: Thu, 18 Mar 1999 03:14:34 +0800
From: Cplee <cplee@bigfoot.com>
Subject: number convert
Message-Id: <36EFFF1A.C1B9F9D2@bigfoot.com>
Dear Netter
I would like to convert $numbe=123.345 to $dollars=123.35
what is the command I can use
Thank you
------------------------------
Date: Wed, 17 Mar 1999 14:20:20 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: cplee@bigfoot.com
Subject: Re: number convert
Message-Id: <36F00074.B2294014@giss.nasa.gov>
[courtesy copy sent to cited author]
Cplee wrote:
>
> I would like to convert $numbe=123.345 to $dollars=123.35
> what is the command I can use
"perldoc -f int" suggests using sprintf. So,
my $dollars = sprintf "%.2f", $number;
Jay Glascoe
--
"Just say 'Narf!'."
--Pinky
------------------------------
Date: Wed, 17 Mar 1999 13:10:13 -0600
From: Kent Wang <kentwang@mailcity.com>
Subject: Re: number convert
Message-Id: <36EFFE15.FEB25595@mailcity.com>
how about:
$number = 123.345;
$number = int($number * 100 + .5) / 100;
Kent Wang
Cplee wrote:
>
> Dear Netter
>
> I would like to convert $numbe=123.345 to $dollars=123.35
> what is the command I can use
>
> Thank you
------------------------------
Date: Wed, 17 Mar 1999 09:55:17 -0600
From: John Warner <jwarner@tivoli.com>
Subject: Re: Perl Win32::ODBC Error while using MS Access ODBC driver 4.0.
Message-Id: <36EFD065.CAD72906@tivoli.com>
Your problem is either with how the System DSN for Access is set up or in how
you are using Perl to access the db. What follows is cut from my own test
client/server app that uses an Access db for user authentication. It is rather
primitive but then again it was my first attempt at ODBC programming.
use DBI;
use DBD::ODBC;
# srvr must be a defined system DSN.
$srvr = 'dbi:ODBC:PERL_EXAMPLE';
$srvr_db_login ='';
$srvr_db_pwd = '';
my $dbh = DBI->connect($srvr, $srvr_db_login, $srvr_db_pwd, { RaiseError => 1
});
my $sqlstmt = "SELECT uid,password FROM UserInfo WHERE uid=\'$name\'";
print "DEBUG:---Lookup SQL: $sqlstmt\n";
my $sth = $dbh->prepare("$sqlstmt")or die "Cannot prepare statement:
$DBI::errstr\n";
print "DEBUG:---SQL Prepped. Executing SQL stmt now.\n";
$sth->execute;
print "DEBUG:---Found:\n";
while (@row = $sth->fetchrow_array) {
$n = $row[0];
$p = $row[1];
print "DEBUG:---Username: $n\tPassword: $p\n";
}
chomp $n; chomp $p;
print "DEBUG:---Comparing user input ($name\/$pwd)to database ($n\/$p).\n";
if ($name ne $n){
print "Invalid username.\n";
}elsif ($pwd ne $p){
print "Incorrect password.\n"; $Client->close;
}else {print "Login successful.\n";}
$sth->finish;
$dbh->disconnect;
Hope this helps.
Eric Pan wrote:
> I am using WindowsNT Server 4.0 SP 4, MS Access ODBC Driver 4.00, Perl
> Resource Kit SP1 and MS Office 97 SR-2. But I get the following errors while
> trying to insert a row into a MS Access table:
>
> Error: [-20309] [1] [0] "[Microsoft][ODBC Microsoft Access Driver] Operation
> not supported on replicable databases that have not been converted to the
> current version." Rows affected:
>
> But, I don't have any error retrieving row using SELECT statement. Do you
> know why? Please help.
--
John Warner Tivoli Systems Inc.
Sales Support Engineer 9442 Capital Of Texas Hwy North
Sales Infrastructure Group Austin, TX 78759
john_warner@tivoli.com
------------------------------
Date: Wed, 17 Mar 1999 18:25:49 GMT
From: Chad M. Townsend <chad@vcn.net>
Subject: pls/help with anonymous nested data structures
Message-Id: <7cos34$rep$1@nnrp1.dejanews.com>
-- snip --
%my_mother = (
'name' => 'Karen Townsend',
'age' => '55',
'children' => [
{
'name' => 'Chad Townsend',
'age' => '30',
'education' => [
{
'school' => 'UCLA',
'gpa' =>
'4.0'
}
]
},
{
'name' => 'Brad Townsend',
'age' => '25'
}
]
);
print "$my_mother{children}[0]{name}\n";
-- snip --
How do I access my 'gpa'.
thanks,
-chad
--------------------------------------------------------
Chad M. Townsend Virtual Community Network, Inc.
Chief Technical Officer Your Local Community Online!
chad @ vcn.net http://www.vcn.net
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 17 Mar 1999 13:53:13 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: "Chad M. Townsend" <chad@vcn.net>
Subject: Re: pls/help with anonymous nested data structures
Message-Id: <36EFFA19.3AE77466@giss.nasa.gov>
[courtesy copy of post sent to cited author]
"Chad M. Townsend" wrote:
>
> -- snip --
<snip>
> print "$my_mother{children}[0]{name}\n";
>
> -- snip --
<snip> ;^)
> How do I access my 'gpa'.
print my $gpa = $my_mother{children}[0]{education}[0]{gpa}, "\n";
> thanks,
hth,
Jay Glascoe
--
"Even if you do learn to speak correct English,
whom are you going to speak it to?"
--Clarence Darrow
------------------------------
Date: Wed, 17 Mar 1999 14:07:24 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: pls/help with anonymous nested data structures
Message-Id: <7cou4d$r8i$1@samsara0.mindspring.com>
Chad M. Townsend wrote in message <7cos34$rep$1@nnrp1.dejanews.com>...
:-- snip --
:%my_mother = (
: 'name' => 'Karen Townsend',
: 'age' => '55',
: 'children' => [
: {
: 'name' => 'Chad Townsend',
: 'age' => '30',
: 'education' => [
: {
: 'school' => 'UCLA',
: 'gpa' =>'4.0'
: }
: ]
: },
: {
: 'name' => 'Brad Townsend',
: 'age' => '25'
: }
: ]
: );
:
:print "$my_mother{children}[0]{name}\n";
:-- snip --
:How do I access my 'gpa'.
print "$my_mother{children}[0]{education}[0]{gpa}\n";
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
I already have too much problem with people thinking the efficiency of a
perl construct is related to its length. On the other hand, I'm perfectly
capable of changing my mind next week... :-)
- lwall
------------------------------
Date: Wed, 17 Mar 1999 14:58:17 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Pushing current line back onto <FILE>
Message-Id: <7cp13v$e0$1@samsara0.mindspring.com>
Jete Software Inc. wrote in message <7cjvtp$lvu@dgs.dgsys.com>...
:I need to push the current line back onto the <FILE> file handle
:open(FILE, "/tmp/junk") || die "Can't open /tmp/junk";
:while <<FILE>) {
: if (something) {
: push $_ back onto <FILE>;
: last;
: }
:}
:
:I need to learn to write this down, because I have figured this out 3 or 4
times
:in the last year, but I keep forgetting the solution and waste lots of time
trying
:to work it out. Then when I see how simple the solution is, I get pissed at
myself.
:
:Also I don't want nor need to do the following:
:
: @lines = <FILE>;
:
Well, if I understand you correctly, you could just type
perl -i.orig -ne 'if (something) {print and last}' /tmp/junk .. ..
at the prompt.
in a file you could use something like
#!/usr/local/bin/perl -i.orig -w
use strict;
my $file = '/tmp/junk';
@ARGV = $file;
while (<>) {
if (/something/) {
print;
last;
}
close ARGV if eof;
}
HTH
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Numbers are tools, not rules.
- Ashley-Perry Statistical Axioms[0]
[cc'd and mailed]
------------------------------
Date: Wed, 17 Mar 1999 19:34:58 GMT
From: hannu@ils.net.no.spam (Hannu)
Subject: scripts to organize Radius files
Message-Id: <36f00126.5258661@news.tor.sfl.net>
This wheel has propably been already invented:
I am trying to find a Perl script that would re-write Radius
(Livingston) detail files into a more computable one-line format.
This is how the records in the detail file look like now:
Mon Mar 15 00:04:03 1999
NAS-IP-Address = 309.134.121.6
NAS-Port = 81
NAS-Port-Type = Async
User-Name = "username"
Called-Station-Id = "9758213508"
Calling-Station-Id = "9754789496"
Acct-Status-Type = Start
Acct-Authentic = RADIUS
Service-Type = Framed-User
Acct-Session-Id = "0000644D"
Framed-Protocol = PPP
Acct-Delay-Time = 0
Timestamp = 921474243
I'd like to have something like this:
Mon Mar 15 00:04:03 1999: User-Name = "username"; Acct-Status-Type;
and so on, all in one line.
Any help appreciated!
Hannu
------------------------------
Date: Wed, 17 Mar 1999 13:28:33 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Send Form Data to the end of a URL within the HTML output
Message-Id: <7corrg$f22$1@samsara0.mindspring.com>
Shawn Carpenter wrote in message <7cms4m$j31$1@client2.news.psi.net>...
:Only problem is I don't know how to set up the script... any ideas???
What have you tried that isn't working for you?
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Hey, I had to let awk be better at *something*... :-)
- Larry Wall in <1991Nov7.200504.25280@netlabs.com>
------------------------------
Date: Tue, 16 Mar 1999 21:34:34 GMT
From: gkl200 <gkl200@my-dejanews.com>
Subject: STDERR redirection
Message-Id: <7cmipa$tt0$1@nnrp1.dejanews.com>
How do I redirect to STDERR in Perl when running a command
with backticks?
@lines=`/usr/bin/prog $argv`;
print @lines;
the program outputs fine but I get
the error "ld.so: warning :...."
going to the screen everytime.
I tried redirecting:
@lines=`/usr/bin/prog $argv 2> /dev/null/`;
but that didn't work.
thanks
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 17 Mar 1999 14:20:13 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: STDERR redirection
Message-Id: <comdog-ya02408000R1703991420130001@news.panix.com>
In article <7cmipa$tt0$1@nnrp1.dejanews.com>, gkl200 <gkl200@my-dejanews.com> posted:
> How do I redirect to STDERR in Perl when running a command
> with backticks?
by reading perlfaq8?
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 16 Mar 1999 12:01:07 -0800
From: "Ekkis" <ekkis@arix.com>
Subject: Re: symbolic method references?
Message-Id: <evSH2.10756$TD3.114562@typhoon-sf.pbi.net>
Ekkis wrote in message ...
>I'm now converting the package to a class so the function's become a
method.
>I can call it but can't figure out how to test for it's presence:
>
> $f = shift;
> $o = TST->new();
> $o->$f(); # works fine
> $o->$f() if defined &$o->$f; # dn't work
>
bad practise to answer one's questions, sorry.
I did figure it out though. Thanks to Malcolm Beattie (posting: 1997/09/25
"Determining if a method is defined for an object") for the answer. the
right way is:
$o->$f() if $o->can($f);
cool - e
------------------------------
Date: Tue, 16 Mar 1999 22:19:36 GMT
From: hojo <hojo@i-tel.com>
Subject: the life of brian(the $dbh variable)
Message-Id: <7cmldc$fm$1@nnrp1.dejanews.com>
To the list,
I am really missing something with mod_perl and perl and apache and
such. I am working with all sorts of persistant database examples but
cannot get any of them to work the way they are supposed to. So,my
question is this:
How do I make a variable in an Apache::Registry script persistant
forever? I try use vars qw($dbh), but the variable is gone after
the request is done. Which brings me to another question, how do
I monitor these variables from construction to destruction other than
just knowing the code in the scripts?
Thank you
=-=-=-=-=-=-=-=-=-=
David Hajoglou
Sys. Admin., Abbreviator
=-=-=-=-=-=-=-=-=-=
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 17 Mar 1999 14:14:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: the life of brian(the $dbh variable)
Message-Id: <comdog-ya02408000R1703991414090001@news.panix.com>
In article <7cmldc$fm$1@nnrp1.dejanews.com>, hojo <hojo@i-tel.com> posted:
> I am really missing something with mod_perl and perl and apache and
> such. I am working with all sorts of persistant database examples but
> cannot get any of them to work the way they are supposed to. So,my
> question is this:
> How do I make a variable in an Apache::Registry script persistant
> forever? I try use vars qw($dbh), but the variable is gone after
> the request is done.
are you sure? how are you sure?
it's diffiuclt to know what you are doing (right or wrong) without
seeing some code. you might also be sure that you read the mod_perl
docs carefully (and as many times as needed ;)
> Which brings me to another question, how do
> I monitor these variables from construction to destruction other than
> just knowing the code in the scripts?
kinda wondering what this post has to do with me...
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 17 Mar 1999 19:08:00 +0100
From: "Hr. Jochen Stenzel" <Jochen.Stenzel.gp@icn.siemens.de>
Subject: Tied filhandles and Storable::store()
Message-Id: <36EFEF80.938E30F6@icn.siemens.de>
Hello,
some days ago, I asked this question but unfortunately in HTML. May be
this was the reason for no response, so sorry for both HTML and retry:
I want to use tied filehandles with Storable::store_fd() which is
implemented via Perls C API. The "Advanced Perl Programming"
book says
that "once a variable is tied, even
accesses from the C API of the Perl library are delegated to the
corresponding tied object", but my code fails here. (It works well
together with print(), close() etc.)
Control is not delegated to my own function, and the C
function dies
with "Bad filehandle: BDATA at blib/lib/Storable.pm (autosplit
into
blib/lib/auto/Storable/_store_fd.al) line 127".
(BDATA is the tied "handle", and line 127 is the line were the C
function is called.)
Is there anything special I have to take care of?
Thanks in advance
Jochen
------------------------------
Date: Wed, 17 Mar 1999 19:15:11 GMT
From: mag@imchat.com (Mark P.)
Subject: unlink problem
Message-Id: <36effdf6.64473147@news.ionet.net>
I've used unlink several times and never had a problem, but
now I can't seem to get this to work even though it should. Anyone see
what I'm not seeing? This is simple code.
sub delete {
&ReadParse;
if ($in{'delete'} eq 'yes'){
unlink("$htmldir/$file");
}
The only thing I can think of is that the file resides in a
totally different directory, but that shouldn't make a difference. It
is on a server with ugh! FrontPage extensions installed and is in a
password protected directory. I tested this on my own server and it
didn't work there also.
------------------------------
Date: Wed, 17 Mar 1999 14:25:32 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: "Mark P." <mag@imchat.com>
Subject: Re: unlink problem
Message-Id: <36F001AC.DA7782CC@giss.nasa.gov>
[posted and mailed]
"Mark P." wrote:
>
> sub delete {
> &ReadParse;
> if ($in{'delete'} eq 'yes'){
> unlink("$htmldir/$file");
> }
(missing right paren)
We should always check the return values of system calls.
"unlink()" is a system call. So,
unlink "$htmldir/$file" or die "can't unlink file: $!";
Jay Glascoe
--
"They'll get my perl when they pry it
from my cold, dead /usr/local/bin."
--Randy Futor
------------------------------
Date: Wed, 17 Mar 1999 10:28:41 -0800
From: "Ekkis" <ekkis@arix.com>
Subject: Re: Very simple question
Message-Id: <hvSH2.10757$TD3.114562@typhoon-sf.pbi.net>
Barry wrote in message ...
>please answer this very simple perl question.
>this line reads a file into my perl script.
>open(FILE,"file.txt") || die;
>how do I read the file if its in a different directory? Lets say
>the one above it.
this is an OS question really. Every directory in Unix and MS contains a
subdirectory called ".." which refers to the parent directory, thus what you
want is:
open(FILE,"../file.txt") || die;
>open(FILE,"/file.txt") || die; this doesn't work.
this will try to read the file from the "root" directory - that is, the
topmost directory in your file system.
>open(FILE,"..file.txt") || die; this doesnt work either.
>please help.
this will try to open a file whose name begins with 2 dots.
------------------------------
Date: 17 Mar 1999 18:38:34 GMT
From: "Michael Rau" <m-rau@gmx.de>
Subject: Re: Very simple question
Message-Id: <7cosra$jql$1@surz18.HRZ.Uni-Marburg.DE>
open (F, "../file.txt");
:-)
mr.
Barry schrieb in Nachricht ...
>please answer this very simple perl question.
>this line reads a file into my perl script.
>open(FILE,"file.txt") || die;
>how do I read the file if its in a different directory? Lets say the one
>above it.
>open(FILE,"/file.txt") || die; this doesn't work.
>open(FILE,"..file.txt") || die; this doesnt work either.
>please help.
>I'm trying to test these scripts on my ISP's server if that matters.
>
>
>
>*** Posted from RemarQ - http://www.remarq.com - Discussions Start Here
(tm) ***
------------------------------
Date: Wed, 17 Mar 1999 13:27:19 -0600
From: "Spike White" <spike_YYwhiteYY@YYdellYY.com>
Subject: Re: Which OS am I in
Message-Id: <7cov27$mj4$1@obsidian.us.dell.com>
# perldoc -q 'which operating system'
Unknown option: q
perldoc [options] PageName|ModuleName|ProgramName...
perldoc [options] -f BuiltinFunction
...
Now back to the question -- how can a perl program tell whether
it is running under UNIX or something else?
Zenin wrote in message <921679664.481793@thrush.omix.com>...
>[posted & mailed]
>
>Stephen Montgomery-Smith <stephen@math.missouri.edu> wrote:
>: How can a perl program tell whether it is running under DOS
>: or UNIX?
>:
>: I looked for a uname like function for perl, but I didn't find it.
>
> perldoc -q 'which operating system'
>
>--
>-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
>BSD: A psychoactive drug, popular in the 80s, probably developed at UC
>Berkeley or thereabouts. Similar in many ways to the prescription-only
>medication called "System V", but infinitely more useful. (Or, at least,
>more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Wed, 17 Mar 1999 14:52:18 -0500
From: John Chambers <john.chambers@gte.com>
Subject: Re: Which OS am I in
Message-Id: <36F007F2.704F0FF@gte.com>
Zenin wrote:
>
> [posted & mailed]
>
> Stephen Montgomery-Smith <stephen@math.missouri.edu> wrote:
> : How can a perl program tell whether it is running under DOS
> : or UNIX?
> :
> : I looked for a uname like function for perl, but I didn't find it.
>
> perldoc -q 'which operating system'
Hmmm ... Here's what I get on this system. I don't see anything there
that even starts to answer the question. What's it supposed to do?
=====: perldoc -q 'which operating system'
Unknown option: q
perldoc [options] PageName|ModuleName|ProgramName...
perldoc [options] -f BuiltinFunction
Options:
-h Display this help message
-t Display pod using pod2text instead of pod2man and nroff
(-t is the default on win32)
-u Display unformatted pod text
-m Display modules file in its entirety
-l Display the modules file name
-v Verbosely describe what's going on
PageName|ModuleName...
is the name of a piece of documentation that you want to look at. You
may either give a descriptive name of the page (as in the case of
`perlfunc') the name of a module, either like `Term::Info',
`Term/Info', the partial name of a module, like `info', or
`makemaker', or the name of a program, like `perldoc'.
BuiltinFunction
is the name of a perl function. Will extract documentation from
`perlfunc'.
Any switches in the PERLDOC environment variable will be used before the
command line arguments.
=====: perl -v
This is perl, version 5.004_04 built for sun4-solaris
------------------------------
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 5158
**************************************