[13997] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1407 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 17 12:09:01 1999

Date: Wed, 17 Nov 1999 09:05:18 -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: <942858318-v9-i1407@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 17 Nov 1999     Volume: 9 Number: 1407

Today's topics:
    Re: '0 % (2**32)' fails on AS builds, works fine on oth (M.J.T. Guy)
    Re: '0 % (2**32)' fails on AS builds, works fine on oth (M.J.T. Guy)
    Re: '0 % (2**32)' fails on AS builds, works fine on oth (Ilya Zakharevich)
    Re: about line sort ? <sariq@texas.net>
    Re: access Oracle on NT from Linux/Perl: is that possib <Michael.Young@irp.gatech.edu>
    Re: access Oracle on NT from Linux/Perl: is that possib (Kragen Sitaker)
        backticks or system() <robert.castellowNOroSPAM@s1.com.invalid>
    Re: backticks or system() <gellyfish@gellyfish.com>
        C-code from Perl (EED)
        Call C program <bian@freepcmail.com>
    Re: Call C program <gellyfish@gellyfish.com>
    Re: Call C program (Kragen Sitaker)
    Re: CGI Error... <jlgordon@fedex.com>
        changing 2 or more frames with a single click without j <speci@my-deja.com>
    Re: changing 2 or more frames with a single click witho <gellyfish@gellyfish.com>
    Re: DBD::Oracle <newsposter@cthulhu.demon.nl>
    Re: Flat File Searching Problem <gellyfish@gellyfish.com>
    Re: foreach on a hash within a hash (Kragen Sitaker)
        Hey.. Thanx <harinirayadurgam@hotmail.com>
    Re: how to prevent people going around my login.cgi and (Brett W. McCoy)
    Re: Is $$variable allowed like in PHP ? <bene@chiark.greenend.org.uk>
    Re: Multiple file download (Kragen Sitaker)
    Re: my ... if -- strange behavior (M.J.T. Guy)
    Re: my ... if -- strange behavior (M.J.T. Guy)
    Re: Mysql Works... and then doesn't.. and then does etc (Kragen Sitaker)
    Re: Mysql Works... and then doesn't.. and then does etc <rhardicr@mail.ford.com>
    Re: Mysql Works... and then doesn't.. and then does etc <craig@mathworks.com>
        pb : `useradd $user` in a CGI form <lucasb@cadrus.fr>
    Re: pb : `useradd $user` in a CGI form <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 17 Nov 1999 15:08:11 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: '0 % (2**32)' fails on AS builds, works fine on other platforms
Message-Id: <80ugcr$5p7$1@pegasus.csx.cam.ac.uk>

David Cassell  <cassell@mail.cor.epa.gov> wrote:
>
>Just at a guess, I'd say it's the way you have them compiled.
>Type 'perl -V' on both boxes.  My PSI::ESP module is telling
>me that your ActiveState Perl has
>
>stdchar = 'char'
>
>while your Solaris box has
>
>stdchar = 'unsigned char' .

The entry in Porting/Glossary reads

stdchar (stdchar.U):
        This variable conditionally defines STDCHAR to be the type of char
        used in stdio.h.  It has the values "unsigned char" or "char".

That's got nothing to do with the handling of integers.


Mike Guy


------------------------------

Date: 17 Nov 1999 15:18:45 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: '0 % (2**32)' fails on AS builds, works fine on other platforms
Message-Id: <80uh0l$6c9$1@pegasus.csx.cam.ac.uk>

Ron Grabowski  <ronnie@catlover.com> wrote:
>C:\>perl -le "print 0 % (2**31)"
>0
>
>C:\>perl -le "print 0 % (2**32)"
>Illegal modulus zero at -e line 1.
>
>[errors occured on all my NT boxes running ActiveState builds 515, 517,
>and 522]
>
>Now on a Solaris box (5.6):
>
>% perl -le 'print 0 % (2**31)'
>0
>
>% perl -le 'print 0 % (2**32)'
>0

