[14022] in Perl-Users-Digest
Perl-Users Digest, Issue: 1432 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 19 14:26:05 1999
Date: Fri, 19 Nov 1999 11:25:47 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943039547-v9-i1432@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 19 Nov 1999 Volume: 9 Number: 1432
Today's topics:
overload [] {} and () <johnlin@chttl.com.tw>
Re: overload [] {} and () <gellyfish@gellyfish.com>
Re: overload [] {} and () <rhomberg@ife.ee.ethz.ch>
Re: overload [] {} and () (Ilya Zakharevich)
Re: perl optimizes away need for /o? was [/o in regexp <uri@sysarch.com>
Re: Perl programming sytle <kiesling@ix.netcom.com>
Re: Perl programming sytle (Scott McMahan)
Re: Perl programming sytle (Brett W. McCoy)
Re: PERL script with JScript embedded (Scott McMahan)
Re: Perl Scripts for NT (Scott McMahan)
Re: PerlShop, Minivend <mnarvaja@geocities.xyz.com>
Re: PerlShop, Minivend <jojo@buchonline.net>
Re: Please advise on URL robot checking PERL modules (Randal L. Schwartz)
Re: Please advise on URL robot checking PERL modules <uri@sysarch.com>
Re: Please advise on URL robot checking PERL modules (Simon Cozens)
Re: Please advise on URL robot checking PERL modules <moseley@best.com>
Re: Please advise on URL robot checking PERL modules <uri@sysarch.com>
Re: Please advise on URL robot checking PERL modules (brian d foy)
Re: Please advise on URL robot checking PERL modules (Randal L. Schwartz)
Please Help ~~~~~~~ (Bobo)
Re: printing a number with 3 digits <joseph.kazimierczyk@bms.com>
Problem regarding PerlScript on IIS <kiyolee*remove*@ctimail.com>
Problem with DBI/DBD for MySQL <mboerner@i1.net>
Re: Problem with DBI/DBD for MySQL (brian d foy)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 18 Nov 1999 16:15:00 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: overload [] {} and ()
Message-Id: <810chr$1o6@netnews.hinet.net>
I am not comparing everything in Perl with C++.
Just provide some opinions that might be useful.
In Perl, "use overload" doesn't include '[]', '{}' and '()'.
IMHO, [], {} and () are overloadable and might be quite useful.
For example:
my $greeting = new Greeting("Hello %s, nice to meet you!");
$greeting->("John");
$greeting->("Mary");
$greeting->("Tom");
$greeting->("Peter");
my $who = $greeting->[2];
my $order = $greeting->{"John"};
Hmm... You may challenge the usefulness and readability of
overloading these.
But since Perl has overload feature, why not have this feature
more complete? (Let the overloadable all overloadable.)
What do you think about it?
John Lin
P.S.
Hey, the following code has no error (but useless, of course).
package A;
use overload '[]' => \&get; # overload '[]' causes no error
sub get { 0 }
------------------------------
Date: 19 Nov 1999 09:43:10 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: overload [] {} and ()
Message-Id: <38351bae_1@newsread3.dircon.co.uk>
John Lin <johnlin@chttl.com.tw> wrote:
> I am not comparing everything in Perl with C++.
> Just provide some opinions that might be useful.
>
> In Perl, "use overload" doesn't include '[]', '{}' and '()'.
> IMHO, [], {} and () are overloadable and might be quite useful.
>
> For example:
>
> my $greeting = new Greeting("Hello %s, nice to meet you!");
>
> $greeting->("John");
> $greeting->("Mary");
> $greeting->("Tom");
> $greeting->("Peter");
> my $who = $greeting->[2];
> my $order = $greeting->{"John"};
>
>
> Hmm... You may challenge the usefulness and readability of
> overloading these.
>
> But since Perl has overload feature, why not have this feature
> more complete? (Let the overloadable all overloadable.)
>
> What do you think about it?
>
"Patches are always welcome"
/J\
--
"When the boys in the playground found out that I had a potentially
fatal peanut alergy they would shove me up against a wall and make me
play Russian roulette with a bag of Revels" - Milton Jones
------------------------------
Date: Fri, 19 Nov 1999 11:05:53 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: overload [] {} and ()
Message-Id: <38352101.48701807@ife.ee.ethz.ch>
John Lin wrote:
>
> I am not comparing everything in Perl with C++.
> Just provide some opinions that might be useful.
>
> In Perl, "use overload" doesn't include '[]', '{}' and '()'.
> IMHO, [], {} and () are overloadable and might be quite useful.
probably because of 'tie' which allows to overload different access
methods to your data structures already.
- Alex
------------------------------
Date: 19 Nov 1999 18:51:41 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: overload [] {} and ()
Message-Id: <81467t$qat$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Jonathan Stowe
<gellyfish@gellyfish.com>],
who wrote in article <38351bae_1@newsread3.dircon.co.uk>:
> John Lin <johnlin@chttl.com.tw> wrote:
> > I am not comparing everything in Perl with C++.
> > Just provide some opinions that might be useful.
> >
> > In Perl, "use overload" doesn't include '[]', '{}' and '()'.
> > IMHO, [], {} and () are overloadable and might be quite useful.
> "Patches are always welcome"
Patches for what? Overload supports all these operations - and more.
Ilya
------------------------------
Date: 18 Nov 1999 23:28:18 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: perl optimizes away need for /o? was [/o in regexp with mod_perl]
Message-Id: <x7r9hnqf4t.fsf@home.sysarch.com>
>>>>> "ll" == lee lindley <lee.lindley@bigfoot.com> writes:
ll> Uri Guttman <uri@sysarch.com> wrote:
ll> [snip]
ll> :> .... i don't worry about things that small in perl.
ll> I suspect lots of grinning smirks out there after they read
ll> this line from you. :-)
well, i don't claim to know all the nooks and crannies of our favorite
language. i just try to what knowledge i have in the best (for some
value of best) way possible. i can name major sections i don't know or
have never used, e.g i have never written a format as i don't do
reports. and ilya's bleeding edge regex features are way overboard for
my taste. i haven't really gotten into his latest and it took me a while
just to get into look(ahead|behind) though i use them sparingly now when
called for. we each pick and choose our favorite weapons and hope we hit
the broad side of the barn. /o is not something i have concerned myself
with and the new optimization makes it something i will probably never
think about again as i can just use qr// when needed.
ll> Actually, I kind of doubt that patches to perlre are welcome.
ll> I suspect it is due a full rewrite. Since I have spent much time
ll> reading perlre over the past several months, I gave some thought
ll> to this potential rewrite. Then I shuddered a bit and went on
ll> to something more pleasant. When you look at the breadth of the
ll> task -- the range of prior knowledge of the intended audience
ll> and the complexity of telling the full story of the regexp engine --
ll> well, "daunting task" becomes a term with a new perspective.
to put it mildly. especially ilya's latest and greatest. the text is as
clear as python with no white space. that may be why i don't want to
learn them in depth. where are the good open source tech writers when
you need them? and this shows the ever growing need for a new edition of
MRE.
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: 18 Nov 1999 23:01:15 -0500
From: Robert Kiesling <kiesling@ix.netcom.com>
Subject: Re: Perl programming sytle
Message-Id: <m3pux72kqc.fsf@ix.netcom.com>
David Cassell <cassell@mail.cor.epa.gov> writes:
> James Mohr writes:
> > Now I know I am free to write my programs. However, I would like to hear
> > other people's thoughts on perl programming style.
>
[text deleted]
But is one also
> then obligated to write code so that Lisp programmers
> can read it easily? And awk programmers? And FORTRAN
> programmers? And Python programmers? Writing code
> specifically for another language's practitioners seems
> like an odd requirement. You probably do not have
> people asking you to write your C code to look more like
> COBOL, do you? :-)
I assume you mean Perl code. Really, idiomatic Perl is a lot
different than C idioms or FORTRAN idioms. If you could find out if
anyone has categorized the idioms that Perl can handle due to its
overloading and contextualization of operators and functions, I'd bet
you'd be a lot closer to an answer.
And "hand krufted?" How many Perl contributors have backgrounds in
humanities or social sciences, vis-a-vis the traditional sciences that
are associated with programming? I was just wondering about that.
--
http://www.mainmatter.com
------------------------------
Date: Fri, 19 Nov 1999 18:26:20 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Perl programming sytle
Message-Id: <gDgZ3.289$AQ2.22013@newshog.newsread.com>
James Mohr (j.mohr@gisma.de) wrote:
> I figure that computers have reached the point where there is no need
> for making "tighter" code.
There is no known correllation between denser code and
code efficiency, anyway. Usually the "looser" code is
better for modern out-of-order execution processors.
Besides, who cares how "efficient" an interpreted language is?
Scott
------------------------------
Date: Fri, 19 Nov 1999 14:43:41 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: Perl programming sytle
Message-Id: <slrn83aola.ji3.bmccoy@moebius.foiservices.com>
Also Sprach Tom Phoenix <rootbeer@redcat.com>:
>> foreach $i (1..10) {
>>
>> is a lot easier to type than
>>
>> for($i = 0; $i < 10; $i++) {
>
>Yes, and the former counts from 1 to 10 a lot better than the latter. :-)
That's true... no worrying about fencepost problems!
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Fri, 19 Nov 1999 18:30:46 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: PERL script with JScript embedded
Message-Id: <qHgZ3.292$AQ2.22013@newshog.newsread.com>
Mark Henderson (markh@argolink.net) wrote:
> but the server spit up on it.
I have never heard of this, and don't know what you mean by "spit up on
it", but I have never heard of a web server not printing your CGI output
to the browser connection! Your *browser* may choke on what comes back,
especially if the MIME type is screwball, but the *server* just sends
your bytes back as you output them, unless there is a problem in running
the CGI program itself.
I have embedded JavaScript in the HTML output from a CGI program for
years, and there's absolutely nothing to it other than just adding the
text in-stream. Since you can do Perl variable interpolation on the
output, you can achieve some fancy effects.
Scott
http://autoperl.skwc.com Automating Windows With Perl
------------------------------
Date: Fri, 19 Nov 1999 18:32:05 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Perl Scripts for NT
Message-Id: <FIgZ3.293$AQ2.22013@newshog.newsread.com>
test test (test@test.com) wrote:
> I'm looking for some free perl scripts that are already ported to NT. If
> you could refer me to some good sources it would be greatly appreciated.
I wrote a bunch of stuff for NT in my book -- the code is free and it
works. You have to buy the book to get the CD, but that's no big deal. If
I wasn't overloaded with other stuff, I would bundle the code and put
it on my web site -- my Cron code is on there somewhere even now.
Scott
http://autoperl.skwc.com Automating Windows With Perl
------------------------------
Date: Fri, 19 Nov 1999 09:44:47 -0300
From: MN <mnarvaja@geocities.xyz.com>
Subject: Re: PerlShop, Minivend
Message-Id: <3835463F.8DBD8613@geocities.xyz.com>
Could anyone tell were to get the Minivend library, please?
Thanks in advanced,
Marcelo
emarkert@my-deja.com wrote:
> Go with Minivend... It's complex but worth the effort to get up and
> running and really not difficult.
>
> I tried Perlshop and while it's ok I found it very limiting and kludgy.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Fri, 19 Nov 1999 14:16:39 +0100
From: Hans-Joachim Leidinger <jojo@buchonline.net>
Subject: Re: PerlShop, Minivend
Message-Id: <38354DB7.5884F8EA@buchonline.net>
www.minivend.com
Regards,
Joachim
MN schrieb:
>
> Could anyone tell were to get the Minivend library, please?
> Thanks in advanced,
> Marcelo
>
> emarkert@my-deja.com wrote:
>
> > Go with Minivend... It's complex but worth the effort to get up and
> > running and really not difficult.
> >
> > I tried Perlshop and while it's ok I found it very limiting and kludgy.
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
--
Hans-Joachim Leidinger
buch online jojo@buchonline.net
Munscheidstr. 14 FAX: +49 209 1971449
45886 Gelsenkirchen
------------------------------
Date: 18 Nov 1999 21:20:21 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Please advise on URL robot checking PERL modules
Message-Id: <m17ljf6oru.fsf@halfdome.holdit.com>
>>>>> "Bill" == Bill Moseley <moseley@best.com> writes:
Bill> I'd be interested to hear the pros and/or cons of the two different
Bill> methods.
Me too. :-)
Actually, I'm currently designing a new version of this year's link
checker that stores all the data into a DBI database and forks
multiple processes. The fun part of the design which I'm working out
is how to have the kids tell the parent that they're done and ready
for the next one. I suppose I could have the parent set up a simple
protocol on a shared pipe, or maybe even just a mini-web-server.
That'd be cool... the kids could just post the results using HTTP as
the handshake. :)
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 19 Nov 1999 00:37:06 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Please advise on URL robot checking PERL modules
Message-Id: <x7ogcrqby5.fsf@home.sysarch.com>
>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:
RLS> Actually, I'm currently designing a new version of this year's link
RLS> checker that stores all the data into a DBI database and forks
RLS> multiple processes. The fun part of the design which I'm working out
RLS> is how to have the kids tell the parent that they're done and ready
RLS> for the next one. I suppose I could have the parent set up a simple
RLS> protocol on a shared pipe, or maybe even just a mini-web-server.
RLS> That'd be cool... the kids could just post the results using HTTP as
RLS> the handshake. :)
use Event.pm and it will be trivial. just fork off a bunch of piped
children (with open[23]) and feed them url's (some simple line oriented
protocol will do). read result lines back from the pipe when the pipes
are readable and send out a new url for each one read back. the results
lines would have the url and its status. make a good column i reckon,
especially teaching Event.pm
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: 19 Nov 1999 11:55:28 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Please advise on URL robot checking PERL modules
Message-Id: <slrn83aelg.ksp.simon@othersideofthe.earth.li>
Uri Guttman (comp.lang.perl.misc):
>>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:
> RLS> Actually, I'm currently designing a new version of this year's link
> RLS> checker that stores all the data into a DBI database and forks
> RLS> multiple processes.
>use Event.pm and it will be trivial. just fork off a bunch of piped
>children (with open[23]) and feed them url's (some simple line oriented
>protocol will do).
<injoke> You'd be far better off with POE. </>
--
"A radioactive cat has eighteen half-lives."
------------------------------
Date: Thu, 18 Nov 1999 22:01:05 -0800
From: Bill Moseley <moseley@best.com>
Subject: Re: Please advise on URL robot checking PERL modules
Message-Id: <MPG.129e8781cdf56e93989894@nntp1.ba.best.com>
Randal L. Schwartz (merlyn@stonehenge.com) seems to say...
> >>>>> "Bill" == Bill Moseley <moseley@best.com> writes:
>
> Bill> I'd be interested to hear the pros and/or cons of the two different
> Bill> methods.
>
> Me too. :-)
>
> Actually, I'm currently designing a new version of this year's link
> checker that stores all the data into a DBI database and forks
> multiple processes. The fun part of the design which I'm working out
> is how to have the kids tell the parent that they're done and ready
> for the next one. I suppose I could have the parent set up a simple
> protocol on a shared pipe, or maybe even just a mini-web-server.
> That'd be cool... the kids could just post the results using HTTP as
> the handshake. :)
Mine is boring. I just give the children chunks and wait(). I haven't
figured out how many children to spawn at one time. I keep adding more
children while waiting for the sysadmin to complain. I'm not sure if
I'll run out of memory or bandwidth first.
The children write to a /tmp/$$ type of file and when all the children
are done the parent reads all the separate files. What does help is
that the parent then sleeps for an hour or so and feeds the errors back
to the children again. I repeat this a few times or until there's no
change in the number and type of errors. This has really helped slim
down the false/short term errors that were being reported.
What I'd like to add is history. It would be nice to say that some URL
has been reporting a 500 error every week for a month, for example. As
it is now the people that read the report ignore the 500 errors as they
often seem to get fixed by the time they get around to look over the
report.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 19 Nov 1999 01:10:03 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Please advise on URL robot checking PERL modules
Message-Id: <x7hfijqaf8.fsf@home.sysarch.com>
>>>>> "BM" == Bill Moseley <moseley@best.com> writes:
BM> Mine is boring. I just give the children chunks and wait(). I haven't
BM> figured out how many children to spawn at one time. I keep adding more
BM> children while waiting for the sysadmin to complain. I'm not sure if
BM> I'll run out of memory or bandwidth first.
BM> The children write to a /tmp/$$ type of file and when all the children
BM> are done the parent reads all the separate files. What does help is
BM> that the parent then sleeps for an hour or so and feeds the errors back
BM> to the children again. I repeat this a few times or until there's no
BM> change in the number and type of errors. This has really helped slim
BM> down the false/short term errors that were being reported.
do a proper server with event.pm. it may actually be simpler than your
design and it has much more flexibility. see my other post in this
thread for basic design.
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: Fri, 19 Nov 1999 03:41:44 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Please advise on URL robot checking PERL modules
Message-Id: <brian-ya02408000R1911990341440001@news.panix.com>
In article <m17ljf6oru.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. Schwartz) posted:
> >>>>> "Bill" == Bill Moseley <moseley@best.com> writes:
>
> Bill> I'd be interested to hear the pros and/or cons of the two different
> Bill> methods.
>
> Me too. :-)
>
> Actually, I'm currently designing a new version of this year's link
> checker that stores all the data into a DBI database and forks
> multiple processes.
does this mean you don't like Parallel::UserAgent anymore?
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: 19 Nov 1999 06:39:38 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Please advise on URL robot checking PERL modules
Message-Id: <m1aeoa5yvp.fsf@halfdome.holdit.com>
>>>>> "brian" == brian d foy <brian@smithrenaud.com> writes:
brian> does this mean you don't like Parallel::UserAgent anymore?
No, I'm just refusing to use it until Gisle finishes LWPng, which has
a different interface around a real event loop. :)
I have a Parallel link checker prototype using LWPng, but there's some
error in how LWPng handles some of the initialization, so I get fatal
hits at some untrappable places. And patching LWPng which already
isn't documented and will likely change once a good event loop is
standardized is not in my near future.
Besides, I wanted to try a forking version as an alternative
implementation strategy... my WebTechniques articles are about demoing
different types of technology to get at those slightly harder to solve
problems. Doesn't always mean I'll write the easiest or cleanest way
to do something, but it might be an inspriration to one of y'all about
how to do something *else* in a much cleaner way.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 19 Nov 1999 17:38:56 GMT
From: bobo@bobo.com (Bobo)
Subject: Please Help ~~~~~~~
Message-Id: <8141vg$lla2@imsp212.netvigator.com>
How to write the perl script to get and display the no. of hits of many links
within a web page?
Thanks.
------------------------------
Date: Fri, 19 Nov 1999 12:25:32 -0500
From: Joe Kazimierczyk <joseph.kazimierczyk@bms.com>
Subject: Re: printing a number with 3 digits
Message-Id: <3835880C.4AD524CE@bms.com>
printf '%03d', 7;
"G.Ananth Somayaji" wrote:
> Hi,
> I am trying to print a number so that it should always
> have only 3 digits. For example 7 should be printed as 007. Looks
> sort of a simple task but the solution has evaded me for a couple
> of days now.
------------------------------
Date: Fri, 19 Nov 1999 17:57:10 +1100
From: "Kiyo Kelvin Lee" <kiyolee*remove*@ctimail.com>
Subject: Problem regarding PerlScript on IIS
Message-Id: <812scm$ipj$1@newton.pacific.net.au>
On my machine running IIS 4.0 and ActiveState PerlScript build 522, I found
that PerlScript only functions on the Default Web Site bound to the default
IP address. For other virtual site bound to other IP address, PerlScript
inside an HTML page is simply ignored by the browser.
Is there anybody has the same problem and knows the solution?
Kiyo
------------------------------
Date: Thu, 18 Nov 1999 22:36:47 -0000
From: "Michael" <mboerner@i1.net>
Subject: Problem with DBI/DBD for MySQL
Message-Id: <er4Z3.83$zA4.582361@news1.i1.net>
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01BF3215.662695D0
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
I have a problem I just don't understand. I get an error:
[Thu Nov 18 15:12:14 1999] atml.pl: Database handle destroyed without =
explicit
disconnect at ATML/module.pm line X. (see the code fragment bellow).
The thing I don't understand is I do essentially the same thing in the =
code above it, and in several other places
throughout the module. Any suggestions? I don't understand it at all. =
If I put a disconnect statement in, I get an
error associated with the second execute command complaining about a =
token being broken... The strange thing
is that the code appears to work, creating a reasonable output file.
Thanks in advance.
Michael
my $db=3D"database";
my $user=3D"user";
my $pw=3D"";
my $server=3D"server";
my $dbh =3D DBI->connect("dbi:mysql:$db", $user, $pw) || die =
"Cannot connect: $DBI::errstr\n" unless $dbh;
$SQL=3D"select * from table1";
eval{
$table_data =3D $dbh->prepare($SQL);
}; # End of eval
if ($@) {
open(LOG,">>EXTRACT.LOG");
# error handling
} else {
$table_data->execute || die "Cannot execute: $DBI::errstr\n";
}
unless ($table_data) {
# error handling
}
open(OUTPUT,">EXTRACT1.OUT");
while(my(@data)=3D$table_data->fetchrow_array) {
foreach (@data) {
print OUTPUT "$_\t";
}
print OUTPUT "\n";
}
close(OUTPUT);
$SQL=3D"select * from table2";
eval{
$table_data =3D $dbh->prepare($SQL);
}; # End of eval
X if ($@) {
# error handling
} else {
$table_data->execute || die "Cannot execute: $DBI::errstr\n";
}
unless ($table_data){
# error handling.
}
------=_NextPart_000_0008_01BF3215.662695D0
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dwindows-1252" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>I have a problem I just don't understand. I get an =
error:</DIV>
<DIV> </DIV>
<DIV>[Thu Nov 18 15:12:14 1999] atml.pl: Database handle destroyed =
without=20
explicit<BR>disconnect at ATML/module.pm line X. (see the code fragment=20
bellow).</DIV>
<DIV> </DIV>
<DIV>The thing I don't understand is I do essentially the same thing in =
the code=20
above it, and in several other places</DIV>
<DIV>throughout the module. Any suggestions? I don't =
understand it=20
at all. If I put a disconnect statement in, I get an</DIV>
<DIV>error associated with the second execute command complaining about =
a token=20
being broken... The strange thing</DIV>
<DIV>is that the code appears to work, creating a reasonable output =
file.</DIV>
<DIV> </DIV>
<DIV>Thanks in advance.</DIV>
<DIV> </DIV>
<DIV>Michael</DIV>
<DIV><BR> my =
$db=3D"database";<BR> =20
my $user=3D"user";<BR> my=20
$pw=3D"";<BR> my $server=3D"server";</DIV>
<DIV> </DIV>
<DIV> my $dbh =3D =
DBI->connect("dbi:mysql:$db", $user,=20
$pw) || die "Cannot connect: $DBI::errstr\n" unless $dbh;</DIV>
<DIV> </DIV>
<DIV> $SQL=3D"select * from table1";</DIV>
<DIV> </DIV>
<DIV> =20
eval{<BR> =
$table_data =3D=20
$dbh->prepare($SQL);<BR> }; # End of=20
eval<BR> if ($@)=20
{<BR> =20
open(LOG,">>EXTRACT.LOG");<BR> &=
nbsp; =20
# error handling<BR> } else=20
{<BR> =20
$table_data->execute || die "Cannot execute:=20
$DBI::errstr\n";<BR> }</DIV>
<DIV> </DIV>
<DIV> unless ($table_data)=20
{<BR> # error=20
handling</DIV>
<DIV> }</DIV>
<DIV> </DIV>
<DIV> =20
open(OUTPUT,">EXTRACT1.OUT");<BR> =20
while(my(@data)=3D$table_data->fetchrow_array)=20
{<BR> foreach =
(@data)=20
{<BR> &n=
bsp; =20
print OUTPUT =
"$_\t";<BR> =20
}<BR> print OUTPUT =
"\n";<BR> }<BR> =20
close(OUTPUT);</DIV>
<DIV> </DIV>
<DIV> $SQL=3D"select * from table2";</DIV>
<DIV> </DIV>
<DIV> eval{<BR> =20
$table_data =3D $dbh->prepare($SQL);<BR> }; # =
End of=20
eval<BR><FONT size=3D3><EM><STRONG>X if ($@)=20
{<BR> =20
</STRONG></EM></FONT># error handling</DIV>
<DIV> } else=20
{<BR> =20
$table_data->execute || die "Cannot execute:=20
$DBI::errstr\n";<BR> }</DIV>
<DIV> </DIV>
<DIV> unless ($table_data){</DIV>
<DIV> # error handling.</DIV>
<DIV> }<BR></DIV></BODY></HTML>
------=_NextPart_000_0008_01BF3215.662695D0--
------------------------------
Date: Fri, 19 Nov 1999 03:44:01 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Problem with DBI/DBD for MySQL
Message-Id: <brian-ya02408000R1911990344010001@news.panix.com>
In article <er4Z3.83$zA4.582361@news1.i1.net>, "Michael" <mboerner@i1.net> posted:
> I have a problem I just don't understand. I get an error:
>
> [Thu Nov 18 15:12:14 1999] atml.pl: Database handle destroyed without =
> explicit
> disconnect at ATML/module.pm line X. (see the code fragment bellow).
disconnect from the database when you are done with it. see the DBI
docs for more information.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
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 1432
**************************************