[12342] in Perl-Users-Digest
Perl-Users Digest, Issue: 5942 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 10 07:07:42 1999
Date: Thu, 10 Jun 99 04:00:29 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 10 Jun 1999 Volume: 8 Number: 5942
Today's topics:
Re: alt.perl post of the millennium <gellyfish@gellyfish.com>
Re: Binary File Uploading - Part 2 <dfs@thegrid.net>
Re: Calling an applet from perl (Kenny A. Chaffin)
Re: can i variably name an array? (Bart Lateur)
CGI script from win32 -> IE4.0 <duh@pro.com>
Compile and IIS <kcyeung@netvigator.com>
Re: E-mailing with perl is driving me crazy! <anfi@bigfoot.com>
Re: Emailing Binary Files <anfi@bigfoot.com>
Error while running News-Scan-0.51 <h.c.a.bokhoven@kpn.com>
Re: Error while running News-Scan-0.51 <gellyfish@gellyfish.com>
Re: Generating a checksum... (Bart Lateur)
Re: How do I sort files in a dir by last modified time? <bill@fccj.org>
How do I write CGI in C++? <elia@infogear.co.il>
Re: How to diagnose/fix internal errors? (Malcolm Ray)
Re: How to display background picture in cgi? <bill@fccj.org>
Re: Intersection of several lists (Sitaram Chamarty)
Re: invoking a script (not in a subshell) <d95thl@ida.csd.uu.se>
Is this a bug in Perl? <derek@fortstar.demon.co.uk>
Re: macperl - directory names with embedded spaces (Bart Lateur)
Re: MySQL Placeholders II <clint@drtech.co.uk>
Net::SMTP <dano@monarchmed.com>
Re: OLE reference <gellyfish@gellyfish.com>
Re: opening a CGI script using IE4.0 from a win98 PWS <c4jgurney@my-deja.com>
Re: Perl "constructors" armchair@my-deja.com
Perl Program - Timeout <prasad@panix.com>
Re: perlcc compiling problems vishalb@my-deja.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Jun 1999 10:39:10 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: alt.perl post of the millennium
Message-Id: <375f87be@newsread3.dircon.co.uk>
Uri Guttman <uri@sysarch.com> wrote:
>
> this person should not be allowed near anything more complicated than a
> popup toaster.
>
Probably no more complex than a feeder cup if the truth be known.
> we are all going to aohell in a handbasket. i am not charging enough for
> my services. does anything really matter?
>
>
> Subject: Help for the ignorant
> Newsgroups: alt.perl
<enough>
You've obviously got a stronger consitution than most Uri - I cant even bear
to look there these days - I kill-filed anything that was crossposted
here and there some time ago.
/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: Thu, 10 Jun 1999 09:43:01 GMT
From: "Ryan" <dfs@thegrid.net>
Subject: Re: Binary File Uploading - Part 2
Message-Id: <01beb326$79e91480$fe31a2d1@ryano-ke>
Hi Eric,
Actually, it is...I realize my previous posts were bone headed and gave no
useful information at all <G> So, before I continue to piss off the
internet..
Here is the script: Yes, I did remove the urls because this script will be
ran on a non public site so please take no offense...
#!/usr/local/bin/perl
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser); #Sends full errors to
browser
$query = new CGI;
$CGI::POST_MAX=1024 * 30; #Limits uploaded file size
to 30K
$notify = "dfs\@thegrid.net"; #person send notification
of upload
$mail_path = "usr/lib/sendmail"; #sendmail path
&get_info; #sub routine call gets information from the form object
&error if($name eq ""); #sub routine error if name is blank
&error if($file_name eq ""); #sub routing error if file_name is blank
&print_results; #sub routine call prints output from program
¬ify; #sub routine call sends email to sysop
exit 0; #program is finished
sub get_info{
$name = $query->param('name'); #name entered on form
$file_name = $query->param('file_entered'); #file name entered
@parts = split(/\\/, $file_name); #split file name path up
$newname = $parts[$#parts]; #gets the last part of parts array
}
sub error{
print header();
if ($name eq ""){
print<<"text";
You must enter your name to upload a file\!<br>
<a href="url goes in here">Return to Form</a><br>
</body><br></html>
text
}
if ($file_name eq ""){
print<<"wrap";
You must enter the file name to upload a file\!<br>
<a href="url goes in here">Return to Form</a><br>
</body><br></html>
wrap
}
exit 0;
}
All of the above works just fine. Then, the problem is below, I suspect in
the next block. The file is created in the submits directory however, no
information is read into the file from the users computer. Then, the 500
termination occurs.
sub print_results{
open (NEWPIC,">../submits/$newname") || #open existing or create the
file and filehandle NEWPIC
die "Unable to create or open file $!"; #or die program and send
error to browser
while ($bytesread=read($newname,$buffer,1024)) {
print NEWPIC $buffer;
}
close(NEWPIC); #close NEWPIC
}
Then there is a send mail subroutine but the script never gets that far....
Any thoughts anyone?
Thanks,
Ryan
dfs@thegrid.net
Eric Bohlman <ebohlman@netcom.com> wrote in article
<ebohlmanFD2tw9.Mrq@netcom.com>...
> Ryan (dfs@thegrid.net) wrote:
> : Yeah, I have fatalsToBrowser in the script and only receive the 500
error.
>
> That suggests that either your server is failing to call your script at
> all, or that your script is bombing out with a compilation error rather
> than run-time error.
>
> : I will try to find information on the warn feature in the docs..
>
> In this case, that won't help, since it sounds like your script is never
> running.
>
------------------------------
Date: Thu, 10 Jun 1999 04:53:44 -0600
From: kenny@kacweb.com (Kenny A. Chaffin)
Subject: Re: Calling an applet from perl
Message-Id: <MPG.11c9471f595ff06598adc8@news.dimensional.com>
In article <7jlu3g$l2q$1@nnrp1.deja.com>, greynaga@yahoo.com says...
> In article <375e6237.0@news.new-era.net>,
> scott@aravis.softbase.com (Scott McMahan) wrote:
> > Gerardo (greynaga@yahoo.com) wrote:
> >
> > > I'm trying to call an applet from a perl script. I keep getting:
> > > "Applet Files class Files could not be loaded"
> >
> > But your program is a CGI program, and its document base is
> > different from regular web pages. Could it be that you need
> > to give the complete URL to the class files?
> >
> > Scott
>
> First of all thank you for your answers.
> Reading from cgi-bin/test:
> Yes, the server can read from there. I have some other scripts there,
> but just to be on the safe side I've copied the files to cgi-bin
> directory.
>
> Static web page:
> It runs fine if I call it from a plain HTML code. I even tried changing
> the applet for a HelloWorld with same results.
>
> URL:
> I've tried puting the URL but I may be have the wrong syntax, even
> though I tried different ways to write it. What's the right syntax?
>
> Thanx
> Gerardo
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Show us the code.
--
KAC Website Design
Custom Programming, Web Design, and Graphics
kenny@kacweb.com - http://www.kacweb.com
------------------------------
Date: Thu, 10 Jun 1999 10:16:50 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: can i variably name an array?
Message-Id: <375f8211.1380814@news.skynet.be>
Tom Christiansen wrote:
> abigail writes:
>:Do you have the urge to do this when programming in C or Pascal
>:as well?
>
>Script kiddies don't have real programming backgrounds.
So programming in Perl isn't "real" programming?
Bart.
------------------------------
Date: Thu, 10 Jun 1999 00:08:18 -0700
From: "duh" <duh@pro.com>
Subject: CGI script from win32 -> IE4.0
Message-Id: <928998479.665.67@news.remarQ.com>
Hello, I'm stuck on getting started with perl. My basic problem is that
when I try to open a perl script from IE4.0, IE4.0 gives me a dialog box
asking me to either save the file, or to open it locally. When I open it
locally, it runs the perl script, but doesn't output the results to the
browser. How do I get the CGI script to output the data to a browser.
Notes:
1) the script:
print "Content-type: text/html/n/n";
print "hello web surfer!";
2) I can run this script from the [dos] command line ok
3) The errors I get in IE4.0 depend on the settings in PWS (personal web
server). My errors have included: "HTTP/1.1 500 Server Error", "404...",
and "no read access". These different messages occur when I have various
settings in PWS for read/execute/script access for either the wwwroot, or
for cgi-bin directories. When I open up all of the permissions, is when I
get the problem I've described at the top of the e-mail (runs, but doesn't
return data to web browser).
4) I tried adding the #!..., but it appears to behave in the same manner if
I have that line or I don't (I'm assuming my path is set already).
5) Is there a setting in IE4.0 that would affect this?
6) Do I need another file association in the registry?
7) Note, I've just gotten started with this and have just loaded perl 5.17.
------------------------------
Date: Thu, 10 Jun 1999 15:04:59 +0800
From: Arthur Yeung <kcyeung@netvigator.com>
Subject: Compile and IIS
Message-Id: <Pine.SOL.4.10.9906101503390.19526-100000@one4all.netvigator.com>
Hi,
1. Is it possible to compiles *.pl to exe file?
2. How can I let my MS IIS 3.0 to run perl scripts? Please give me some
steps.
Thank you very much.
Arthur.
________________________________________________________
,,,,,,,,,, , ,
, , , ,
, , ,,,,,,,,, ,,,,,,,,,,,, ,,,,,,,,,
, , ,
, ,
, ,
, 99'
me-ru: kcyeung@netvigator.com
~~ THE SUN WILL COME OUT TOMORROW! ~~
------------------------------
Date: Thu, 10 Jun 1999 12:37:07 +0200
From: Andrzej Filip <anfi@bigfoot.com>
Subject: Re: E-mailing with perl is driving me crazy!
Message-Id: <375F9553.B6ABB577@bigfoot.com>
Christopher Fairbairn wrote:
> Hi,
>
> I have a small question.
>
> Why does the following peice of perl code fail:
>
> #!/usr/local/bin/perl
>
> open(MAIL,"|/usr/lib/sendmail lgcl01\@ihug.co.nz");
> print MAIL "Subject: This is a subject line\n\n";
> print MAIL "This is an empty body.\n";
> close(MAIL);
>
> open(MAIL,"|/usr/lib/sendmail lgcl01\@es.co.nz");
> print MAIL "Subject: This is a subject line\n\n";
> print MAIL "This is an empty body.\n";
> close(MAIL);
>
> It looks fine to me and both of those email accounts work properly. The
> problem is that with this program there is never ever any email sent to
> lgcl01@ihug.co.nz
>
> Why is it that if I send an email with this simple perl / sendmail I get it
> if I send it to lgcl01@es.co.nz but not if the perl / sendmail program
> thinks it is being sent to lgcl01@ihug.co.nz ?
>
> I'm stumped :-)
>
> I've tried lots of things. I have a third email account which is
> christopher@computer4u.com and this simple perl script won't send an email
> to this account either.
>
> What have I done wrong? It must be simple as the script couldn't get much
> simpler could it?
Try the following shell script to find out if perl is the one to blame.
It will run sendmail in verbose mode and it will check the exit code
(should be zero)
--------------------------->
#!/bin/sh
MAIL=/usr/lib/sendmail
RCPT=lgcl01@ihug.co.nz
$MAIL -v -t -oi <<END
To: $RCPT
Subject: This is a subject line
This is an empty body
END
echo Exit Code $?
<---------------------------
--
Andrzej (Andrew) A. Filip
http://www.bigfoot.com/~anfi
E-mail: anfi@bigfoot.com
I NO LONGER USE anfi@polbox.com
Posting history (all addresses):
http://www.dejanews.com/profile.xp?author=Andrzej%20Filip&ST=PS
------------------------------
Date: Thu, 10 Jun 1999 12:27:02 +0200
From: Andrzej Filip <anfi@bigfoot.com>
Subject: Re: Emailing Binary Files
Message-Id: <375F92F6.142E6DFE@bigfoot.com>
rad91@my-deja.com wrote:
> I'm interested in a module/technique I can use to email binary files.
> I assume that I would first have to encode the file to base64. Is that
> correct? How would I do that? Your help would really be appreciated.
Have you tried mime::LITE ?
--
Andrzej (Andrew) A. Filip
http://www.bigfoot.com/~anfi
E-mail: anfi@bigfoot.com
I NO LONGER USE anfi@polbox.com
Posting history (all addresses):
http://www.dejanews.com/profile.xp?author=Andrzej%20Filip&ST=PS
------------------------------
Date: Thu, 10 Jun 1999 09:21:28 +0200
From: Henk Bokhoven <h.c.a.bokhoven@kpn.com>
Subject: Error while running News-Scan-0.51
Message-Id: <375F6778.66AFDB64@kpn.com>
Hi there!
[ see subject ]
This is what I get:
-- 8< -- cut here -- 8< --
Encountered CODE ref, using dummy placeholder \
at /usr/lib/perl5/5.00502/i586-linux/Data/Dumper.pm line 429.
Argument "1, 2, and 4" isn't numeric in eq at ./news-stats line 229.
Argument "2, 4, and 5" isn't numeric in eq at ./news-stats line 229.
Can't call method "orig_volume" on an undefined value \
at ./news-stats line 343.
-- 8< -- cut here -- 8< --
There's only 33 messages in the group I'm trying to parse, it's showing
data until "Top 10 Posters by OCR (minimum of five posts)" comes up with
only 2 posters mentioned. Anyone has / had the same problems?
Regards,
--
___ ___ __ | Henk C.A. Bokhoven, Groningen, NL
/ / / /____ (__)__ ___ | E-mail : hbokh at worldonline dot nl
/ /_/ / _ \/ /\ \/ / | day : HP-UX, Digital OSF1, Linux
\___,__/__//__/__/ /__/\__\ | night : Linux SuSE 6.1 on an i686
------------------------------
Date: 10 Jun 1999 10:46:00 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Error while running News-Scan-0.51
Message-Id: <375f8958@newsread3.dircon.co.uk>
Henk Bokhoven <h.c.a.bokhoven@kpn.com> wrote:
> Hi there!
>
> [ see subject ]
>
> This is what I get:
>
> -- 8< -- cut here -- 8< --
> Encountered CODE ref, using dummy placeholder \
> at /usr/lib/perl5/5.00502/i586-linux/Data/Dumper.pm line 429.
> Argument "1, 2, and 4" isn't numeric in eq at ./news-stats line 229.
>
It might be useful if you posted the section of your code that is
giving rise to this problem.
/J\
--
"We've even been asked to review a luxury hotel. I can't think why" -
Neil Hamilton
------------------------------
Date: Thu, 10 Jun 1999 10:16:56 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Generating a checksum...
Message-Id: <376187b3.2823145@news.skynet.be>
Jim Matzdorff wrote:
>My problem is that I am unsure of how to get a one-complement in perl,
Simple: bitwise NOT: "~".
~$checksum
As for calculating the checksum, check out perlfunc for the
pack()/unpack() functions. Simple checksums are part of the built-ins,
and it may well do what you want. There's an example in ther unpack()
reference entry.
Bart.
------------------------------
Date: Thu, 10 Jun 1999 06:23:39 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: How do I sort files in a dir by last modified time?
Message-Id: <375f921b.0@usenet.fccj.cc.fl.us>
In article <7jnc3j$o1d$1@pumpkin.pangea.ca>, "AEF" <aef@pangea.ca> wrote:
> How do I sort files in a directory, on the last modified time, and print
> that time out in a formated month, day , year?
>
Did you check out the new Perl Cookbook?
It has a killer script which this very
question is answered. Also, you could
change the code and do other neat stuff!
Best book yet, IMO;
-Sneex- :]
_________________________________________________________________________
Bill Jones | Data Security Specialist | http://www.fccj.org/cgi/mail?dss
FCCJ | 501 W State St | Jacksonville, FL 32202 | 1 (904) 632-3089
$_ = "Jacksonville Perl Monger"; while(/([Jacksonville Perl Monger])/g){
print join(" ", map{defined $_ ? $_ : " "} $`, $&, $', $+), "\n";}
------------------------------
Date: Thu, 10 Jun 1999 14:02:41 +0300
From: Elia Weiss <elia@infogear.co.il>
Subject: How do I write CGI in C++?
Message-Id: <375F9B51.32EB3055@infogear.co.il>
Hi,
I want to write a CGI in C++ (usually I use TCL/tk)
but I don't know how to reach the environment variable
(i.e. The data that being send by the user/browser
and being set by the server as global/enviormment variable)
So I do reach does var's?
Is there any special Lib to work with CGI's?
Is there any reason way not writing a CGI in c++ (i.e. versus. TCL)?
Is there a better forum I should present this kind of questions?
Thanks
Elia Weiss
------------------------------
Date: 10 Jun 1999 10:49:48 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: How to diagnose/fix internal errors?
Message-Id: <slrn7lv62c.d5u.M.Ray@carlova.ulcc.ac.uk>
On 09 Jun 1999 16:09:53 -0500, Diego Zamboni
<zamboni@xnet-a-062.resnet.purdue.edu> wrote:
>Hi,
>
>I am in the process of porting a set of fairly large modules/programs
>written in Perl from Solaris 2.5.1 on Sparc (where they were written)
>to Linux. I am using RedHat 5.1 with a 2.0.34 kernel and Perl
>5.004_05, running on a Pentium machine.
>
>Being Perl, there was really no much porting necessary, except for the
>following weird problem. There are two different (but I think related)
>parts to the problem.
>
>Part 1:
>-------
>
>When the program exits, I get the following errors:
>
>Attempt to free unreferenced scalar during global destruction.
Do you use any signal handlers in this code? I've had similar problems
when using a signal handler which did a 'print'. Note this from perlipc:
For example, to trap an interrupt signal, set up a handler
like this. Do as little as you possibly can in your
handler; notice how all we do is set a global variable and
then raise an exception. That's because on most systems,
libraries are not re-entrant; particularly, memory
allocation and I/O routines are not. That means that
doing nearly anything in your handler could in theory
trigger a memory fault and subsequent core dump.
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: Thu, 10 Jun 1999 06:33:17 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: How to display background picture in cgi?
Message-Id: <375f945c.0@usenet.fccj.cc.fl.us>
In article <7jnc4v$p6u$1@godzilla.krdl.org.sg>, "CacheBoy"
<chongsun@krdl.org.sg> wrote:
> I tried to generate a web page from my perl program but the background which
> is a gif file did not show.
> The path is correct
>
Way off topic. Try comp.infosystems.www.browsers...
-Sneex- :]
_________________________________________________________________________
$_ = "Jacksonville Perl Monger"; while(/([Jacksonville Perl Monger])/g){
print join(" ", map { defined $_ ? $_ : "" } $`, $&, $', $+), "\n"; }
------------------------------
Date: Thu, 10 Jun 1999 10:42:03 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Intersection of several lists
Message-Id: <slrn7ltdbu.6sf.sitaram@diac.com>
On Tue, 08 Jun 1999 16:58:38 GMT, Thomas Weholt <u970130@studbo.hit.no> wrote:
>Hi,
>
>I got several ( 3 - 15) lists that I need to put into one, containing
>only the items that are in all the lists ( intersection ).
Start with
perlfaq -q intersect
If that doesnt give you enough ideas on how to do what you want to
do, ask again.
>Please help a newbie!! ;->
perldoc will usually help - that's what it's there for!
------------------------------
Date: 10 Jun 1999 10:37:14 +0200
From: Thomas L|fgren <d95thl@ida.csd.uu.se>
Subject: Re: invoking a script (not in a subshell)
Message-Id: <x40g140bged.fsf@ida.csd.uu.se>
>>>>> "DS" == Dan Shea <dshea@taurus.pppl.gov> writes:
DS> Hi,
DS> [...]
DS> I have a perl script which needs to look at users environment
DS> variables, strip out duplicate instances of paths:
DS> e.g.
DS> $PATH = .:/bin:/usr/bin:/usr/bin
This is a _very_ bad PATH.
DS> would become
DS> $PATH = .:/bin:/usr/bin
This is not much better.
DS> Now, what I am trying to figure out is how I can force my Perl
DS> script to run in the current shell, instead of forking a
DS> subshell.
Why not make the perl script just print the results and do:
PATH=`my_path_script $PATH`
I do this, and it also means I can use the same script for other colon
delimited lists (or lists with other delimiters if specified). My
script also checks for '.' in the list, and removes it. Having the
current directory in your PATH is a Bad Thing, and having it first in
your PATH is just plain insanity. I'll provide an example if you
can't figure out why.
Tom
--
T. Lofgren - Wherever I lay my .emacs, that's my ${HOME}
These opinions are mine, not yours. Get your own damn opinions.
------------------------------
Date: Thu, 10 Jun 1999 11:00:43 +0100
From: Derek <derek@fortstar.demon.co.uk>
Subject: Is this a bug in Perl?
Message-Id: <375F8CCB.5236879A@fortstar.demon.co.uk>
I've posted this problem before, but got no response to it. I'm starting
to think it's a bug in Perl. It shows itself in 5.004 and 5.005, but
5.001 and 5.003 are OK. This script, on AIX, shows it up:
#!/bin/perl -w
use strict;
use POSIX qw(:sys_wait_h :signal_h);
sub reaper
{
my $dead_child = wait;
print "Reaped $dead_child with status of $?\n";
}
$SIG{CHLD} = \&reaper;
if( fork ) { exit 0; }
my @lines = qx(ps);
die("Dead with $?\n") if( ($? >> 8) != 0 );
print "Done\n";
What this does is set up a signal handler for the SIGCHLD signal, which
is installed before a backtick call to a command which will complete
correctly (ps in this case). The problem is that despite the fact that
the ps worked OK, the $? variable is corrupted with -1. On an AIX box
with Perl 5.004 I get this:
> ./reaper.pl
Reaped 18678 with status of 0
Dead with -1
Reaped 25888 with status of 2560
Perl 5.001 on AIX gives:
> Reaped 49164 with status of 0
Done
If this is not a bug, and the behaviour of Perl has changed in some way
I don't understand, I'm happy to be shouted down for the subject of this
post. But if this is a bug, and if someone who knows what they are doing
could produce a patch, I could really use it! My workarounds are not
entirely successful at the moment.
------------------------------
Date: Thu, 10 Jun 1999 10:16:53 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: macperl - directory names with embedded spaces
Message-Id: <376084ae.2050185@news.skynet.be>
Tom Phoenix wrote:
>> How do I specify the path to a file where the some of the folder
>> (directory) names have embedded spaces?
>
>The same way as with any other file name. :-)
>
> my $file_name = "I've got spaces";
> open FILE, $file_name
> or die "Can't open '$file_name': $!";
>
>Well, I know that was the file name which had spaces in it, but it's the
>same principle. Have fun with Perl!
Problems will occur if your filename begin or end with spaces. That IS
legal on a Mac, and open() will strip them. Blimey. You then need to use
the more complex 3-parameter sysopen().
But, actually, I don't think it's the spaces causing you trouble. I've
noticed that open() will NOT WORK if the filename or the folder path
contains a null byte. That too IS LEGAL on a Mac. Super blimey. Again,
sysopen() MAY help (haven't tested). BTW that is the reason why plain
opening a file on a PC diskette in MacPerl doesn't work: the disk name
contains null bytes. You'd have to rename the diskette first.
HTH,
Bart.
------------------------------
Date: Thu, 10 Jun 1999 09:04:53 +0100
From: "Clinton Gormley" <clint@drtech.co.uk>
Subject: Re: MySQL Placeholders II
Message-Id: <7jnreh$evu$1@taliesin.netcom.net.uk>
I tried building a list as suggested below (ie
$list=join(',',@list);
SELECT * FROM Table WHERE ID in (?)
$sth -> execute ($list)
), but it only ever gives me the first record in the series.
likewise for :
$list=join(',',@list);
SELECT * FROM Table WHERE ID in ($list)
$sth -> execute
This doesn't work either:
@list=(1..4);
SELECT * FROM Table WHERE ID in (@list)
$sth -> execute
It just gives me this error: "You have an error in your SQL syntax near '2 3
4)"
However, this does work:
SELECT * FROM Table WHERE ID in (${\join(',',@list)})
$sth -> execute
I can prepare a statement each time, but I'm obviously trying to avoid
preparing more often than I have to.
Any suggestions?
Thanks
Clint
btw - in my defense re Graham Ashton's comment that this might not be the
right place for this discussion, I figured that this was more a DBI module
issue than a MySQL issue. Hope I figured correctly.
-----Original Message-----
From: Dave Wolfe [mailto:dwolfe@risc.sps.mot.com]
Sent: 09 June 1999 19:15
To: Clinton
Subject: Re: Mysql Placeholders
[ Clinton writes: ]
>
> I'm trying to do this :
> SELECT * FROM Table WHERE Id IN (1,2,3,4)
>
> I'd like to replace the 1,2,3,4 with a place holder, but it looks like I
> would have to do this :
> SELECT * FROM Table WHERE Id IN (?,?,?,?)
>
> Only problem is, I don't know how many numbers I will have beforehand.
Use "SELECT * FROM Table WHERE Id IN (?)" and combine the list of values
into a single string, complete w/ commas, e.g.:
my $sth = $dbh->prepare("SELECT * FROM Table WHERE Id IN (?)") || die
...;
my @possibilities = (1..4); # Build list however you do it
$sth->execute(join(",", @possibilities)) || die ...;
or even build it incrementally...
my $value = my $del = "";
while (something) {
...
$value .= "$del$number";
$del = ",";
...
}
$sth->execute($value) || die ...;
--
Dave Wolfe
------------------------------
Date: Sun, 6 Jun 1999 12:25:04 +0200
From: "Daniel Ostroff" <dano@monarchmed.com>
Subject: Net::SMTP
Message-Id: <7jden4$f2a$1@news.netvision.net.il>
Am trying to run a simple Perl script using the SMTP module.
Get the following message:
Global symbol "%NetConfig" requires explicit package name at
C:/Perl/lib/Net/SMTP.pm line 30.
Compilation failed in require at \prog\sendmail.pl line 1.
BEGIN failed--compilation aborted at \prog\sendmail.pl line 1.
A few facts:
1. Installed ActiveState perl binarry build 516
2. Downloaded the CPAN module: libnet-1.0606.tar.gz
3. Changed in c:\perl\lib\net\configue
added: use ExtUtils::MM_Win32;
commented: ##::use ExtUtilsMakeMaker qw(prompt);
Any help or direction would be appreciated.
(I posted this to perl.modules, but no response; perhaps I'll do better in
this forum...)
------------------------------
Date: 10 Jun 1999 10:29:46 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: OLE reference
Message-Id: <375f858a@newsread3.dircon.co.uk>
john kelly <johnt.kelly@worldnet.att.net> wrote:
> Can anyone please point me to some examples of how to use OLE objects
> for word. The doc makes references to looking up the objects in VB or
> C manuals but I don't have any. Other then snip its of code examples
> here or there, thats all I can find.
>
<http://msdn.microsoft.com/officedev/preview/technical/articles/word.asp>
/J\
--
"It needs to be said: Tinky Winky is ... an ideal role model for any
child without toes or genitalia" - Paul Rudnick, The Guardian
------------------------------
Date: Thu, 10 Jun 1999 08:24:09 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: opening a CGI script using IE4.0 from a win98 PWS
Message-Id: <7jnsn4$ckk$1@nnrp1.deja.com>
In article <928996157.334.20@news.remarQ.com>,
"duh" <duh@pro.com> wrote:
<Random snips>
> First CGI script and I can't figure it out!
>
> I have a book describing how to write a CGI script to return data as
an html
> page it is as follows:
>
> --------------------
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
> print "Hello web surfer";
> --------------------
> Should put "Hello web surfer" into the web browser, but instead IE4.0
is
> prompting for me to either open in in place, or to save the file.
> Hendrik
PWS seems to give a lot of people a lot of trouble running perl scripts.
I don't know the answer to your problem by try posting to
comp.infosystems.www.servers.ms-windows where this kind of thing gets
asked a lot.
HTH
Jeremy Gurney
SAS Programmer | Proteus Molecular Design Ltd.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 10 Jun 1999 09:29:36 GMT
From: armchair@my-deja.com
Subject: Re: Perl "constructors"
Message-Id: <7jo0hq$dir$1@nnrp1.deja.com>
In article <7jlnn9$ig3$1@nnrp1.deja.com>,
John Porter <jdporter@min.net> wrote:
> In article <7jl9m9$ec9$1@nnrp1.deja.com>,
> armchair@my-deja.com wrote:
> > In article <7jjl5o$rkg$1@nnrp1.deja.com>,
> > John Porter <jdporter@min.net> wrote:
> > > I don't think there's *anything* you can do in only 4 lines
> > > of assembly! :-)
> >
> > And yet your persist in calling C, merely "portable assembly".
>
> Right, because it is. What takes one line of C may take 1, 4, or
> 100 lines of assembly; but the transformation is predictable,
> comprehensible, and easy to automate. I'm not sure why you have
> such a problem with this; this is what drove the whole design of
> the C language.
C is not just a portable assembler. You appear to admit it, then appear
to state it again. People who had no intention of running their code on
anything but an IBM PC or compatible wrote it in C, not because it was
portable assembler, versus 8086 assembler, they did so and do so because
it is a higher level language. Much easier to use and program. Which you
admit by stating above "one line of C may take 1, 4 or a 100 lines of
assembly".
>
> > > The issue was not whether the languages are "equal", but really
> > > whether they're Turing-equivalent; and they are, of course.
> >
> > No, the issue was whether they were equal, or equivalent.
>
> Then the comparison must be "True", because the languages are
> "equal or equivalent".
Yeah, this from a guy who has already stated "one line of C may take 1,
4 or 100 lines of assembly". Overfondness, and programming language, not
a pretty picture.
>
> > I don't know what Turing-equivalent is,
>
> Why does that not surprise me.
Because you are all knowing or because you used it because you realized
it was a meaningless but confusing way of trying to dance around your
little "C is portable assembler" conundrum. One or the other I would
imagine.
>
> > but I believe you have finally admitted that
> > assembly is not equal or equivalent to C.
>
> Where have I admitted that? C is equivalent to asm, therefore
> C is "equivalent or equal to" asm. If you don't understand that,
> then you need to take a remedial logic course.
If you think C is equal to assembler when you admit it takes 1, 4 or 100
lines of assembler to equal 1 line of C (and not the converse of course)
then you will need not need a logic course, but rather a deprogramming
treatment normally given to Moonies. Everything will work as is in the
course, just substitute Perlie, for Moonie, where applicable.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 10 Jun 1999 10:35:01 GMT
From: "Prasad" <prasad@panix.com>
Subject: Perl Program - Timeout
Message-Id: <pxM73.10672$eF3.5201@news.rdc1.nj.home.com>
Hi,
I have a Perl program that is triggered from a form's button.
That program sends e-mails to everyone listed in a file, which
can contain more than 100 entries. This is done in a loop, sending
one e-mail at a time.
The program prints the result of each e-mail sent as soon as it is sent.
Each mail operation takes about 10 seconds. However, the browser
errors out saying 'Time Out, no response from the server'. If I list
around 10 entries in the e-mail file, everything is okay.
How can I avoid the TIME OUT problem. Why it is timing out even though
I am printing some kind of HTML output? Do anyone know the solution to
this problem?
FYI: I print HTML headers as soon as the program starts.
CC E-Mail: prasad@panix.com
Thanks in advance.
- Prasad
------------------------------
Date: Thu, 10 Jun 1999 08:58:53 GMT
From: vishalb@my-deja.com
To: gulli@ideare.com
Subject: Re: perlcc compiling problems
Message-Id: <7jnuob$d5c$1@nnrp1.deja.com>
In article <375D22C5.4C985DF7@ideare.com>,
Antonio Gulli <gulli@ideare.com> wrote:
> Hello, i-m not a perlcc guru so hope someone could help me
> to understand the meaning of these error messages ... And to
> compile.
>
> Thank you !
>
> [gulli@egadi]..uname -a
> SunOS egadi 5.6 Generic_105181-05 sun4m sparc SUNW,SPARCstation-20
>
> gcc -v
> Reading specs from
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.0/specs
> gcc version 2.8.0
>
> Before .c code generation
> 1) What substconf stands for .. ? where can i find references to the
> meaning?
Donot worry about it, just some diagnostic info being dumped out.
> 2) SearchServer is a module which uses XSUB .. Socket ? What is the
> problem ?
>
perlcc doesnot handle XSUB's that require runtime intialiazation
very well ( unless the module cooperates which most modules donot).
How to handle it is still being debated.
So your script is unlikely to be compilable even with the latest
versions of perlcc ( though this might change in the near future)
If you are willing to change the Xsub modules to be compiler
friendly, I might be able to help you do it.
Regarding gcc internal error. You might get away by disabling
-O in ccoptimise in Config.pm. gcc finds it difficult enough
to digest perl compiler code, asking for optimization is asking
too much.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5942
**************************************