% only operates on integer operands.    2**32 is out of range for
an integer on those platforms, so Perl stores it as floating point.
When it needs to use it as an integer, it uses the conversion routines
from the platform's C library.    Different libraries do different
things with out of range operands  -  some just treat the value
modulo 2**32, leading to a value of zero; others replace out of range
values by the "nearest" available value, 2**31-1.

You can avoid these problems by using the POSIX::fmod function.

Or move to a 64 bit platform.    :-)


Mike Guy


------------------------------

Date: 17 Nov 1999 16:15:16 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: '0 % (2**32)' fails on AS builds, works fine on other platforms
Message-Id: <80ukak$89v$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to M.J.T. Guy
<mjtg@cus.cam.ac.uk>],
who wrote in article <80uh0l$6c9$1@pegasus.csx.cam.ac.uk>:
> % only operates on integer operands. 

Obsolete.

> 2**32 is out of range for
> an integer on those platforms, so Perl stores it as floating point.
> When it needs to use it as an integer, it uses the conversion routines
> from the platform's C library.    Different libraries do different
> things with out of range operands  -  some just treat the value
> modulo 2**32, leading to a value of zero; others replace out of range
> values by the "nearest" available value, 2**31-1.
> 
> You can avoid these problems by using the POSIX::fmod function.
> 
> Or move to a 64 bit platform.    :-)

Or upgrade to 5.6.  ;-)

Ilya


------------------------------

Date: Wed, 17 Nov 1999 09:28:33 -0600
From: Tom Briles <sariq@texas.net>
Subject: Re: about line sort ?
Message-Id: <3832C9A1.45B0C40D@texas.net>

Larry Rosler wrote:
> 
> In article <m47ATXKM$GA.162@news.thrunet.com> on Wed, 17 Nov 1999
> 11:58:18 +0900, Moltimer <factory@factory.co.kr> says...
> > I'm trying to print out a html page.
> > and it works well with something like following code.
> 
> Well, the code you show is garbled, but let's see anyway...
> 

<snipped a ton of free advice - I hope you were listening>

>       print FILE1 map { (" ", join(' - ' => @$_), " \n") }
>                  sort { $a->[3] cmp $b->[3] } @ex1_lines;
> 

To the original poster (factory@factory.co.kr):

Be sure to read the documentation before coming back to say, "But now
the list is sorted like:

1
10
2
etc."

Thanks, and good luck with it!

- Tom


------------------------------

Date: Wed, 17 Nov 1999 09:50:00 -0500
From: "Michael R. Young" <Michael.Young@irp.gatech.edu>
Subject: Re: access Oracle on NT from Linux/Perl: is that possible?
Message-Id: <80uf6e$fun$1@news-int.gatech.edu>

Try ORAPerl ...


bmlam <310064202272#0001@online.de> wrote in message
news:3831E489.C6C1D23F@online.de...
> We have an Oracle server running on NT platform and we are considering
> installing Apache on a Linux box that will access the Oracle database
> when serving web pages. The CGI script would be written in Perl. Does
> Perl have a module that enables this kind of remote database access to
> Oracle 8.0.4?
>
> Thanks for any hints!
>




------------------------------

Date: Wed, 17 Nov 1999 15:15:25 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: access Oracle on NT from Linux/Perl: is that possible?
Message-Id: <hEzY3.21361$YI2.961788@typ11.nn.bcandid.com>

In article <80uf6e$fun$1@news-int.gatech.edu>,
Michael R. Young <Michael.Young@irp.gatech.edu> wrote:
>Try ORAPerl ...

oraperl is six years out of date.  Use DBI instead.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: Wed, 17 Nov 1999 08:44:34 -0800
From: natureboy <robert.castellowNOroSPAM@s1.com.invalid>
Subject: backticks or system()
Message-Id: <06b90d33.0a9c1f57@usw-ex0110-073.remarq.com>

