[17029] in Perl-Users-Digest
Perl-Users Digest, Issue: 4441 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 27 03:05:30 2000
Date: Wed, 27 Sep 2000 00:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970038312-v9-i4441@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 27 Sep 2000 Volume: 9 Number: 4441
Today's topics:
Re: An interesting situtation!!! Please help me!!! (Gwyn Judd)
Re: Can't print to filehandle while using IO::Socket <uri@sysarch.com>
Re: Candidate for the top ten perl mistakes list <bart.lateur@skynet.be>
Re: Candidate for the top ten perl mistakes list (Abigail)
Re: Candidate for the top ten perl mistakes list (Philip Lees)
Re: Controlling line length read by <> (Bernard El-Hagin)
Re: Date Conversion Question <godzilla@stomp.stomp.tokyo>
Re: determine where visitors are "living" (Philip 'Yes, that's my address' Newton)
Re: foreach two elements at a time? <uri@sysarch.com>
Re: foreach two elements at a time? (Abigail)
Re: How to get length of scalar? <uri@sysarch.com>
Re: How to get length of scalar? (Gwyn Judd)
Re: Levels of Perl Programmer (Thanks) <sxm124@po.cwru.edu>
Re: moving files across an intranet <elephant@squirrelgroup.com>
Re: Perl & WAIS (Gwyn Judd)
Re: perl modules and insecure dependency errors (Gwyn Judd)
Re: perl newbie question (Anthony Peacock)
Problem with open() <dhbayne@xtra.co.nz>
Re: Problem with open() <dhbayne@xtra.co.nz>
Re: Recursion in Perl <darryl@work-thicker.co.uk>
regex problem <mslho@my-deja.com>
Re: regexp woes w/ Text-BibTeX (Daniel Chetlin)
Re: Salary Range for Perl Programmers <uri@sysarch.com>
Re: sendmail <ldbarlet@email.msn.com>
Re: sendmail <mbudash@sonic.net>
Re: Setting cookies with CGI.pm <elephant@squirrelgroup.com>
Re: Thnaks to the Gurus! <uri@sysarch.com>
What does this do?! rathmore@tierceron.com
Re: What does this do?! (Gwyn Judd)
Re: Win32::API needs help <bart.lateur@skynet.be>
Re: www.perl.com won't come in on my computer.... (David Efflandt)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 Sep 2000 05:51:00 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: An interesting situtation!!! Please help me!!!
Message-Id: <slrn8t32m1.6s7.tjla@thislove.dyndns.org>
I was shocked! How could hsriniv@my-deja.com <hsriniv@my-deja.com>
say such a terrible thing:
>Hi everybody,
Hi.
>PLEASE HELP ME.
Okay.
>ANY KIND OF HELP IS APPRECIATED.
1) Don't shout.
2) Easy on the exclamation marks.
>THANKS IN ADVANCE.
No problem.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"Christianity makes suffering contagious."
[Friedrich Nietszche]
Atheism/Freethought fortune cookie file
------------------------------
Date: Wed, 27 Sep 2000 04:14:01 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Can't print to filehandle while using IO::Socket
Message-Id: <x74s32a2uv.fsf@home.sysarch.com>
>>>>> "AH" == Adrian Haris <adrian@duual.com> writes:
AH> Maybe I trimmed the code too much before posting.
AH> in fact it does start with use strict and the -w flag is on. And as I said
AH> I put dies everywhere, such as with the
AH> my $log = new IO::File ">>log.txt";
AH> In fact I tried everything obvious and normal. But still those 0kb files.
AH> I was sort of hoping someone would point out some weirdness wih the
AH> IO::Select or Socket modules I'm soverlooking.
have you done some simple writing to that file BEFORE the server loop?
just to make sure the handle is working at all. then test the result of
the print later and use the direct object syntax. if the handle is bogus
there, it will blow up. with indirect maybe not. the code looks ok at
first glance. is the server part working ok?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 27 Sep 2000 06:13:13 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <lv33ts08auu8khb1du116cjh3lemnjdg7u@4ax.com>
Bernie Cosell wrote:
>Maybe the next version of perl needs to have '<=' added as synonym for '=>'
>so you can always use the one that makes the most intuitive sense in
>context...
And what to do with the current "less then or equal" numlerical
comparison operator?
--
Bart.
------------------------------
Date: 27 Sep 2000 06:45:20 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <slrn8t35pi.lo9.abigail@alexandra.foad.org>
Bart Lateur (bart.lateur@skynet.be) wrote on MMDLXXXIV September MCMXCIII
in <URL:news:lv33ts08auu8khb1du116cjh3lemnjdg7u@4ax.com>:
&& Bernie Cosell wrote:
&&
&& >Maybe the next version of perl needs to have '<=' added as synonym for '=>'
&& >so you can always use the one that makes the most intuitive sense in
&& >context...
&&
&& And what to do with the current "less then or equal" numlerical
&& comparison operator?
(EXPR1 <=> EXPR2) < 1
HTH. HAND.
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: Wed, 27 Sep 2000 06:45:51 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <39d1977f.63928894@news.grnet.gr>
On Tue, 26 Sep 2000 13:45:23 -0400, Drew Simonis
<dsimonis@fiderus.com> wrote:
>Gwyn Judd wrote:
>>
>>
>> 8a. Uses tr/// when s/// is needed
>
>How about using a regex in the tr values?
I've done that one - it gets my vote.
Phil
--
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer
------------------------------
Date: 27 Sep 2000 06:00:44 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Controlling line length read by <>
Message-Id: <slrn8t338a.en.bernard.el-hagin@gdndev25.lido-tech>
Thanks everyone for your help with this.
Cheers,
Bernard
--
perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
print split/No such file or directory/;'
------------------------------
Date: Tue, 26 Sep 2000 21:47:07 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Date Conversion Question
Message-Id: <39D17BCB.65859E61@stomp.stomp.tokyo>
eT wrote:
> Greetings ... I am in the process of converting data from
> Sybase 4.x to MySQL. As I have noticed from other posts,
> I have now encountered the Date conversion challenge:
> I need to convert dates from eg:
> Apr 1 1991 12:00:00:000AM
> to:
> 1991-04-01 12:00:00
> I read somewhere that someone was using a Perl Module Date::Format or
> Date::Calc.
You have neglected to state your parameters clearly
and concisely. Surely this is an oversight on your
part to select the Twelve Hour Terminator, precisely,
for your example. You have failed to indicate if your
format is twenty-four hour or standard am / pm format.
This is an innocent oversight on your part, right?
I find it rather odd to view millisecond prints
for an AM / PM format. This is rare, very rare.
Perhaps those millisecond zeroes are a typo?
At precisely High Noon and High Midnight, time is neither
AM nor PM although societies typically label those one
or the other. High Noon is the Twelve Hour Terminator
and High Midnight is the Twenty-fourth Hour Terminator.
Use of AM or PM for these precise times, is incorrect,
for a millisecond, actually less if you wish to dive
into microseconds or picoseconds, maybe even infinity.
Nonetheless, these are metaphysical matters well beyond
the average comprehension of Techno-Geeksters.
Use of a module to accomplish your goal is illogical.
For this task, a module will serve to bloat your
memory usage and slow down your script, especially
if you process a lot of data. Electing to use a
module for this would be a poor choice in programming.
You may need to adjust Array Data to reflect your
month names as used in your data base.
If you wish, you can convert my test script into
incomprehensible Perl 5 Egyptian hieroglyphics
ending up with code perhaps a half dozen lines in
working code length. This is a personal choice.
Your choice of the Twelve Hour Terminator for
an example, is a coincidental oversight, yes?
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
TEST SCRIPT:
____________
#!/usr/local/bin/perl
print "Content-type: text/plain\n\n";
open (TEST, "test.txt");
@Array = <TEST>;
close (TEST);
print "Boss, your input is:\n\n";
foreach $input (@Array)
{ print $input; }
print "\n\nBoss, my output is:\n\n";
chomp (@Array);
@Data = qw (jan:1 feb:2 mar:3 apr:4 may:5 june:6
july:7 aug:8 sept:9 oct:10 nov:11 dec:12);
foreach $line (@Array)
{
foreach $data (@Data)
{
($key, $value) = split (/:/, $data);
if ($value < 10)
{ $value = "0$value"; }
$line =~ s/$key/$value/i;
}
$line =~ s/\s+/:/g;
($mon, $day, $year, $hour, $min, $sec, $am_pm) = split (/:/, $line);
if ($day < 10)
{ $day = "0$day"; }
if ($hour == 0)
{ $hour = "0$hour"; }
if ((index ($line, "12:00:00") == -1) &
(index ($line, "00:00:00") == -1))
{
if (rindex ($am_pm, "PM") > -1)
{ $hour = $hour + 12; }
else
{ $hour = "0$hour"; }
}
$new_date = "$year-$mon-$day $hour:$min:$sec";
print "$new_date\n";
}
print "\n\n\nAll done Boss.";
exit;
PRINTED RESULTS:
________________
Boss, your input is:
Apr 1 1991 12:00:00:000AM
Mar 15 44BC 0:00:00:000AM
Aug 6 1945 1:10:10:000AM
Aug 9 1945 8:03:23:000PM
Aug 8 1972 2:24:00:000AM
Boss, my output is:
1991-04-01 12:00:00
44BC-03-15 00:00:00
1945-08-06 01:10:10
1945-08-09 20:03:23
1972-08-08 02:24:00
All done Boss.
------------------------------
Date: Wed, 27 Sep 2000 06:50:56 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: determine where visitors are "living"
Message-Id: <39d1954e.93843146@news.tiscalinet.de>
On Tue, 26 Sep 2000 15:07:38 GMT, jonceramic@nospammiesno.earthlink.net
(Jon S.) wrote:
> If your site content has a valid reason for such info (like, say, the
> current weather on a portal site), people will tell you where they
> are. (Or, maybe where they'd like to be in the case of weather...)
And, as we heard before, not everyone wants to see the content that Big
Brother has declared "right" for them. Some Germans might want to see
the US version; some Japanese might want New Zealand news. Or whatever.
Let the user decide.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 27 Sep 2000 04:15:07 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: foreach two elements at a time?
Message-Id: <x71yy6a2sz.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@foad.org> writes:
A> Huh? What's wrong with lexical $a and $b?
A> I fail to see a problem here.
poor style. IMO.
in general i eschew single letter var names.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 27 Sep 2000 04:49:39 GMT
From: abigail@foad.org (Abigail)
Subject: Re: foreach two elements at a time?
Message-Id: <slrn8t2v0l.lo9.abigail@alexandra.foad.org>
Uri Guttman (uri@sysarch.com) wrote on MMDLXXXIV September MCMXCIII in
<URL:news:x71yy6a2sz.fsf@home.sysarch.com>:
%% >>>>> "A" == Abigail <abigail@foad.org> writes:
%%
%% A> Huh? What's wrong with lexical $a and $b?
%%
%% A> I fail to see a problem here.
%%
%% poor style. IMO.
%%
%% in general i eschew single letter var names.
Eh, that might be true, but that doesn't follow from "look at me, I use
$x and $y, and Abby uses $a and $b". $x and $y aren't any longer than
$a and $b.
Furthermore, it's a decades long tradition that loop variables can be
short - and one letter loop variables are quite common. $i, $j, $k, $n
for integers, $x, $y, $z for reals or coordinates, $z, $w, $v, $u for
complex variables.
$a and $b act here are loop variables. Since Perl is typeless, and there
wasn't any indication the elements in the array were in some domain,
$a and $b worked quite nicely.
Abigail
--
_ is a one single letter variable name.
------------------------------
Date: Wed, 27 Sep 2000 04:20:13 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How to get length of scalar?
Message-Id: <x7u2b28o07.fsf@home.sysarch.com>
did you actually have anything to say? or was it lost in the sea of html
crap?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 27 Sep 2000 04:52:29 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: How to get length of scalar?
Message-Id: <slrn8t2v8b.6s7.tjla@thislove.dyndns.org>
I was shocked! How could Mark Carruth <mcarruth@talk21.com>
say such a terrible thing:
>This is a multi-part message in MIME format.
Man in a box:
+----+
/ /|
+----+ |
| | |
| | +
| |/
+----+
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Never underestimate the power of human stupidity.
------------------------------
Date: Wed, 27 Sep 2000 00:55:51 -0400
From: Sid Malhotra <sxm124@po.cwru.edu>
Subject: Re: Levels of Perl Programmer (Thanks)
Message-Id: <39D17DD6.2CD35301@po.cwru.edu>
Thanks for this. It gave me a great laugh.
Sid.
Ps. I'm a user.
PropART wrote:
> Sid Malhotra wrote:
> >
> > I am looking for an article (probably written by Tom Christiansen) on
> > the levels of a perl programmer. I don't quite remember what exactly it
> > was but it listed the levels of a perl programmer and it's symptoms
>
> I saved this when I was learning Perl... Hope the line endings aren't
> screwed up.
>
> ****
>
> Subject: Re: Who is Just another Perl hacker?
> Date: 1 May 1999 09:09:14 -0700
> From: Tom Christiansen <tchrist@mox.perl.com>
> Organization: Perl Consulting and Training
> Newsgroups: comp.lang.perl.misc
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> cederstrom@kolumbus.REMOVE_THIS.fi writes:
> :But when do I become Just another Perl hacker? Who are they?
>
> +------------------------------+
> | Seven Levels of Perl Mastery |
> +------------------------------+
>
> Novice
>
> 1. Thinks CGI and Perl are interchangeable terms.
> 2. Still thinks Perl looks like bad C code viewed over a noisy modem.
> 3. Is insecure about the concept of dollar signs.
> 4. Thinks Perl should be more like sh or tcl.
> 5. Has heard of the ``Unix mindset'', but hopes it's a treatable
> condition.
> 6. Can't figure out how to read input from the keyboard.
> 7. Thinks regular expressions are somebody cursing.
> 8. Wonders why no one can give him a straight answer about whether
> Perl is
> compiled or interpreted.
>
> Initiate
>
> 1. Has begun to learn about $_ -- and doesn't like it a bit.
> 2. Thinks -w flag is a waste of time.
> 3. Thinks Perl should be more like C++ or Java.
> 4. Is still trying to figure why Perl has two different kinds of
> arrays.
> 5. Knows how to use perlbug, but sends in bogus bug reports.
> 6. Has been bitten by implicit context conversions, but hasn't caught
> on
> yet.
> 7. Can't keep == separate from eq, and thinks that + should
> concatenate
> strings.
>
> User
>
> 1. Thinks Perl is just for text processing.
> 2. Uses the Perl debugger.
> 3. Has used other people's modules.
> 4. Wonders what an object is.
> 5. Knows their way around CPAN.
> 6. Knows the difference between local and my.
> 7. Uses <DATA>.
> 8. Is still trying to figure what references are for.
> 9. Thinks Perl should be more like scheme or eiffel.
> 10. Submits real bug reports with perlbug.
>
> Expert
>
> 1. Write JAPHs to impress their friends and annoy their coworkers.
> 2. Begins all programs with use strict.
> 3. Thinks Perl should just be Perl.
> 4. Has taken enough advantage of cryptocontext to annoy others.
> 5. Knows how to create records and objects with hash refs.
> 6. Uses syscall to get at undocumented operating system calls.
> 7. Curses the flexibility of the Perl object system.
> 8. Uses /e in substitutes.
> 9. Has begun to wonder what typeglobs are for.
> 10. Has written their own modules in Perl.
> 11. Begins to look at all data in terms of regular expressions.
> 12. Understands why regexes can't match nested data.
> 13. Rewrites minor utilities in Perl.
>
> Hacker
>
> 1. Writes games in Perl.
> 2. Has written extension modules in C.
> 3. Uses AUTOLOAD and closures in curious ways.
> 4. Appreciates the aethetics of the Schwartzian Transform.
> 5. Delights in the flexibility of the Perl object system.
> 6. Has written their own pod2XXX translator.
> 7. Understands the output from Perl -Dflags.
> 8. Accesses the Perl symbol table directly.
> 9. Submits bug reports with working patches.
> 10. Edits files using a special Perl-embedded version of vi or emacs.
> 11. Has contributed modules, manpages, and tools to the standard Perl
> distribution.
>
> Guru
>
> 1. Can answer any Perl question instantly.
> 2. Can write anything in Perl -- and does.
> 3. Takes advantage of undocumented language features.
> 4. Writes code that gives even Larry pause.
> 5. Implements opaque objects and compiled regexes using closures.
> 6. Can read and understand the output of the perl-to-C compiler.
> 7. Embeds Perl interpreters in larger applications.
> 8. Has written their own -d:debugger module.
> 9. Used object-oriented programming before it existed.
> 10. Is debating taking their turn with the patch pumpkin.
>
> Wizard
>
> 1. Is on a first-name basis with Larry's wife.
> 2. Has written or rewritten major areas in the Perl compiler or
> interpreter.
> 3. Is thinking about rewriting the regex engine, the memory allocator,
> or
> the garbage collector.
> 4. Doesn't write games in Perl, because they realize that Perl itself
> is
> the game.
>
> --
> Real programmers can write assembly code in any language. :-)
> --Larry Wall in <8571@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Wed, 27 Sep 2000 17:16:56 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: moving files across an intranet
Message-Id: <MPG.143c49efa346b80d9897ce@localhost>
David Prowak wrote ..
>I need to move a file from a shared folder on a PC
>withing our intranet to our web server.
>
>I'd rather not use NET::FTP as then I'd have to run
>a program from the client PC. The client PC may
>change as time goes on, and I'd like to be controlling
>the whole process from the web server.
>
>Can FILE::COPY work across the network? I've tried,
>but to no avail.
>
>What other choices would I have?
that's entirely dependant on the network that you have in place ..
different networks allow different accesses to files across them
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 27 Sep 2000 05:33:14 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl & WAIS
Message-Id: <slrn8t31ko.6s7.tjla@thislove.dyndns.org>
I was shocked! How could Neb <berube@odyssee.net>
say such a terrible thing:
>Hello,
>
>I need to be able to index all my pages of my web site. I know that WAIS
>can do such a thing. But my site is entirely dynamically generated by a
>Perl script. Each HTML page is generated by the script. Is it possible to
>use WAIS with Perl scripts?
Not in general. Consider:
#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser/;
print header, rand;
I think we need a little more information about how the pages are
generated.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"Get back to your stations!"
"We're beaming down to the planet, sir."
-- Kirk and Mr. Leslie, "This Side of Paradise",
stardate 3417.3
------------------------------
Date: Wed, 27 Sep 2000 05:38:17 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: perl modules and insecure dependency errors
Message-Id: <slrn8t31u6.6s7.tjla@thislove.dyndns.org>
I was shocked! How could mari <mari@civil.columbia.edu>
say such a terrible thing:
>Im in the process of migrating mod_perl scripts from on server to
>another.. (Debian to Redhat).. and the only changes that have been made
>really are upgrading from Apache 1.3.9 to 1.3.12 and upgrading the
>Apache::Session module and other modules. I am running with PerlTaintCheck
>On, which simulates the -T switch, but so was the other server. I dont kow
>how they got around these errors w/o hacking the Apache::Session:File
>code.
Have you read the documentation in:
perldoc perlsec
I think you need to figure out just why Perl thinks data is tainted,
where you are getting that tainted data from and how you can safely
untaint it.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
At no time is freedom of speech more precious than when a man hits his
thumb with a hammer.
-- Marshall Lumsden
------------------------------
Date: 27 Sep 2000 06:42:54 GMT
From: a.peacock@chime.ucl.ac.uk (Anthony Peacock)
Subject: Re: perl newbie question
Message-Id: <8qs4te$k12$1@uns-a.ucl.ac.uk>
In article <A0BE1F23FD310DFE.4B40163F7CFBB85F.F78D8E6E30A1C301@lp.airnews.net>,
rbilyea@csac.com says...
>
>I've been called onto a task to help with a problem with perl connecting to
>a database via Netscape server and browser. The perl code written works
>when called via a telnet session but fails when accessed via browser through
>a Netscape server. The code fails on the line that attempts to get the
>database handle:
>
> $dbh = DBI->connect("dbi:Oracle:DBTEST", "xxx", "xxx",
> { RaiseError=>0, AutoCommit=>0 });
You are not checking the return status of the connect. The error message you
get below is indicative of the connect failing and assigning undef to $dbh.
Then, when you get to your $sth = $dbh->prepare... statement the database
handle is undef, which causes your error.
You need to either check the return value or set the PrintError attribute, ie:
$dbh = DBI->connect("dbi:Oracle:DBTEST", "xxx", "xxx",
{ PrintError=>1, RaiseError=>0, AutoCommit=>0 });
This will print out the error status of the connect statement. This is very
useful when you are first developing your package as you will automatically get
errors printed out.
Or if you want to produce your own error messages, once your application starts
to mature, you should check the value of $dbh for undef.
$dbh = DBI->connect("dbi:Oracle:DBTEST", "xxx", "xxx",
{ PrintError=>0, RaiseError=>0, AutoCommit=>0 }) or
die "Error connecting to database: $DBI::errstr";
The $DBI::errstr variable contains the text of the actual error, this will give
you a BIG clue as to why the connect was failing.
>
>The error:
> Software Error
> Can't call method prepare without a package or object reference
>
>These are the use declarations:
> use DBI;
> use CGI qw(:standard);
> use CGI::Carp qw(fatalsToBrowser);
>
>Any help would be greatlly appreciated
>
>
>
>
------------------------------
Date: Wed, 27 Sep 2000 17:26:03 +1200
From: "Duncan Bayne" <dhbayne@xtra.co.nz>
Subject: Problem with open()
Message-Id: <usfA5.1869$5qNb.34472011@news.xtra.co.nz>
Hi all,
Could someone please help me with a problem I'm having. I have a script I
am running on two RH machines, RH5.0 and 7.0. On the 7.0 machine, the
script runs perfectly. On the 5.0 machine, the following code:
# log details except password
open($LOG, '>>/home/grantlog/log.txt') or die;
dies with the following message:
Can't use an undefined value as filehandle reference at grant.cgi line
118, <STDIN> chunk 1.
Can anyone help?
Yours,
Duncan Bayne
------------------------------
Date: Wed, 27 Sep 2000 17:50:43 +1200
From: "Duncan Bayne" <dhbayne@xtra.co.nz>
Subject: Re: Problem with open()
Message-Id: <CPfA5.1875$5qNb.37093545@news.xtra.co.nz>
<obvious_explanation>
The solution is to open LOG, not $LOG. I checked the other manpages, which
contained the details.
</obvious_explanation>
Definite out-of-brain experience on my part.
"Duncan Bayne" <dhbayne@xtra.co.nz> wrote in message
news:usfA5.1869$5qNb.34472011@news.xtra.co.nz...
> Hi all,
>
> Could someone please help me with a problem I'm having. I have a script I
> am running on two RH machines, RH5.0 and 7.0. On the 7.0 machine, the
> script runs perfectly. On the 5.0 machine, the following code:
>
> # log details except password
> open($LOG, '>>/home/grantlog/log.txt') or die;
>
> dies with the following message:
>
> Can't use an undefined value as filehandle reference at grant.cgi line
> 118, <STDIN> chunk 1.
>
> Can anyone help?
>
> Yours,
> Duncan Bayne
>
>
------------------------------
Date: Wed, 27 Sep 2000 07:35:35 +0100
From: "CJ Llewellyn" <darryl@work-thicker.co.uk>
Subject: Re: Recursion in Perl
Message-Id: <mt7sq8.v1e1.ln@paulweller>
"Swamy Ananthanarayan" <anants@rpi.edu> wrote in message
news:39D11283.3FC0370B@rpi.edu...
> Greetings,
>
> Is there any way to perform recursion in perl? I would like a function
> to call itself everytime it hits a directory. So for example:
-snip-
Perl has a find function that performs the recursion for you, read the /me
bashes head against brick wall thread.
--
Regards, CJ Llewellyn
http://www.cjll.uklinux.net/
------------------------------
Date: Wed, 27 Sep 2000 04:06:51 GMT
From: Manuel Ho <mslho@my-deja.com>
Subject: regex problem
Message-Id: <8qrrop$2mk$1@nnrp1.deja.com>
hi folks,
suppose i have a string like this:
$myPattern = #...(garbage)#...(garbage)#...(garbage)#... etc
how should i write the regex such that $1
will be everything except the (garbage)?
thanks a lot!
manuel.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 27 Sep 2000 03:29:43 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: regexp woes w/ Text-BibTeX
Message-Id: <8qrpj70doi@news1.newsguy.com>
On 26 Sep 2000 09:31:00 -0500,
John Hunter <jdhunter@nitace.bsd.uchicago.edu> wrote:
>>>>>> "Keith" == Keith Calvert Ivey <kcivey@cpcug.org> writes:
> Keith> $arg =~ s/(?<!\\)([$special_chars])/\\$1/g;
> Keith> $arg =~ s/(?<!\\)"([^"]*)(?<!\\)"/``$1''/g;
>
>I knew about the first char problem but didn't know how to deal with
>it. I have updated my function with your improved regexps. I have
>not used the (?> construct before. The perlre page says its
>experimental and may be dropped... From your syntax, apparently
>anything matched by this operator is not fed into the substitution; is
>this what the man pages mean by zero width or 'give nothing back'? If
>you care to enlighten me a bit about this operator, I am all ears...
Be very careful ... note that Keith above used the `(?<' construct,
whereas you're referring to the `(?>' construct. These are very
different beasts. `(?<' is a lookbehind, which is zero width, as you
say. This means that while the REx engine does a check for the specified
pattern (actually, in this case it checks to make sure the specified
pattern _isn't_ there, as Keith is using the negated version) but it
doesn't eat it up as part of the match. You are probably more familiar
with at least one other kind of zero-width assersion, namely `$'. You'll
note that while `$' can match when there is a string with a newline at
the end, the newline itself won't be part of the match. E.g.:
[~] $ perl -we'"foo bar\n" =~ /bar$/; print $&'
bar[~] $
(If `$' matched the newline, you'd see the prompt appear on the line
after the `bar')
So what Keith is doing above with `(?<!\\)' is saying: match starting at
a point in the target string that does not have a backslash immediately
preceding it, and don't actually consume that preceding spot.
The lookbehind is _not_ an experimental feature, and is here to stay
barring something bizarre. The `(?>' feature which you accidentally
looked at in perlre _is_ experimental.
-dlc
------------------------------
Date: Wed, 27 Sep 2000 04:18:38 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Salary Range for Perl Programmers
Message-Id: <x7ya0e8o2o.fsf@home.sysarch.com>
>>>>> "RJ" == Russ Jones <russ_jones@rac.ray.com> writes:
RJ> Tom Briles wrote:
>>
>> Any class that allows its students to leave calling 'Perl' 'PERL' isn't
>> worth two cents, much less four hundred bucks.
RJ> I'd hope that any programming class that cost four hundred bucks would
RJ> concentrate on programming and ignore a bit of arcane trivia that has
RJ> no practical value to a working Perl programmer and is useful only to
RJ> the cognoscenti who wish to lord their superior knowledge over the
RJ> less fortunate.
using the wrong names and terms reflects poorly on the course and
instructor. that implies the rest of the course may be lousy as well.
same line of thought: any book with perl5 in the title sucks. there is no
perl5, just perl. try to find a decent book with perl5 in the
title. good luck.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 27 Sep 2000 02:14:06 -0400
From: "ldbarlet" <ldbarlet@email.msn.com>
Subject: Re: sendmail
Message-Id: <#58$2nEKAHA.357@cpmsnbbsa07>
My apologies but I wasn't as specific as I thought I need be. I am using a
cgi script to send email, I wanted to know if someone could point me in the
right direction on where to find info on how to write the correct code in
the script to send the mail in html format.
"Andrew N. McGuire " <anmcguire@ce.mediaone.net> wrote in message
news:Pine.LNX.4.21.0009261323500.17425-100000@hawk.ce.mediaone.net...
> On Tue, 26 Sep 2000, ldbarlet quoth:
>
> l> Can anyone point me in the right direction to learn how to use sendmail
to
> l> send email in html format?
>
> I do not know what on earth you would post this in a Perl newsgroup for,
> but sendmail will deliver email in HTML format without any modifications,
> you just have to have an MUA capable of rendering it.
>
> anm
> --
> # Andrew N. McGuire
> my $j = [ [ qw+ 4A 75 73 74 20 61 0 +] => [ qw+ 6E 6F 74 68 65 72 0 + ] =>
> ,,,,,,,,, [ qw+ 20 50 65 72 6C 20 0 +] => [ qw+ 48 61 63 6B 65 72 A + ] ];
> ;;;;;;;;; print map chr(hex()) => map @$_ => map @$j->[$_-0xA], 0xA .. 0xD
>
------------------------------
Date: Tue, 26 Sep 2000 23:57:47 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: sendmail
Message-Id: <mbudash-BF70F6.23574726092000@news.pacbell.net>
> > > Can anyone point me in the right direction to learn how to use
> > > sendmail to send email in html format?
> >
> > I do not know what on earth you would post this in a Perl newsgroup
> > for, but sendmail will deliver email in HTML format without any
> > modifications, you just have to have an MUA capable of rendering it.
> >
> My apologies but I wasn't as specific as I thought I need be. I am using
> a cgi script to send email, I wanted to know if someone could point me in
> the right direction on where to find info on how to write the correct code in
> the script to send the mail in html format.
>
simply send a "Content-type: text/html" header...
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Wed, 27 Sep 2000 17:14:05 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Setting cookies with CGI.pm
Message-Id: <MPG.143c4945be4f28c89897cd@localhost>
Anders Lund wrote ..
>Matthew Couchman wrote:
-
>> I'm using CGI.pm to get, then set the value of a cookie. I can get the
>> cookie fine and then i'm trying to set it to 0 using the line:
>>
>> $cookies{$key}->value("");
>
>I dont think that whatever is in $cookies{$key} has an object method
>value($) ;-))
>
>If you wish to store a list of cookies in a hash, you may wish to read the
>perlref docs,
>
>$perldoc perlref
>
>$c = $query->cookie($cookiename); # get the value of a named cookie
># compute a new value...
>...
># print the header with the new value
>print $query->header(-cookie(-name=>$cookiename, -value=>$value,
>path=>$path);
don't forget that to have the value saved past the current instance of
the browser (which seemed to be the question that was being asked) you
*must* set an expiry date
basically - if there's no expiry date then the cookie dies when you
close the browser .. with an expiry date - the cookie is written to the
filesystem
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 27 Sep 2000 04:11:46 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Thnaks to the Gurus!
Message-Id: <x77l7ya2yk.fsf@home.sysarch.com>
>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:
RLS> Yeah, a lot of the humor was excised from the third Camel. It now
RLS> reads rather dry and lifeless. At least they still have the first
RLS> humorous entry I wrote, regarding "Regular Expression: /Oh s.*t./".
RLS> Some of me lives in that book, still, in spite of the new authorship
RLS> status.
more rant-like humor as in the IPC shared memory section obviously
written by tom. i think i see some of jon's humor in there but it is
hard to differentiate his from larry's sometimes. i haven't read it all
the way thru yet.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 27 Sep 2000 05:40:51 GMT
From: rathmore@tierceron.com
Subject: What does this do?!
Message-Id: <8qs193$6ea$1@nnrp1.deja.com>
When I compile the following code, nothing visible happens. I noticed
that you can type and the type gets echoed back to the screen (or at
least shows up on the screen). When I watch the code running in the
debugger, I can follow what's happening but it just sits on the first
while statement. Anything that I type after hitting return gets added
to the $D scalar.
Am I missing something? How do I force a break in the while statement
without changing the code? Is this code brilliant or a waste of time?
(I'll share the source of where this came from after a few people post
their thoughts. Or maybe you've already seen it...)
#!/usr/bin/perl -s
$f=$d?-1:1;$D=pack('C*',33..86);$p=shift;
$p=~y/a-z/A-Z/;$U='$D=~s/(.*)U$/U$1/;
$D=~s/U(.)/$1U/;';($V=$U)=~s/U/V/g;
$p=~s/[A-Z]/$k=ord($&)-64,&e/eg;$k=0;
while(<>){y/a-z/A-Z/;y/A-Z//dc;$o.=$_}$o.='X'
while length ($o)%5&&!$d;
$o=~s/./chr(($f*&e+ord($&)-13)%26+65)/eg;
$0=~s/X*$// if $d;$o=~s/.{5}/$& /g;
print"$o\n";sub v{$v=ord(substr($D,$_[0]))-32;
$v>53?53:$v}
sub w{$D=~s/(.{$_[0]})(.*)(.)/$2$1$3/}
sub e{eval"$U$V$V";$D=~s/(.*)([UV].*[UV])(.*)/$3$2$1/;
&w(&v(53));$k?(&w($k)):($c=&v(&v(0)),$c>52?&e:$c)}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 06:05:18 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: What does this do?!
Message-Id: <slrn8t33gs.6s7.tjla@thislove.dyndns.org>
I was shocked! How could rathmore@tierceron.com <rathmore@tierceron.com>
say such a terrible thing:
>When I compile the following code, nothing visible happens. I noticed
>that you can type and the type gets echoed back to the screen (or at
>least shows up on the screen). When I watch the code running in the
>debugger, I can follow what's happening but it just sits on the first
>while statement. Anything that I type after hitting return gets added
>to the $D scalar.
You need to indicate end of file. That is done by typing Ctrl-D on my
computer (Linux). Or you can send thhe text you want to umm...convert in
a file like so:
perl solitaire.pl data_file > output.txt
>Am I missing something? How do I force a break in the while statement
>without changing the code? Is this code brilliant or a waste of time?
I can hardly read it in it's present form. I intend to have a closer
look in the weekend. Maybe someone should make it into a module.
>(I'll share the source of where this came from after a few people post
>their thoughts. Or maybe you've already seen it...)
Good book, isn't it?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
New systems generate new problems.
------------------------------
Date: Wed, 27 Sep 2000 06:35:57 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Win32::API needs help
Message-Id: <er43tsk6am9ovh12je872jrjm3davevb13@4ax.com>
Lucas wrote:
>I am going to call fuctions from a DLL, but it went something
>wrong in the output, so I need Perl guys here to help me.
>int spkTTS(char *string, double sentenceRate, short gender);
Oops. That second parameter looks like floating point to me. Win32API
doesn't use FP for parameters. Therefore, WIN32::API doesn't support it,
either. Sorry.
I am not sure how the call stack is constructed. Isn't a double 8 bytes?
Aren't the function arguments just simply pushed onto the call stack? I
haven't a clue on the order, but replacing the second parameter with two
long integers, and using pack 'd' and unpack 'VV', should allow you to
turn the double into two "integers", which you can then use for the
paremeters 2A and 2B, whatever their order might be.
p.s. AFAIK, all shorter integer formats are padded to 32bit in the API.
That should be ok here.
--
Bart.
------------------------------
Date: Wed, 27 Sep 2000 04:49:09 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: www.perl.com won't come in on my computer....
Message-Id: <slrn8t2v2o.2l7.efflandt@efflandt.xnet.com>
[Cc went to perl.com to make them aware of this]
On Sun, 24 Sep 2000, gerrit_griebel@my-deja.com
<gerrit_griebel@my-deja.com> wrote:
>
>> I have a weird problem that I'm not sure of the source. It could be
>> my DSL's problem or my Mac's problem. For some reason, when I'm
>> working on my Mac in MacOS, I can't get www.perl.com to come up in
>> either Netscape or Internet Explorer. I'm on SWBell's DSL (evil
>> bastards) and MacOS8.1 (no flames please).
>
>I have problem with Linux, DSL and Netscape and
>running vmware and IE I have the same behavior.
>I tried lynx and w3m: the same. I tried wget and
>got this:
>
>$ wget www.perl.com
>--20:53:09-- http://www.perl.com:80/
> => `index.html'
>Connecting to www.perl.com:80... connected!
>HTTP request sent, awaiting response... 302 Found
>Location: http://www.perl.com/pub [following]
>--20:53:10-- http://www.perl.com:80/pub
> => `pub'
> 0K ->
>
>20:53:11 (1.05 KB/s) - `pub' saved [14]
>
>The file pub then contains the line:
>
>REFER TO: <br>
Although I have no trouble accessing it with Linux Netscape ppp with my
own DNS, they do appear to have an apache config problem. For one thing
'http://www.perl.com:80/pub' is not a valid URL unless 'pub' is a file.
'wget -s www.perl.com' displays the above, but the saved file reveals
these headers from the redirect to http://www.perl.com:80/pub:
HTTP/1.1 200 OK
Date: Wed, 27 Sep 2000 04:10:52 GMT
Server: Apache/1.3.12 (Unix) PHP/4.0RC1
No configuration file for domain: www.perl.com:80, www.perl.com:80
Connection: close
Content-Type: text/html
REFER TO: <br>[eof with no newline]
Note: It is not a general apache problem because I can access my own name
based virtual host using 'wget -s http://www.de-srv.com:80/pub' properly
redirected to /pub/ without any problem.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4441
**************************************