[12417] in Perl-Users-Digest
Perl-Users Digest, Issue: 6017 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 16 13:07:24 1999
Date: Wed, 16 Jun 99 10:00:20 -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 Wed, 16 Jun 1999 Volume: 8 Number: 6017
Today's topics:
Re: $_ and $@ - What are they? <gellyfish@gellyfish.com>
Re: 'and' problem <vincent_vanbiervliet@be.ibm.com>
Re: Asking for passwords and security (core dumps) (I R A Aggie)
Re: BigInt Hashes (Andrew Allen)
Re: dimensions of a jpg file <revjack@radix.net>
Formatting Unix file permissions eg., 755 -> rwxr-xr-x <plb@concentric.net>
Re: How to scan a directory and put all the files and t (Andrew Allen)
Re: Is it better perl than awk ? (Stepan Kasal)
Re: Is it better perl than awk ? <emschwar@rmi.net>
Makefile.PL when you're not the admin <burton@lucent.com>
memory question bing-du@tamu.edu
Re: newbie learning "my" declarations aaronp@removeme-shore.net
Re: Newbie Needs Help <upsetter@ziplink.net>
Re: Newbie Needs Help <perlguy@technologist.com>
Odd syntax in hash subscript <nolanj00@mh.us.sbphrd.com>
Re: parse a string in triplet ? (M.J.T. Guy)
Perl says "too many errors" but doesn't give me any <ken@ineffable.com>
Problems creating Text file. <jim.ray@west.boeing.com>
Re: saving uploaded file <gellyfish@gellyfish.com>
Re: this charecter @ ruined my day!! <cassell@mail.cor.epa.gov>
Re: this charecter @ ruined my day!! (Marcel Grunauer)
Re: what does this crypto script do? <gellyfish@gellyfish.com>
Re: What makes a string lose its quotes in DBI/DBD quer <clint@drtech.co.uk>
Re: What makes a string lose its quotes in DBI/DBD quer <craig@mathworks.com>
writing results (Twarren10)
Re: writing results <craig@mathworks.com>
Re: writing results <gellyfish@gellyfish.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Jun 1999 16:55:10 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: $_ and $@ - What are they?
Message-Id: <3767c8de@newsread3.dircon.co.uk>
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "A" == Abigail <abigail@delanet.com> writes:
>
> A> The best way to find out is to consult the intestines of a M$ developer.
>
> print 'disgusting' x 2 ;
>
> and won't all the chickens and sheep of the world protest that their
> documentation jobs are being taken away?
>
We're trying to conserver those for sacrificial perhaps towards the end
of the year ;-}
/J\
--
"Like Anne Robinson in a Korean restaurant, it'll be dog eat dog" -
Graham Norton
------------------------------
Date: Wed, 16 Jun 1999 18:16:54 +0200
From: "Vincent Vanbiervliet" <vincent_vanbiervliet@be.ibm.com>
Subject: Re: 'and' problem
Message-Id: <3767bf15@news.uk.ibm.net>
Terry Mealy <spike1965@worldnet.att.net> wrote in message
news:376789F6.7C8AF5F3@worldnet.att.net...
> ** Newbie Alert! Newbie Alert! **
> I am still a novice w/Perl but I'd like to take a stab at this. I'm
> sure experts will correct me if I'm wrong.
Even non-experts...
> > Hi All,
> >
> > I have this code :
> >
> > ---------------------------------------
> >
> > if (length ($form_data{'name'}) == 0 )
> > {
> > if (length ($form_data{'more_info'}) == 0 )
> > {
> > &error_html_query_form;
> > exit;
> > }
> > }
> > ---------------------------------------
if you read about the concept of 'truth', you'll see that any number is true
except for 0.
So if length(...) must be 0 to be true, you could say that length(...) must
be false (since that has to evaluate to 0, which is false).
Thus, the expression could be written like: ('!' means 'not', but you could
also use the word 'not')
if (!length($form_data{'name'}) and !length($form_data{'more_info'})) {
# do something
}
But if you know logics, you know you can write the following:
not a and not b
as
not (a or b)
so you could also write:
if !(length($form_data{'name'}) or length($form_data{'more_info'}))
{#execute something}
This doesn't look much shorter, and it isn't, but this is just to bring us
to the following: if you use a 'not', and you don't have an 'else', you can
replace the 'if not' by 'unless'. So your code becomes:
unless ( length($form_data{'name'}) or length($form_data{'more_info'}) )
{#do something;}
One last remark about the use of hashes: in perl you need quotes around all
words that aren't variables or functions, except for keys in hashes. So you
can write $a{'b'} as $a{b} (without the quotes).
So finally, your code becomes:
unless ( length($form_data{name}) or length($form_data{more_info}) ) {#do
something}
And the really last remark is this:
if you have a line saying something like:
if (<condition>) {<one line of code>}
you can write it like:
<one line of code> if <condition>
This frees you of all {,},( and )'s
(The same goes for unless).
So your code could become (if the 'exit' wouldn't have been there, that is,
but maybe you could write the 'exit' in the function you're calling):
&error_html_query_form unless (length($form_data{name}) or
length($form_data{more_info}));
That's all ;-)
Vincent
------------------------------
Date: 16 Jun 1999 15:59:17 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Asking for passwords and security (core dumps)
Message-Id: <slrn7mfikt.1ap.fl_aggie@thepentagon.com>
On 16 Jun 1999 15:33:06 GMT, Dr. Henrik Seidel <Henrik.Seidel@gmx.de>, in
<7k8g3i$5db$3@mamenchi.zrz.TU-Berlin.DE> wrote:
+ but my problem is the following: if the program dumps a core (e.g., a
+ bad root guy sends a signal 11), the password is contained in clear
+ text in that core dump.
If you have a "bad root guy", you've got far serious problems than
having clear-text passwords in a core dump.
+ (P.S.: I know that root can do everything anyway, but root must know how
+ to do the right thing, and sending a signal is really easy.)
Ah, but you might want to trap the signal.
perlfaq8: How do I trap control characters/signals?
James
------------------------------
Date: 16 Jun 1999 16:27:10 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: BigInt Hashes
Message-Id: <7k8j8u$7st$3@fcnews.fc.hp.com>
Claus Bayer (bayer@she.net) wrote:
: Hi!
: Sorry if this question has been asked million times before, but how
: do i declare a Math::BigInt Value in an hash. Constructs like
: %SomeHash = Math::BigInt->new("key","0"); or
: %SomeHash = Math::BigInt->new("key" => "0");
%SomeHash=("key" => Math::BigInt->new("0"));
but since that can get lengthy for large numbers of items,
%Somehash=("key1" => "0", "key2" => "1");
@Somehash{keys %Somehash}=map {Math::BigInt->new($_)} values %Somehash;
: doesn'd work! I want all values in that hash to be BigInt's Any ideas?
This might also help (from Math::BigInt docs):
After use Math::BigInt ':constant' all the integer decimal constants
in the given scope are converted to Math::BigInt. This conversion
happens at compile time.
Andrew
------------------------------
Date: 16 Jun 1999 16:58:27 GMT
From: Toronto Augustan <revjack@radix.net>
Subject: Re: dimensions of a jpg file
Message-Id: <7k8l3j$2u7$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Eric Bohlman explains it all:
:Browsers generally do a lousy job of rescaling images regardless of
:whether or not you preserve the aspect ratio. Additionally, if you're
:trying to shrink the images using browser rescaling, you're forcing the
:user to download the full-sized image files; I've seen people try to do
:this in order to create thumbnails
a.k.a. "dumbnails"
:for photo galleries, and the effect is
:a site that takes forever to display.
------------------------------
Date: 16 Jun 1999 09:52:10 PDT
From: <plb@concentric.net>
Subject: Formatting Unix file permissions eg., 755 -> rwxr-xr-x
Message-Id: <7k8knq$j2o@chronicle.concentric.net>
I'm looking for a pointer to an algorithm that takes the
octal unix file permissions (like 0755) and converts them
to the symbolic output as used by 'ls -l' such as rwxr-xr-x.
I've run across this once before, but can't seem to locate it now.
Thanks in advance,
--PLB
--
"Why oh why didn't I take the blue pill..."
------------------------------
Date: 16 Jun 1999 16:11:43 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: How to scan a directory and put all the files and their size to a text file
Message-Id: <7k8ibv$7st$2@fcnews.fc.hp.com>
I R A Aggie (fl_aggie@thepentagon.com) wrote:
: On Wed, 16 Jun 1999 09:18:42 -0400, Dariush_news <dazimi@yahoo.com>, in
: <7k88c0$3s2$1@clio.net.metrotor.on.ca> wrote:
: + However I need to have the size of the files also
: You mean like '$size=(stat($filename))[7];'??
or, for the readability unimpaired, '-s $filename'
Andrew
------------------------------
Date: 16 Jun 1999 14:13:48 GMT
From: kasal@matsrv.math.cas.cz (Stepan Kasal)
Subject: Re: Is it better perl than awk ?
Message-Id: <slrn7mfc8r.8ii.kasal@matsrv.math.cas.cz>
On Wed, 16 Jun 1999 09:48:53 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
> Also, if you're already somewhat familiar with programming, Perl may
> look more familiar.
Hi,
I don't agree. I like to go through the specification of a tool or
programming language. This way I have learnt Pascal, C, sed, awk, ...
Things like Perl or Mathematica are simply to large to glance. You
have to learn a subset (depending on what you read) and then continuously
hear things like "this can be written sipler"... I don't like those coloses
-- in history it was PL/1 (I think), combining all the best features of all
it's predecessors, and endig up as unusable vehicle.
I don't thing perl is unusable, I just think there is an elegance in doing
things with sed or awk (or even head, tail, cut, ...) when appropriate.
When you are planning to do complex evaluation of a huge amount of date, perl
is appropriate, but the data may still be preprocessed by awk and sed if you
wish it.
I have to admit that I don't know perl.
Stepan
------------------------------
Date: 16 Jun 1999 10:26:21 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Is it better perl than awk ?
Message-Id: <xkfyahkkt76.fsf@valdemar.col.hp.com>
demas@sunspot.tiac.net (Charles Demas) writes:
> In simpler words, you'll get more done more quickly learning awk
> first. Perl is more powerful and cryptic, and much harder to
> learn because there's so much more to it (I'm trying to learn it).
I beg to differ-- I spent about two or three weeks trying to learn enough
awk to do some text processing I needed, and never quite got it right. I
picked up Perl, read the manpages, and got it working in about two
hours.
To this day, I don't use awk for much of anything but a glorified
cut(1). I guess Perl just fit my expectations more closely.
> As you can infer, I think there's value to learning Perl, but
> I found awk much easier to master and get things done with while
> learning.
YMMV (and mine obviously does).
-=Eric
------------------------------
Date: Wed, 16 Jun 1999 11:22:55 -0500
From: Burton Kent <burton@lucent.com>
Subject: Makefile.PL when you're not the admin
Message-Id: <3767CF5F.DB0ACA90@lucent.com>
I use
'perl Makefile.PL PREFIX=~ LIB=~/lib/perl'
to install libraries in my own ~/lib/perl
directory.
But this seems unreliable when there is a
binary. If there is a binary, it's not found,
even if I put the path to the binary in @INC.
What should I try?
Thanks.
B
------------------------------
Date: Wed, 16 Jun 1999 15:18:11 GMT
From: bing-du@tamu.edu
Subject: memory question
Message-Id: <7k8f77$mtq$1@nnrp1.deja.com>
Hello there,
I know that as long as the Perl program has gotten the memory, the
memory will not be given back to the system during the execution period
of the program. My question is:
%test = (...=>..., ...=>..., ...); # %test is a big associative array
# do something with %test
%test = ();
if the space ever taken by %test can be reused by the program after
'%test=()'?
What's the difference between '%test=()' and 'undef %test'?
Your response to these questions will be greatly appreciated.
Bing
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 16 Jun 1999 16:39:31 GMT
From: aaronp@removeme-shore.net
Subject: Re: newbie learning "my" declarations
Message-Id: <7rQ93.67$7X1.15771@news.shore.net>
: "Make me a brand new variable, call it $total, and set its value to one
: more than it used to be."
I thought that all variables start out at 0, that was the mistake. Thanks
for all the help. I'll update with the changes and now know to declare the
variables before messing with them. Thanks again!
------------------------------
Date: Wed, 16 Jun 1999 16:05:26 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Newbie Needs Help
Message-Id: <aXP93.63$7X1.13099@news.shore.net>
Denise Pool-Kalvelage <rmbw40@email.sps.mot.com> wrote:
: I am looking for the code to subtract the count from a field when a user
: chooses a class to sign-up for. Example: I have a form for user to
: choose which day and time they would like to attend a class. When the
: class is full, >10, user must choose another day and time. I am on a
: strict deadline and need it fast!!! Can anyone help me???
What have you tried so far? What are you having problems with?
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Wed, 16 Jun 1999 11:10:20 -0500
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Newbie Needs Help
Message-Id: <3767CC6C.B9E98C00@technologist.com>
WHat kind of field? From the information you have provided, this will
work:
$field--;
Are you using a database, DBI?
Are you using a text file?
Also, you ask how to SUBTRACT but you are checking for a number GREATER
THAN 10! Are you looking to increment instead?
Need more info...
Brent
Denise Pool-Kalvelage wrote:
>
> I am looking for the code to subtract the count from a field when a user
> chooses a class to sign-up for. Example: I have a form for user to
> choose which day and time they would like to attend a class. When the
> class is full, >10, user must choose another day and time. I am on a
> strict deadline and need it fast!!! Can anyone help me???
>
> thanks,
> dpk
------------------------------
Date: Wed, 16 Jun 1999 10:25:41 -0400
From: John Nolan <nolanj00@mh.us.sbphrd.com>
Subject: Odd syntax in hash subscript
Message-Id: <3767B3E5.15E3F082@mh.us.sbphrd.com>
This code:
#-------------------------------------
my @list = qw( a b c );
my (%hash1, %hash2, %hash3, %hash4);
$hash1{ @list } = 1;
$hash2{ scalar @list } = 1;
$hash3{ qw( a b c ) } = 1;
$hash4{ "a", "b", "c" } = 1;
print keys %hash1; print "\n";
print keys %hash2; print "\n";
print keys %hash3; print "\n";
print keys %hash4; print "\n";
#-------------------------------------
Prints out the following:
Use of implicit split to @_ is deprecated at ./testme line 12.
3
3
3
abc
#-------------------------------------
Line 12 is the assignment to %hash3. I don't understand
the warning, and I also don't understand why the elements
in the list are concatenated in the assignment to %hash4.
Shouldn't all four assignments be equivalent?
Is this behavior documented somewhere? I've been searching
for it, but so far I have not found it.
In the first three assignment statements, the list is
evaluated in scalar context. But what context is used
in the subscript to %hash4?
Thanks for any info or pointers.
--
John Nolan
Smithkline Beecham
nolanj00@mh.us.sbphrd.com
------------------------------
Date: 16 Jun 1999 16:57:08 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: parse a string in triplet ?
Message-Id: <7k8l14$1vr$1@pegasus.csx.cam.ac.uk>
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
>
>> Gareth Rees <garethr@cre.canon.co.uk> wrote:
>> >
>> >Larry Rosler wrote:
>> >> print join '+' => map substr($dna, 3 * $_, 3), 0 .. (length $dna)/3;
>> >
>> >$_ = $dna; s/\G([ACGT]{3})/$1+/g; print;
>>
>> Don't do that. It's O(N**2) while most of the other responses are
>> O(N). And DNA strings can get quite long ...
>
>How is that O(N**2)? It loops over the input string exactly once, just
>as all the other solutions do.
But it has to rewrite the string to insert the extra character on
each cycle, and that's an O(N) operation, making a total of O(N**2).
Mike Guy
------------------------------
Date: Wed, 16 Jun 1999 11:21:48 -0500
From: Ken Causey <ken@ineffable.com>
Subject: Perl says "too many errors" but doesn't give me any
Message-Id: <3767CF1C.A8FA4400@ineffable.com>
I'm using Perl 5.004_04 for i386-linux.
I'm building a moderately large program (~5000 lines) and have split
it up into multiple .pl files which are included in the main .cgi
file using "require" (it's a CGI script of course). Everything was
going pretty well but debugging was getting more and more difficult
as the program got larger, so I thought it was time to start using
packages and "use strict". I had to do quite a bit of retrofitting to
get everything to have package identifiers and so on. I've
finished the bulk of this and now am just going through and fixing the
handful of lines I missed. For some reason however, I'm getting a
strange error situation where perl bombs with "contents.pl has
too many errors." but I get absolutely no error messages.
"contents.pl" is one of the "require"d files by the way. I've tried
the -w switch which reports a bunch of "only used once...might
be a typo"s and a few complaints about missing quotes on words
being deprecated, but absolutely nothing about contents.pl. I'm
new to the debugger but can't find anything there which gives
me any more information.
Any help is greatly appreciated.
------------------------------
Date: Wed, 16 Jun 1999 15:40:39 GMT
From: "news.boeing.com" <jim.ray@west.boeing.com>
Subject: Problems creating Text file.
Message-Id: <FDFFJw.DBM@news.boeing.com>
I am converting my UNIX PERL to NT. I am using IIS4 and all the data files
are on the same area. For some reason my OPEN staement does not work
anymore. Her eis the code
open(CONFG, ">$dataname");
foreach $arg(@Save)
print CONFG ("$arg");
}
PERL goes through the motions of writing the file, but the file never gets
created. Am I missing some here> I am using Activestate PERL 5.3, NT 4.0
sp5 with IIS4.
Thank you for the help.
--
Jim Ray
Delta Program NT Administrator
The Boeing Company
714-896-2038
jim.ray@west.boeing.com
------------------------------
Date: 16 Jun 1999 16:51:56 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: saving uploaded file
Message-Id: <3767c81c@newsread3.dircon.co.uk>
Ryan Corder <uucon@my-deja.com> wrote:
> In article <slrn7mdvrk.hd.efflandt@efflandt.xnet.com>,
> efflandt@xnet.com wrote:
>> On Tue, 15 Jun 1999 22:05:13 GMT, Ryan Corder <uucon@my-deja.com> wrote:
>> >ok, following the advice of the newsgroup community, i have managed to
>> >configure my script with CGI.pm so that a user can upload a file. Now, how
>> >do i save the file in a particular dir. I want to be able to save the
>> >uploaded image in: /home/<username>/images here is the code i used to read
>> >the filename and the MIME type so that users can only upload images:
>>
>> If the script is not running suid as the user, make sure that the images
>> directory has 777 permission (747 or 707 might work). Other than that,
>> follow the instructions in CGI.pm.
>>
> Doesn't CGI.pm show you how to save a file with a specific filename
> though? i need to save it in their images subdir with the name they
> supplied.
>
What part of the example given in the documentation for CGI.pm are you
having trouble with ?
The filename returned is also a file handle. You can read the contents
of the file using standard Perl file reading calls:
The filename will have the full path to the uploaded file so you will need
to strip the directory path from it if you are going to save in a directory
of your choice.
/J\
--
"Childbirth is god's way of telling you that heterosexuality isn't
natural. It's got to be easier to get a penis up your arse than a baby
out of your vagina" - Graham Norton
------------------------------
Date: Wed, 16 Jun 1999 09:13:58 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: bd@albany.net
Subject: Re: this charecter @ ruined my day!!
Message-Id: <3767CD46.DFA6B247@mail.cor.epa.gov>
[courtesy cc sent to poster]
Brian Dodd wrote:
>
> Brian Dodd wrote:
> >
> > I am wrining a script that creates a html page. One part of the page is
> > a link to ane-mail address. Every time I put the @ charecter in my cgi
> > wont run??? if I put <A HREF="mailto:you yourdomain.com"> the script
> > will run. If I put <A HREF="mailto:you@yourdomain.com"> the script
> > dies. I cant read the error log because it is 33 meg. I cant telenet
> > either. The @ is not an operator is it. Is their a way to write a @
> > without a @? I tried to put th @ into a variable an then just put the
> > variable where the @ should go.
>
> It worked
> Thanks so much. I am just learning Perl. It would have taken me a long
> time to figure that out. \ means take next charecter as literal? like
> would \$ make a $ insted of a variable?
Yes. But you could just try it out. Or you could read the
extensive manpages that come with every install. If you don't
have ActiveState Perl on your own machine, go to
www.activestate.com and download it. It installs really easily,
and comes with hundreds of pages of documentation. Make a mental
note of where in your Start Menu it puts the shortcut to the
HTML tree. You'll want to go there to read up on Perl. Start
with the intro.
Since the pages are in essence a book of features, you may find
some of it a little heavy going. For example, you'll need to
get to the perldata section to learn all about the features
underlying your question. So start with this tutorial:
http://www.netcat.co.uk/rob/perl/win32perltut.html .
Then make sure you read the FAQ (Frequently Asked Questions),
so that at a minimum you have some idea of how comprehensive
they are. Then you can look through them the next time you
need help. The perldoc program will help you. It's always
easier to spend ten seconds using a tool than to wait ten
hours - or ten days - to get an answer from a bunch of surly
newsgroup posters. And the answer in the FAQ will be correct,
which is more than you can guarantee when posting to complete
strangers.
After that, read the section on the ppm program, so you'll
know how to download more cool modules from ActiveState (to
name but one repository).
"Have the appropriate amount of fun." - Larry Wall
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 16 Jun 1999 15:54:22 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: this charecter @ ruined my day!!
Message-Id: <3770c873.25348819@enews.newsguy.com>
On 15 Jun 1999 18:46:36 -0700, Tom Christiansen <tchrist@mox.perl.com>
wrote:
>--tom
>--
> For all we know, this is just an elaborite simulation running in a cube on
> someone's desk. --Captain Jean-Luke Picard (ST:ng)
[off-topic & pedantic:]
Jean-Luc Picard
Marcel
------------------------------
Date: 16 Jun 1999 16:59:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: what does this crypto script do?
Message-Id: <3767c9eb@newsread3.dircon.co.uk>
Simon Wistow <simon@profero.com> wrote:
>
> # this line has been commented out because I get a
> # compile error but as far as I can see it's verbatim
> #$o=~s/.chr(($f*&e+ord($&)-13)%26+65)/eg;
^
missing / (before) here
/J\
--
"Babylon 5 has some impressive special effects and enough dodgy hairdos
to make the current Conservative front bench look trendy" - Radio Times
------------------------------
Date: Wed, 16 Jun 1999 17:40:26 +0100
From: "Clinton Gormley" <clint@drtech.co.uk>
Subject: Re: What makes a string lose its quotes in DBI/DBD query.
Message-Id: <7k8jrm$of$1@taliesin.netcom.net.uk>
I don't think that the quoting of the original query is the problem. I am
currently using a here string. And usually it works, it seems though that
every now and again particular elements in the array lose their "type". So
it's an error during substitution.
The parameter array is built up like this :
my @parsedParams =
($params->{cat1}<1)?'%':$params->{cat1},
($params->{cat2}<1)?'%':$params->{cat2},
($params->{cat3}<1)?'%':$params->{cat3});
where $params = \%params= $r->args();
Thanks
Clint
Craig Ciquera <craig@mathworks.com> wrote in message
news:3767C5E7.A1F89FB@mathworks.com...
> Hi,
>
> Don't know exactly what would cause this behavior, but you may want to
take some
> additional steps. These would most likely alleviate the problem:
>
> my $sql = qq( SELECT id, name, title, phone
> FROM employees
> WHERE name LIKE ? );
>
> my $sth = $dbh->prepare( $sql );
>
> $sth->execute();
>
> Craig
>
> > Any ideas as to why this might happen? Is the array element being
> > transferred as a number rather than as a string? Does a % count as a
number
> > in perl? How do I prevent this?
> >
> > I've tried setting $param[elem]=''.$num; but to no avail.
> >
> > Thanks
> > Clint
>
------------------------------
Date: Wed, 16 Jun 1999 12:40:53 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: What makes a string lose its quotes in DBI/DBD query.
Message-Id: <3767D395.53B0DCDB@mathworks.com>
Sorry, maybe I'm missing something.
Perhaps you should use bind_params.
See: http://www.symbolstone.org/technology/perl/DBI/doc/tpj5/index.html
Craig
Clinton Gormley wrote:
> I don't think that the quoting of the original query is the problem. I am
> currently using a here string. And usually it works, it seems though that
> every now and again particular elements in the array lose their "type". So
> it's an error during substitution.
------------------------------
Date: 16 Jun 1999 16:01:11 GMT
From: twarren10@aol.com (Twarren10)
Subject: writing results
Message-Id: <19990616120111.18282.00000187@ng-ft1.aol.com>
I have put together this little program to periodically check my links on my
search program for dead ones. This works, but the problem I have is that while
checking all the links, I get a blank screen until all the links are checked,
then it prints the
results for my viewing. How can I get around this to print to screen each time
it checks every link, instead of having a dead screen until all links are
checked?
------------------------------
Date: Wed, 16 Jun 1999 12:14:30 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: writing results
Message-Id: <3767CD66.328F4375@mathworks.com>
$| = 1;
Craig
Twarren10 wrote:
> How can I get around this to print to screen each time
> it checks every link, instead of having a dead screen until all links are
> checked?
------------------------------
Date: 16 Jun 1999 17:04:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: writing results
Message-Id: <3767cb07@newsread3.dircon.co.uk>
Twarren10 <twarren10@aol.com> wrote:
> I have put together this little program to periodically check my links on my
> search program for dead ones. This works, but the problem I have is that while
> checking all the links, I get a blank screen until all the links are checked,
> then it prints the
> results for my viewing. How can I get around this to print to screen each time
> it checks every link, instead of having a dead screen until all links are
> checked?
Check out perlfaq5:
=head2 How do I flush/unbuffer an output filehandle? Why must I do this?
/J\
--
"Tony Blair. Make it so" - Patrick Stewart
------------------------------
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 6017
**************************************