are there any differences (besides syntax) between using
backticks and system functions?


* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful


------------------------------

Date: 17 Nov 1999 16:50:40 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: backticks or system()
Message-Id: <3832dce0_2@newsread3.dircon.co.uk>

natureboy <robert.castellowNOroSPAM@s1.com.invalid> wrote:
> are there any differences (besides syntax) between using
> backticks and system functions?
> 

Er yes, what does it say in the perlfunc and perlop manpages - I dont have 
mine handy right now.

/J\
-- 
"While they're pumping, you're soaking them" - Speed Loader TV Advert


------------------------------

Date: Wed, 17 Nov 1999 16:33:40 +0100
From: "Bernd Kronmueller (EED)" <Bernd.Kronmueller@eedn.ericsson.se>
Subject: C-code from Perl
Message-Id: <3832CAD4.502FC586@eedn.ericsson.se>

Hello,

I just tried to generate C code from Perl and compile and link it.
So I did my
perl -MO=C file.pl > file.c
then I compiled it
gcc -c -I<path to needed h files somewhere in gnu/lib...> -o file.o
file.c
and linked it
gcc -L<path to libperl.a> -lperl -o file file.o

This last step never works. I get always a lot of undefined symbols. If
I look into the library (nm libperl.a) the missing variables which are
always found by the linker are defined in this library but somehow it
seems I am making an error somewhere.

Anybody out there who can help??

Tanks,    Bernd



------------------------------

Date: Wed, 17 Nov 1999 09:33:21 -0500
From: "Xiaopeng" <bian@freepcmail.com>
Subject: Call C program
Message-Id: <80ue87$7981@icet.net.nih.gov>

Hi, everyone:
I am writing a browser interface with perl to call a C program. If the C
program is executed from command line, it prints its progress to the screen.
Now I want to redirect this progress message to the browser. I tried to pipe
the C output to cat, but it only print the progress report after the C
program is finished. How do I print the message while the program is
executing, just like if I run it from command line?
Please e-mail me at bian@helix.nih.gov if you have a solution.
Thanks




------------------------------

Date: 17 Nov 1999 14:41:49 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Call C program
Message-Id: <3832bead_2@newsread3.dircon.co.uk>

Xiaopeng <bian@freepcmail.com> wrote:
> Hi, everyone:
> I am writing a browser interface with perl to call a C program. If the C
> program is executed from command line, it prints its progress to the screen.
> Now I want to redirect this progress message to the browser. I tried to pipe
> the C output to cat, but it only print the progress report after the C
> program is finished. How do I print the message while the program is
> executing, just like if I run it from command line?

Read what it says in the perlipc manpage about this - you can use
the backticks `` to grab the output of a program but it appears that
you are losing the stderr as well - this is discussed in the faq.

> Please e-mail me at bian@helix.nih.gov if you have a solution.
> 

Some people would have e-mailed if you had put your correct address in
your header.

/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: Wed, 17 Nov 1999 15:31:54 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Call C program
Message-Id: <KTzY3.21413$YI2.963634@typ11.nn.bcandid.com>

In article <80ue87$7981@icet.net.nih.gov>,
Xiaopeng <bian@freepcmail.com> wrote:
>I am writing a browser interface with perl to call a C program. If the C
>program is executed from command line, it prints its progress to the screen.
>Now I want to redirect this progress message to the browser. I tried to pipe
>the C output to cat, but it only print the progress report after the C
>program is finished. How do I print the message while the program is
>executing, just like if I run it from command line?

Unbuffer the C program's output with setvbuf(), or have it flush it
with fflush().  Or run it in a pseudo-tty, like with Expect.pm.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: Wed, 17 Nov 1999 08:46:05 -0700
From: "James L. Gordon" <jlgordon@fedex.com>
To: Matt Sellers <vedas@ce.mediaone.net>
Subject: Re: CGI Error...
Message-Id: <3832CDBD.821A925C@fedex.com>

