[16286] in Perl-Users-Digest
Perl-Users Digest, Issue: 3698 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 17 21:05:31 2000
Date: Mon, 17 Jul 2000 18:05:17 -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: <963882316-v9-i3698@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 17 Jul 2000 Volume: 9 Number: 3698
Today's topics:
Re: $sth->{PrintError} and Huge Queries? (Mark W. Schumann)
Re: [NEW-B] What's wrong with this script? (Abigail)
Re: [NEWBI] Reg Exp request for help (Craig Berry)
Active State Perl on IIS 4.0 <kuzmin@hotmail.com>
ARRAY PROBLEM <-EViL-DOC-@BLUR.COM>
ARRAY PROBLEM <-EViL-DOC-@BLUR.COM>
closing read-only filehandles [was: Read a file into a (jason)
Re: context confusion <sumus@aut.dk>
Re: context confusion (Abigail)
Re: convert file permissions; octal-->stat mercma@my-deja.com
Re: Extra Path Information in CGI (Mark W. Schumann)
Re: Fancy mail, need help <wimmmel@hotmail.com>
Re: Formatting html file <sumus@aut.dk>
Re: HELP - POST to URL and capture results <tony_curtis32@yahoo.com>
Re: Help Wanted (Mark W. Schumann)
How can i identify a "Not Integer" string ? <election@qualitynet.net>
Re: How can i identify a "Not Integer" string ? (jason)
Re: how to convert "1.2.3.10" to "01020310"? (Craig Berry)
Re: How to get the machine (archtechture) type in Perl? (Abigail)
MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible?? vartekquest@my-deja.com
Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible? <josh@Jessey.uberlab>
nasty DESTROY behaviour arandachristian@hotmail.com
Re: nasty DESTROY behaviour (jason)
Re: nasty DESTROY behaviour <sumus@aut.dk>
Re: Need help with a regular expression <bart.lateur@skynet.be>
Re: Net::Smtp problems (Logan Shaw)
Re: NT4 can't create file in cgi-bin (jason)
Object somehow becoming unblessed? (Steve Leibel)
Re: Object somehow becoming unblessed? (Gary E. Ansok)
Re: Object somehow becoming unblessed? (Steve Leibel)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 Jul 2000 20:17:48 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: $sth->{PrintError} and Huge Queries?
Message-Id: <8l07nc$ku8@junior.apk.net>
In article <8kves2$19s$1@nnrp1.deja.com>, <jlsimms@my-deja.com> wrote:
>I am having an interesting problem to which I have found an even more
>interesting solution. The problem arose when I was trying to execute
>extremely large queries (on the order of > 1.2 million characters) on
>the database (mySQL). Say I have a _very_ large query, that looks
>something like this:
>
>$sql = SELECT id, name from mytable where name IN ( name1, name2 ...
>name1000000)
No it doesn't. That won't compile.
>In my code, I can prepare it without a hitch:
>
>$sth = $dbh->prepare($sql);
I don't believe you.
>But when I go to execute it, doing a plain $sth->execute, it hangs...
>The strange thing is that this query worked before, so I went to find
>the difference in the old database code and my stuff. The only
>difference was that in the original code, before the execute() but after
>the prepare(), I set $sth->{PrintError} to 0.
>
>After inserting this single line of code that sets $sth->{PrintError} to
>0, the huge query executed without a problem and returned a correct
>result set.
>
>Why would PrintError allow or not allow a large query to go through? In
>either case (whether PrintError is set to 1 or 0), smaller queries
>execute fine. The threshold is something around a length() of 1.2
>million characters... Any ingight? Again, this is on mySQL 3.22.32 on
>RedHat Linux, with the standard Perl DBI.
Hmmmm. Is this programming running under CGI?
In any case, try posting some cut-n-pasted code so we can see exactly
what you're trying to do.
------------------------------
Date: 17 Jul 2000 18:25:00 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: [NEW-B] What's wrong with this script?
Message-Id: <slrn8n72v4.ibq.abigail@alexandra.delanet.com>
Kliffoth (?@?.?) wrote on MMDXII September MCMXCIII in
<URL:news:Uttc5.398456$k22.1761341@flipper>:
"" I wrote a script to look at an array of loose words, then print "okay" if
"" the word "bla" is in the array, but I just keep getting "okay" wether the
"" word is in the array or not, and I just can't find out where the problem is
"" :-(
""
""
"" foreach $WORD (@WORD_LIST)
"" {
"" $LOW_WORD = lc $WORD;
"" $HASH{$LOW_WORD} = 1;
"" }
""
"" if ($HASH{'bla'} = 1)
"" {
"" print "okay";
"" }
"" else
"" {
"" print "not okay";
"" }
Always, always, ALWAYS use -w!
Run your program with warnings turned on, and Perl will tell you where
you went wrong.
Abigail
--
BEGIN {$^H {join "" => ("a" .. "z") [8, 13, 19, 4, 6, 4, 17]} = sub
{["", "Just ", "another ", "Perl ", "Hacker\n"] -> [shift]};
$^H = hex join "" => reverse map {int ($_ / 2)} 0 .. 4}
print 1, 2, 3, 4;
------------------------------
Date: Tue, 18 Jul 2000 00:11:08 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: [NEWBI] Reg Exp request for help
Message-Id: <sn784smlo53176@corp.supernews.com>
Ken Loomis (kloomis@bigplanet.com) wrote:
: I need to take a user's input and convert it to "Proper Case".
[snip]
First, be aware that any attempt to impose case on names is doomed. How
do you handle e.g. MacMann? And there are a zillion other cases where
that came from.
If you really want to do this, and piss of a lot of Scots :), see the uc,
lc, ucfirst, and lcfirs functions, and their parallel \U, \L, \u, and \l
inline-string operators for use in regexes.
: Also, does anyone know of a book or online tutorial that does a great
: job of explaining regular expressions?
_Mastering Regular Expressions_ (from O'Reilly) will teach you more than
you thought existed about the subject.
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Mon, 17 Jul 2000 16:01:34 -0800
From: "Oleg Kuzmin" <kuzmin@hotmail.com>
Subject: Active State Perl on IIS 4.0
Message-Id: <sn77db1io53113@corp.supernews.com>
Greetings!
I'm trying to make Active State Perl work on IIS 4.0 to be able to create
server-side scripts in Perl, not only in JavaScript or VBScript. I couldn't
make it run successfully on my web server yet. Is there a site with good
instructions on how to set it up?
Thanks,
Oleg
------------------------------
Date: Tue, 18 Jul 2000 09:24:52 +1000
From: "-EViL-DOC-" <-EViL-DOC-@BLUR.COM>
Subject: ARRAY PROBLEM
Message-Id: <39739485@ns1.access1.com.au>
Hi,
I am reading 2 files into separate arrays
@array1 contains many lines of the following format.
$array1[0] contains integer1,integer2,integer3,integer4,integer5,integer6
@array2 contains many lines of the following format.
$array2[0] contains integer1,integer2,integer3,integer4
My question is how can i add the say third element from
$array1[1] (EG. integer1,integer2,integer3,integer4)
^^ This one
to the 2nd element of $array1[3] (EG. integer1,integer2,integer3,integer4
^^ This one
Thanks in advance !
------------------------------
Date: Tue, 18 Jul 2000 09:26:18 +1000
From: "-EViL-DOC-" <-EViL-DOC-@BLUR.COM>
Subject: ARRAY PROBLEM
Message-Id: <397394cb$1@ns1.access1.com.au>
Hi,
I am reading 2 files into separate arrays
@array1 contains many lines of the following format.
$array1[0] contains integer1,integer2,integer3,integer4,integer5,integer6
@array2 contains many lines of the following format.
$array2[0] contains integer1,integer2,integer3,integer4
My question is how can i add the say third element from
$array1[1] (EG. integer1,integer2,integer3,integer4)
^^ This one
to the 2nd element of $array1[3] (EG. integer1,integer2,integer3,integer4
^^ This one
Thanks in advance !
------------------------------
Date: Mon, 17 Jul 2000 23:04:24 GMT
From: elephant@squirrelgroup.com (jason)
Subject: closing read-only filehandles [was: Read a file into a hash ?]
Message-Id: <MPG.13de2e48abbb94069896da@news>
Larry Rosler wrote ..
>Closing a file opened for reading is pointless, unless another process
>or later in this process intends to access it.
I don't really "get" this attitude of not closing read filehandles ..
and I'd appreciate anyone's explanation who supports this practice
Larry's rationale above seems to be that we don't need to do it - so why
do it .. the implication is that we know in advance how our program will
be used
if we all knew every situation that all our code was going to be used in
- then there'd be little reason to do a lot of the things that this
group seems to hold high (including using taint, using HTML::Parser, and
localising special vars)
surely the closing of read filehandles is pro-active programming -
preventing problems that arise from unforseen uses of our code .. the
filehandle is going to be closed at some point - so why not do it
explicitly when we're finished with it
at worst this is self-documenting our usage of that filehandle (ie.
we're finished reading from this filehandle)
at best it's preventing some problem down the track
the only justification I can think of for not closing them is some
keystroke based one .. have I missed something ?
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: 18 Jul 2000 00:33:01 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: context confusion
Message-Id: <em4stmjm.fsf@macforce.sumus.dk>
Jakob Schmidt <sumus@aut.dk> writes:
> "Dave McIntyre" <dem@achilles.net> writes:
>
> > $val="6A"; # or somesuch
>
> Whaddaya mean "it's printing"? It isn't on my machine.
Sorry about this part - i read "A6" where you wrote "6A". Others have
explained the difference.
--
Jakob
------------------------------
Date: 17 Jul 2000 18:43:51 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: context confusion
Message-Id: <slrn8n742e.ibq.abigail@alexandra.delanet.com>
Dave McIntyre (dem@achilles.net) wrote on MMDXII September MCMXCIII in
<URL:news:8kvrhg$guq$1@bcarh8ab.ca.nortel.com>:
?? Hello c.l.p.misc. For the statement:
??
?? if ($val >= 1 && $val <= 99 ) { print "in range";}
??
?? could someone please tell me why (or where to look it up) it's printing if
??
?? $val="6A"; # or somesuch
??
?? Is there a better way to determine if $val is in range?
You are comparing $val against a number. Hence, perl will treat $val
as a number, or else what you are doing doesn't make sense.
Now, which number should "6A" be? The obvious answer is 6. And in the
Perl universe, 6 happens to be larger than 1, and less than 99.
Of course, had you run with -w, Perl would have told you what was going on....
Always, Always, and I mean *****ALWAYS***** run with -w.
Abigail
--
sub A::TIESCALAR{bless\my$x=>A};package B;@q[0..3]=qw/Hacker Perl
Another Just/;use overload'""'=>sub{pop @q};sub A::FETCH{bless\my
$y=>B}; tie my $shoe => qq 'A';print "$shoe $shoe $shoe $shoe\n";
------------------------------
Date: Mon, 17 Jul 2000 22:03:31 GMT
From: mercma@my-deja.com
Subject: Re: convert file permissions; octal-->stat
Message-Id: <8kvvr8$f2r$1@nnrp1.deja.com>
Hello,
I am not sure if this is exactly what you are looking for but you can
give it a try.
#!/usr/bin/perl
$file = shift;
($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($file);
print "$mode\n";
printf "%o\n",$mode; # print $mode in octal
$oct = sprintf "%o\n",$mode; # make $oct the octal of $mode
$mode2 = oct $oct; # make $mode2 the decimal of $oct
print "$mode2\n";
Mike
In article <8kva1m$t0s$1@nnrp1.deja.com>,
ogiven@vertex.ucls.uchicago.edu wrote:
> I'm grabbing the permission info on a remote file via Net::FTP's dir
> command.......then parsing the -rwxrwxrwx entry into octal form. BUT
i
> then need to convert the octal num into the kind of num that stat
> returns when it gives you a file mode, so that i can chmod the local
> file from within my Perl script.
>
> i know a bit shift sequence to convert file perms from the stat format
> to octal (@modelist = (($mode&0700)>>6, ($mode&0070), ($mode&0007));),
> but i don't know how to do the opposite: convert a file perm from
octal
> to the stat representation.........
>
> can anyone suggest a way?
> OR, since my knowledge of "bits" and such is sorely lacking, can
anyone
> point me to some documentation on the subject. i've done a lot of
> search engine/usenet querying, but i'm not turning up anything
> relevant....
>
> thanks,
>
> Olivia
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 17 Jul 2000 20:16:09 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Extra Path Information in CGI
Message-Id: <8l07k9$kc0@junior.apk.net>
In article <397346cc$0$27161@wodc7nh1.news.uu.net>,
spurcell <skpurcell@hotmail.com> wrote:
>Anyway, I have jacked with this for quite some time, and I can't seem to get
>it to work.
>I set up a cgi-bin just like he has and made a simple .pl file called
>random_pict2.pl.
>And that works as long as I called it like
>http://your.site/cgi-bin/random_pict2.pl
>But as soon as I add the /pictures then I get burned.
What do you mean, "burned"? Does the script not go at all? Do you
get server errors? Does the script run but without the "extra path
info"?
>Does anyone know how this "extra Path info" is suposed to work? It makes
>sense how it works, but it don't work here.
>
>Config: IIS
>Active state Perl.
I suspect this might be a server "feature." Check your IIS docs to make
sure the "path info" thing is supported at all.
Oh, wait, look what turned up in a search engine under "path info iis":
http://www.geocities.com/SiliconValley/Bay/3464/0776.txt
This may address some or all of your problem.
------------------------------
Date: Tue, 18 Jul 2000 02:09:36 +0200
From: wimmel <wimmmel@hotmail.com>
To: Glen Heide <jheide@sprint.ca>
Subject: Re: Fancy mail, need help
Message-Id: <3973A040.1A7E5BF1@hotmail.com>
Glen Heide wrote:
>
> Does anyone know how to send an e-mail with HTML formatting using Perl?
> I currently use the "sendmail" program on the Unix server to send a plain
> text e-mail message.
>
> --
> Yours Truly,
> Glen Heide
To send HTML by e-mail (and have an email client know it's html), you'll
have to add a "Content-Type" header:
open(MAIL,"|sendmail -t") || die "Call to sendmail failed.";
print MAIL "Content-Type: text/html\n";
I used it on a script I use to get pages from the web into my mailbox,
in case I am at a place where I don't have web access (but of course do
have mail access to the internet).
wimmel
The script (in case you need an example) --> http://mailbrowser.dhs.org/
------------------------------
Date: 18 Jul 2000 00:27:11 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: Formatting html file
Message-Id: <g0p8tmtc.fsf@macforce.sumus.dk>
hx_101@hotmail.com (Horse Nuts) writes:
> sample file:
> <TR><TD><a href="HTTP://XXX.XX.XXX/XX">AAA BB</a>
> </td><TD>NAME</td></tr><br>
>
> I have a simple html file, I would like to change ONLY the
> HTTP://XXX.XX.XXX/XX to lower case in a file. There could be hundreds
> of links in this file, is it possible??
This is quick'n'dirty and it only works if the href="HTTP://XXX.XX.XXX/XX"
parts are guarantied to be on a single line each. And it lowercases
everyting that's inside href="...." (even if it's not a http::// url).
Is that OK by you?
while ( <SOURCEFILE> ) {
s/href="([^"]*)"/href="\L$1"/g;
print <DESTFILE>;
}
--
Jakob
------------------------------
Date: 17 Jul 2000 20:04:52 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: HELP - POST to URL and capture results
Message-Id: <877lak1c5n.fsf@limey.hpcc.uh.edu>
>> On Mon, 17 Jul 2000 21:40:04 GMT,
>> estonebreaker@my-deja.com said:
> I'm in desperate need to learn how to POST a request to
> a URL and capture the results.
perldoc LWP
for the overview module documentation,
perldoc lwpcook
for examples.
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: 17 Jul 2000 20:04:21 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Help Wanted
Message-Id: <8l06u5$h3c@junior.apk.net>
In article <39734D40.DAC9B62A@earthlink.net>,
Bob Kling <bbkling@earthlink.net> wrote:
>Programmer Needed Full Time: Work at Home
>Ideal person would be strong in Perl, with some Java, and some SQL.
>Server admin skills a big plus; Unix and some NT
Sorry, this is not a jobs posting group.
>Also it would be a super help if anyone reading this could tell me if
>there is a job posting service that has a "work at home" job section?
>All the prominant job sites do not have this category. Thank you very
>much.
Sorry, this is not a jobs-posting help group either.
------------------------------
Date: Tue, 18 Jul 2000 03:11:10 +0300
From: "Election" <election@qualitynet.net>
Subject: How can i identify a "Not Integer" string ?
Message-Id: <8l0s1b$j5f1@news.qualitynet.net>
Hello everybody ...
I'm a beginner programmer in perl and I'd like to know ,
How can identify a "Not Integer" string in perl ? actually
I've got a string that stores the result like this
$string = int($n1 / $n2);
but it always gives me an integer number , so what should i do ?
------------------------------
Date: Tue, 18 Jul 2000 00:37:46 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: How can i identify a "Not Integer" string ?
Message-Id: <MPG.13de4429e7d357069896df@news>
Election wrote ..
> I'm a beginner programmer in perl and I'd like to know ,
>How can identify a "Not Integer" string in perl ?
one of many ways is
$string =~ /\D/;
>actually I've got a string that stores the result like this
>
>$string = int($n1 / $n2);
>
>but it always gives me an integer number , so what should i do ?
I don't know how this question relates to the first question - so
they're answered separately
what do you mean what should you do ? .. you asked for it to be
converted to an integer .. so you get an integer .. I bet $n1 is also
being divided by $n2 .. something else you asked for - and got
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Tue, 18 Jul 2000 00:05:50 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how to convert "1.2.3.10" to "01020310"?
Message-Id: <sn77qujao5388@corp.supernews.com>
Abigail (abigail@delanet.com) wrote:
: map {printf "%02d" => $_} split /\./ => '2.1.3.14';
Mapping in a void context? Abigail?? And using double-quotes for a
static string, too. Why not do
printf '%02d', $_ foreach split /\./ => '2.1.3.14';
instead? (I still like my regex solution better, though.)
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: 17 Jul 2000 18:46:17 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: How to get the machine (archtechture) type in Perl?
Message-Id: <slrn8n7471.ibq.abigail@alexandra.delanet.com>
J. H. Park (jong@ebi.ac.uk) wrote on MMDXII September MCMXCIII in
<URL:news:39732C6F.F426A944@ebi.ac.uk>:
:) **** Post for FREE via your newsreader at post.usenet.com ****
:)
:) Hi
:)
:) I want to tell if the machine I am in
:) is a LINUX or SGI IRIX.
:)
:) Is there an easy way to do so in Perl?
:) Or is there Shell variable already
:) defined?
man perlvar
Abigail
--
perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
print chr 0x$& and q
qq}*excess********}'
------------------------------
Date: Mon, 17 Jul 2000 23:03:07 GMT
From: vartekquest@my-deja.com
Subject: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible??
Message-Id: <8l03b1$ho9$1@nnrp1.deja.com>
I want to setup a Linux www server with support for PHP + mod_perl +
SSL, but I haven't been able to compile it succesfully.
- Firstly I install mySQL
- then I build PHP
- then I patch apache with mod_ssl
- then I patch apache with mod_perl
- from mod_perl I do: make; make install, but it doesn't compile.
- then I should change httpd.conf to add support for .php, .php3,
etc. et voila!
The question is: is it possible to share both PHP, mod_perl and
mod_ssl built on an Apache server? Or is it just plain stupid compiling
mod_perl when you have PHP?
Has anybody successfully built this config?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 17 Jul 2000 23:14:31 -0500
From: josh <josh@Jessey.uberlab>
Subject: Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible??
Message-Id: <87bszw5b2w.fsf@Jessey.uberlab>
Yes, I have done this. The way I did it is, Compiled Apache+ssl.
then build php and modperl as DSO's.
oww my cat is biting me. bad kitty, down !
--josh
rot13(wbfu@ghytrl.pbz);
------------------------------
Date: Mon, 17 Jul 2000 23:13:17 GMT
From: arandachristian@hotmail.com
Subject: nasty DESTROY behaviour
Message-Id: <8l03tv$i6l$1@nnrp1.deja.com>
Hi All,
When running my OOP program I get the following error:
Uncaught exception from user code:
DESTROY created new reference to dead object during global
destruction.
When running in the debugger, this error message is displayed once I
hit "q" and quit the debugger. I assume this is because the garbage
collector is trying to do its magic and clean up, but I have no
evidence of this.
I have never seen this before, and don't even know where to begin to
debug. Furthermore, it's almost impossible to post the offending code
since I don't know where it occurs. My only thoughts on debugging are
to quit the debugger at various points and see if the error message is
displayed.
Here is the information I can provide:
WinNT 4.0 SP6a
This is perl, version 5.005_03 built for MSWin32-x86-object
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-1999, Larry Wall
Binary build 522 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 09:52:28 Nov 2 1999
Thanks in advance for any and all help!
CMA
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 17 Jul 2000 23:28:46 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: nasty DESTROY behaviour
Message-Id: <MPG.13de33f7c24d56aa9896dc@news>
arandachristian@hotmail.com wrote ..
>When running my OOP program I get the following error:
>
>Uncaught exception from user code:
> DESTROY created new reference to dead object during global
>destruction.
>
>When running in the debugger, this error message is displayed once I
>hit "q" and quit the debugger. I assume this is because the garbage
>collector is trying to do its magic and clean up, but I have no
>evidence of this.
>
>I have never seen this before, and don't even know where to begin to
>debug. Furthermore, it's almost impossible to post the offending code
>since I don't know where it occurs. My only thoughts on debugging are
>to quit the debugger at various points and see if the error message is
>displayed.
making a few assumptions (like that you don't have a DESTROY sub that
creates any references)
sounds like you've got an AUTOLOAD sub in a module/class that you've
written and you're not checking to make sure that the called sub (in
$AUTOLOAD) is NOT the DESTROY special sub ?
something like
return if $AUTOLOAD =~ /::DESTROY$/;
near the top of your AUTOLOAD sub should do the trick
or you can create an empty DESTROY sub so that AUTOLOAD will not be
called
sub DESTROY { }
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: 18 Jul 2000 01:38:54 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: nasty DESTROY behaviour
Message-Id: <bszwtjht.fsf@macforce.sumus.dk>
arandachristian@hotmail.com writes:
> Uncaught exception from user code:
> DESTROY created new reference to dead object during global
> destruction.
Global destruction removes objects in a rather blunt way without checking
to see if some of the objects to be removed later on still might use
the object being removed.
Your problem probably arises from a DESTRUCTOR which does something with
other objects being called during global destruction in stead of during
regular garbage collection. This probably happens because you have circular
references in your data structures - something which the garbage collector
currently cannot handle.
For instance you may have a container object which holds references to some
nodes. If the nodes also hold a reference to the container garbage collection
will be defeated. You have to actively break such circles before exiting
the program.
See the section Two-Phased Garbage Collection in perlobj.
--
Jakob
------------------------------
Date: Tue, 18 Jul 2000 01:23:52 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Need help with a regular expression
Message-Id: <0a57nskml148h6fjih0781it22gmdfjiu9@4ax.com>
Philip P. Obbard wrote:
>if ($link =~ m/hr_id=(.*)[$|&]/) {
Apart from your main problem (".*" -> ".*?"), you should also replace
the "[$|&]" with "(?:$|&)".
--
Bart.
------------------------------
Date: 17 Jul 2000 18:01:56 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Net::Smtp problems
Message-Id: <8l0394$ng7$1@provolone.cs.utexas.edu>
In article <8kuf05$b16$1@orpheus.gellyfish.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>The chances are that a failure to connect is not a Perl problem at all but
>something wong with your mail server or your network.
It's not necessarily something *wrong* with the mail server. The mail
server might be doing it on purpose in some cases.
("grep RefuseLA /etc/sendmail.cf".)
- Logan
------------------------------
Date: Mon, 17 Jul 2000 22:17:40 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: NT4 can't create file in cgi-bin
Message-Id: <MPG.13de235432461b4b9896d6@news>
hacktic@my-deja.com wrote ..
>On a NT4 server where I only have FTP access, I tried to create a file
>in the cgi-bin with a Perl script, but it returns the msg that it can't
>make the file.
>
>#!perl
>open(FP, ">test.txt")||print("Can't make file.");
>print FP ("this is a test");
>close(FP);
>print "Hello world!";
>
>I thought it might be some restriction set on the scripts directory by
>the IIS. So I thought to write the text file in the root directory or a
>parent directory with one of the following.
>
>open(FP, ">\\test.txt")||print("Can't open file.");
>open(FP, ">..\\test.txt")||print("Can't open file.");
you should be including $! somewhere in your error output .. this will
tell you why you're unable to open these files (my guess is NT
permissions on those directories .. but Perl will tell you)
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Mon, 17 Jul 2000 15:18:07 -0700
From: stevel@coastside.net (Steve Leibel)
Subject: Object somehow becoming unblessed?
Message-Id: <stevel-1707001518070001@192.168.100.2>
Hello,
I have a mysterious bug I'm working on. I have an object that gets stored
and retrieved from some other data structures. After the retrieval the
object has the same address, but ref() returns 0. That is, if $X and $Y
are the before and after values of my object,
($X eq $Y) evaluates as true; and when I print it, they are objects in the
same class with the same address; and
ref($X) evaluates to the name of the class; but
ref($X) prints as an empty string.
I'm attempting to isolate this bug in a short code fragment. Meanwhile,
what kinds of things should I look for that cause an object to retain its
class=address format, but lose its status as an object? I'm running
5.005_03 on i386-freebsd.
Thanks much,
Steve L
stevel@bluetuna.com
------------------------------
Date: 17 Jul 2000 23:12:40 GMT
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: Object somehow becoming unblessed?
Message-Id: <8l03t8$k1b@gap.cco.caltech.edu>
In article <stevel-1707001518070001@192.168.100.2>,
Steve Leibel <stevel@coastside.net> wrote:
>I have a mysterious bug I'm working on. I have an object that gets stored
>and retrieved from some other data structures. After the retrieval the
>object has the same address, but ref() returns 0. That is, if $X and $Y
>are the before and after values of my object,
>
>($X eq $Y) evaluates as true; and when I print it, they are objects in the
>same class with the same address; and
>
>ref($X) evaluates to the name of the class; but
>
>ref($X) prints as an empty string.
(I assume you meant $Y here -- GA)
>
>I'm attempting to isolate this bug in a short code fragment. Meanwhile,
>what kinds of things should I look for that cause an object to retain its
>class=address format, but lose its status as an object? I'm running
>5.005_03 on i386-freebsd.
It sounds like your reference has been forced into a string. This can
happen if you use the reference as a hash key, if you write it to disk
and read it back (or use a tied module that does this), or if some
code ever puts the reference in double quotes ("$Y").
My guess would be that one of these is happening somewhere in these
"other data structures" you are using.
--
Gary Ansok
------------------------------
Date: Mon, 17 Jul 2000 17:25:15 -0700
From: stevel@coastside.net (Steve Leibel)
Subject: Re: Object somehow becoming unblessed?
Message-Id: <stevel-1707001725480001@192.168.100.2>
In article <8l03t8$k1b@gap.cco.caltech.edu>, ansok@alumni.caltech.edu
(Gary E. Ansok) wrote:
> In article <stevel-1707001518070001@192.168.100.2>,
> Steve Leibel <stevel@coastside.net> wrote:
> >I have a mysterious bug I'm working on. I have an object that gets stored
> >and retrieved from some other data structures. After the retrieval the
> >object has the same address, but ref() returns 0. That is, if $X and $Y
> >are the before and after values of my object,
> >
> >($X eq $Y) evaluates as true; and when I print it, they are objects in the
> >same class with the same address; and
> >
> >ref($X) evaluates to the name of the class; but
> >
> >ref($X) prints as an empty string.
> (I assume you meant $Y here -- GA)
> >
> >I'm attempting to isolate this bug in a short code fragment. Meanwhile,
> >what kinds of things should I look for that cause an object to retain its
> >class=address format, but lose its status as an object? I'm running
> >5.005_03 on i386-freebsd.
>
> It sounds like your reference has been forced into a string. This can
> happen if you use the reference as a hash key, if you write it to disk
> and read it back (or use a tied module that does this), or if some
> code ever puts the reference in double quotes ("$Y").
>
Yes, that's exactly what was going on -- I was using the object as a hash
key in order to keep track of my objects, and later recovering them via
keys(). Well I won't do that again!!
To the Perl Powers that Be: I was running under -w at the time. Can you
add a warning "converting a blessed object to a string"? This bug was
very hard to find, since every time I printed out the value of the object
it looked correct. It wasn't till I looked at its ref() that I realized
the object was losing its object-hood.
Thanks Gary, good call.
Steve L
------------------------------
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 3698
**************************************