Matt Sellers wrote:
> 
> Hi...
> 
> I am getting a "500" error.
> 
> Here is my problem / diagnosis:
> 
> I am gettings this error when I type "./newspro.cgi"
> bash: ./newspro.cgi: No such file or directory
> 
>  when I type "/usr/bin/perl" as I have in the .
> "/usr/bin/perl newspro.cgi"
> 
> What is happening?
> 
> I am running Redhat Linux 6.1 with perl 5.x installed. Please help. When
> I goto test a script ex: /path/of/perl <script> it works, but I always
> get a 500 error w/ browser.
> 
> Thanks, please reply to e-mail.
> Matt Sellers
> vedas@ce.mediaone.net

	CheQ the #! line for correctness (#!/usr/bin/perl).  If that's okay,
then I ask, did you edit it on a Windoze machine and then transfer it to
the Linux box?  Because in Windoze a line is terminated by <carriage
return><linefeed> whereas in Linux it's just <linefeed>.  Normally, this
doesn't cause any problems, but now the #! reads (#!/usr/bin/perl^M) and
the OS just can't seem to find a program called perl<carriage return> in
/usr/bin.
	Load the program up in vi and you should see the ^M character at the
end of each line.  If you do then you're in luQ, you can just type
(:%s/<ctrl-v enter>//) followed by (:x) and you're program should run
fine.

-- 
	James L. Gordon
	jlgordon@fedex.com


------------------------------

Date: Wed, 17 Nov 1999 16:36:55 GMT
From: Speci <speci@my-deja.com>
Subject: changing 2 or more frames with a single click without javascript
Message-Id: <80ulj7$266$1@nnrp1.deja.com>

Hi,

I would like to change the sources of 2 or more frames by a single user
click on a button or a text link without javascript.

I would prefer a non client scripting solution like php3 or cgi/perl.

If you can help me with some advises or if you can name some sites with
helpful information please let me know.

Thanx!

Sascha


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: 17 Nov 1999 16:56:39 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: changing 2 or more frames with a single click without javascript
Message-Id: <3832de47_1@newsread3.dircon.co.uk>

In comp.lang.perl.misc Speci <speci@my-deja.com> wrote:
> 
> I would like to change the sources of 2 or more frames by a single user
> click on a button or a text link without javascript.
> 
> I would prefer a non client scripting solution like php3 or cgi/perl.
> 
> If you can help me with some advises or if you can name some sites with
> helpful information please let me know.
> 

This is not really an appropriate question for comp.lang.perl.misc - if
your are using the perl module CGI.pm then the documentation has a
section entitled "WORKING WITH NETSCAPE FRAMES" .

/J\
-- 
"It's easier for a man to enter a camel is he stands on a box" -
Jonathan Creek


------------------------------

Date: 17 Nov 1999 14:59:48 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: DBD::Oracle
Message-Id: <80uft4$4qn$2@internal-news.uu.net>

Amy Schmieder <aschmied@earthlink.net> wrote:

> I am having some trouble with stored procedures and DBI. (Using
> DBD::Oracle.)

> $cursor=$dbh->prepare($call);
> $cursor->execute;
> @row=$cursor->fetchrow_array;

> When run, this returns the error:
> ERROR no statement executing (perhaps you need to call execute first)

Do proper error checking and display error messages. My guess is that
the prepare or the execute fail.

Erik



------------------------------

Date: 17 Nov 1999 14:14:21 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Flat File Searching Problem
Message-Id: <3832b83d_1@newsread3.dircon.co.uk>

Martin Elliott <martin@mert.globalnet.co.uk> wrote:
> I'm having difficulty with a project I am doing for Uni, a form is filled in
> and a script deals with that, no bother, but now I want another script that
> searches a flat file, created by the first script and returns certain
> criteria.
> 
> Can anyone help ????
> 
> The flat file db is set out like this:
> 
> name=Martin
> email=mert@globalnet.co.uk
> choice=item2
> quantity=5
> address=My_Street
> name=Someone_else
> email=...
> ...
> 
> What I want to do is to be able to display the quantity of a given item, for
> all instances of that item. So a user can specify 'item2', for example, and
> the script will search the db and return all of the appropriate quantities.
> 
> The problem I am having is that I can find the item name, but returning the
> quantity is another matter, as the script just returns all of the quantity=x
> lines that it finds. Is there a way of only accepting those quantity lines
> that come after the correct choice=x line??
> 
> Thanks, and sorry if this is a poo explanation,
> 

I would fix the original file format as this is totally crap to work with

However it basically comes down to reading the file five lines at a time
and putting them in an array - as you have the field names already I
fancy a hash for that easy searching :

#!/usr/bin/perl -w

use strict;

my $num_lines_per_record = 5;
my $data_file = 'datfile.txt';

open(DATFILE,$data_file) || die "Can't open $data_file - $!\n";

my $index = 0;

my @records;
my @fields = ();

while(<DATFILE>)
{
 chomp;
 
 
 push @fields, split /=/;


 if (++$index == $num_lines_per_record)
   {
     push @records,{@fields };
     $index = 0;
     @fields = ();
   }
}

foreach (@records)
{
   print $_->{quantity},"\n" if ($_->{choice} eq 'item2' );
}
      

of course you could be doing whatever you want in that foreach ...

/J\
-- 
"I was the chief make-up artist on the Titanic" - Tina Earnshaw, Chief
Make-Up Artist, Titanic


------------------------------

Date: Wed, 17 Nov 1999 14:46:16 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: foreach on a hash within a hash
Message-Id: <YczY3.21337$YI2.957949@typ11.nn.bcandid.com>

In article <80t7jo$3kl$1@nnrp1.deja.com>,
Curtis Jones  <curtisj@BannerFusion.com> wrote:
>What is the best way to go about retrieving a list of the values of a
>hash within a hash?

You mean like values %{$hash{'one'}}?  Or like this:

#!/usr/bin/perl -w
use strict;
my %hash = ('one' => { 'foo' => 'quux', 'bar' => 'biffle'});
my @vals = @{$hash{'one'}}{sort keys %{$hash{'one'}}};
print "@vals\n";

>foreach ( sort keys %hash ) ...
>
>to retrieve each of the values in it, but I can't seem to figure out how
>to do that to a hash that is within a hash...or deeper.

Sounds like you might want keys %{$hash{'one'}}.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: Wed, 17 Nov 1999 16:26:07 -0000
From: "Harini" <harinirayadurgam@hotmail.com>
Subject: Hey.. Thanx
Message-Id: <80ul53$d70$1@nclient15-gui.server.virgin.net>

Hey, Thanx everybody... it works
Regards
Harini

Harini <harinirayadurgam@hotmail.com> wrote in message
news:80ud0o$b6n$1@nclient15-gui.server.virgin.net...
> I'm a Perl novice. Though I've seen quite a few examples in Perl, I could
> not figure out how to connect to a socket and send a string to it from a
> client. I'm using MS-DOS.. I was able to make a server listen, and client
> connect to it, but could not send a string. Could someone give me a piece
of
> code for the client and server or point me in the right direction
> Thanx
> Regards
> Harini
>
>




------------------------------

Date: Wed, 17 Nov 1999 14:15:31 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: how to prevent people going around my login.cgi and typing the url of my site??
Message-Id: <slrn835e8b.a6n.bmccoy@moebius.foiservices.com>

Also Sprach cm95@hotmail.com <cm95@hotmail.com>:

>I have web page that is protected. Only registered members are let in. I
>made a login.cgi that lets registered members in. Then the users is in
>my protected area. The protected area is a normal www address. It is
>like www.somehostname.com/~protected/ In that address I have a
>couple more cgi programs that connect users to database. But the
>question is how can i prevent people typing the url in the browser and
>letting themselves in without my login.cgi. Is there a way to restrict??
>any help would be apprectiated really

Yes... configure your web server to secure the pages and require a
password.  Using CGI for user authentication is not a good idea.

-- 
Brett W. McCoy                             bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek)   http://www.foiservices.com
FOI Services, Inc./DIOGENES                301-975-0110
---------------------------------------------------------------------------


------------------------------

Date: 17 Nov 1999 14:25:24 +0000 (GMT)
From: Ben Evans <bene@chiark.greenend.org.uk>
Subject: Re: Is $$variable allowed like in PHP ?
Message-Id: <yrm*16kdo@news.chiark.greenend.org.uk>

In article <slrn830ejj.2aj.simon@othersideofthe.earth.li>,
Simon Cozens <simon@brecon.co.uk> wrote:
>Ben Evans (comp.lang.perl.misc):
>>So for quick and dirty scripts of up to a few hundred lines
>>where I pretty much know exactly what I want to be doing,
>>and I'm not depending on user input in any but the most
>>restricted way, there's no real problem[1] with soft references?
>
>Put it the other way. Why do you want to use these rather than a hash?

I'm writing code which will be maintained and probably substantially
modified by people who are far less used to programming than I am.
They don't really understand hashes too well, and the syntax someone
else suggested raised nothing but glazed looks from them.

>Choose the path of least resistence.

That's exactly what I'm trying to do. :)
Figure out whether it's going to be less hassle to teach them or
just deal with any problems that come from using soft refs, which
they all understand.

But then, I couldn't necessarily see why for the cases where I
wanted to use them, they would be a Bad Idea, so I thought I'd
ask.

Kitty
--
Ben Evans (bene@chiark.greenend.org.uk)
Just Another Evil-Policy Wielding Politely Frivolous High Density Random
Blonde Perl-Hacking Dilated-Eyed Gonzo Nancy Geek Kitten-Boy


------------------------------

Date: Wed, 17 Nov 1999 14:20:39 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Multiple file download
Message-Id: <XQyY3.21310$YI2.954826@typ11.nn.bcandid.com>

In article <38329236.B6FD4222@netexpansion.com>,
Jean-Charles Savelli  <jcs@netexpansion.com> wrote:
>Now I have to let the visitor choose  more than one file, so that
>he can download several files, filing out the form only once.
>
>How can it be done ?

Not a Perl question.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: 17 Nov 1999 14:48:12 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: my ... if -- strange behavior
Message-Id: <80uf7c$4mh$1@pegasus.csx.cam.ac.uk>

John Lin <johnlin@chttl.com.tw> wrote:
   [ example of conditional 'my' doing surprising things ]

This is a known problem.    It is agreed to be a bug, but no-one has
worked out how to fix it without adding significant overhead to *every*
my.    See the discussion on p5p which started with the message

http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1998-09/ msg00462.html

And of course, you have pointed out the obvious work-round.


Mike Guy


------------------------------

Date: 17 Nov 1999 14:53:04 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: my ... if -- strange behavior
Message-Id: <80ufgg$4rq$1@pegasus.csx.cam.ac.uk>

Rick Delaney  <rick.delaney@home.com> wrote:
>This is a result of a feature that allows you to have static vars in
>your subs.

That's a bug, not a feature.   See the thread referenced in my reply to
John Lin.

>  This "allows" you to write subs like
>
>    sub foo {
>        my $static if 0;
>        return ++$static;
>    }
>

Don't do that.   It'll break someday.

>Of course, that's a pretty obscure way of writing
>
>    {
>        my $static;
>        sub foo { return ++$static }
>    }
>
>and IMHO should draw a warning.

Looks like you agree with me.  :-)


Mike Guy


------------------------------

Date: Wed, 17 Nov 1999 14:30:25 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Mysql Works... and then doesn't.. and then does etc.
Message-Id: <5_yY3.21320$YI2.956274@typ11.nn.bcandid.com>

In article <80uato$qjn$1@nnrp1.deja.com>,
Iain Black  <iain_black@my-deja.com> wrote:
>$dbh  = DBI->connect($DSN,$user,$pass)
>  || die "Cannot connect: $DBI::errstr\n" unless $dbh;

This looks like a bug.  Presumably you want to either get rid of
"unless $dbh" or replace || with ;.  Should be harmless for now.

Beyond that, I am mystified.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: Wed, 17 Nov 1999 14:13:37 +0000
From: Richard H <rhardicr@mail.ford.com>
Subject: Re: Mysql Works... and then doesn't.. and then does etc.
Message-Id: <3832B811.A5674A19@mail.ford.com>

Iain Black wrote:
> 
> Hi all,
> 
> Okay this is an interesting one and has me pretty baffled.
> 
> I'm using a SuSE 6.1 2.2.7 Linux, MySQL, Apache, Perl and Netscape
> compo.
> 
> I have a Perl script which accesses a DB and reads and writes to it,
> everything seems to work fine... at least for the first 10 accesses to
> the DB. After that the script still works but the results come back
> blank.I don't think it's a problem with my script as I've had it running
> on 2 different virtual servers and the DB accesses seem to work fine.
> 

<snip>

>
> Does anybody have any idea what the problem could be?!
>

No I'm afraid not, but have you tried setting DBI->trace(2) at the top
and seeing if that gives you any more clues, I find its generally pretty
informative and occaisionally some use,

HTH,
Richard H,


------------------------------

Date: Wed, 17 Nov 1999 10:25:36 -0500
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: Mysql Works... and then doesn't.. and then does etc.
Message-Id: <3832C8F0.3DE505BF@mathworks.com>

I've seen various problems when MySQL is NOT compiled with threads.

Did you compile MySQL with threads??

If you not, you may want to re-compile with threads.

-Craig

Richard H wrote:

> Iain Black wrote:
> >
> > Hi all,
> >
> > Okay this is an interesting one and has me pretty baffled.
> >
> > I'm using a SuSE 6.1 2.2.7 Linux, MySQL, Apache, Perl and Netscape
> > compo.
> >
> > I have a Perl script which accesses a DB and reads and writes to it,
> > everything seems to work fine... at least for the first 10 accesses to
> > the DB. After that the script still works but the results come back
> > blank.I don't think it's a problem with my script as I've had it running
> > on 2 different virtual servers and the DB accesses seem to work fine.



------------------------------

Date: Wed, 17 Nov 1999 15:46:30 +0100
From: Lucas Bigeardel <lucasb@cadrus.fr>
Subject: pb : `useradd $user` in a CGI form
Message-Id: <3832BFC6.C797BE4@cadrus.fr>

Hi,

I try to perform a `useradd $user` in a CGI form.

my `useradd $user` processing is too slow
my CGI form processing is too fast

So, what can I do to wait the end of `useradd $user` in order to avoid
the premature end of my CGI form ?

Thanks


------------------------------

Date: 17 Nov 1999 14:47:57 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: pb : `useradd $user` in a CGI form
Message-Id: <3832c01d_1@newsread3.dircon.co.uk>

Lucas Bigeardel <lucasb@cadrus.fr> wrote:
> Hi,
> 
> I try to perform a `useradd $user` in a CGI form.
> 
> my `useradd $user` processing is too slow
> my CGI form processing is too fast
> 
> So, what can I do to wait the end of `useradd $user` in order to avoid
> the premature end of my CGI form ?
> 

I dont understand - if you run useradd with system() then your program
*will* wait unless your are forking but as you dont show us any code I
cant guess ....

/J\
-- 
"Some saw Noel Edmonds as a stinking slimy downmarket local rep from a
package holiday firm. His critics were less kind" - Victor Lewis-Smith,
TV Offal


------------------------------

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 1407
**************************************


home help back first fref pref prev next nref lref last post