[19888] in Perl-Users-Digest
Perl-Users Digest, Issue: 2083 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 7 14:06:29 2001
Date: Wed, 7 Nov 2001 11:05:16 -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: <1005159915-v10-i2083@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 7 Nov 2001 Volume: 10 Number: 2083
Today's topics:
Re: ActivePearl in Win2k closes window immediately <angenent@kabelfoon.nl>
ActivePerl / Perl using XP Pro (dmason)
ActivePerl can't open file...sometimes <vautourNO@SPAMunb.ca>
Re: ActivePerl can't open file...sometimes <rereidy@indra.com>
Re: Best language for low IQ programmers? <wiu09524@rrzc2.rz.uni-regensburg.de>
Re: Best language for low IQ programmers? <kjs@stauffercom.com>
Re: Best language for low self-esteem programmers? (Clinton A. Pierce)
bottom of report <nospam@newsranger.com>
Re: Calling a script via SSI to access MySQL (Tad McClellan)
Re: Code Review Needed! (Randal L. Schwartz)
dhcp client broadcasting to 255.255.255.255 (jack)
DHCPDISCOVER message in PERL? (jack)
diamond/buffering bug under Windows ME <grjash@yahoo.com>
Download Site Redirect (Timmy)
Re: Download Site Redirect <thepoet@nexgo.de>
Re: Emailing attachments <jens@irs-net.com>
Error on HTML tag blocks <fredz@silversoftware.com>
Re: Error on HTML tag blocks <echang@netstorm.net>
Re: Error on HTML tag blocks (Tad McClellan)
Re: Everything but the if... (martinblack)
Re: Everything but the if... <robsjobs@hotmail.com>
Re: getting just the variable names from inputs in a fo (Keith Clay)
Re: getting just the variable names from inputs in a fo (Tad McClellan)
Re: Help: simple perl question on Windows <jeff@vpservices.com>
Re: Help: simple perl question on Windows <jeff@vpservices.com>
IO::SOCKET:INET <johnedl@us.ibm.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 7 Nov 2001 19:37:51 +0100
From: "GOGAR" <angenent@kabelfoon.nl>
Subject: Re: ActivePearl in Win2k closes window immediately
Message-Id: <9sbuuv$mrq$1@news.kabelfoon.nl>
in the console (cmd.exe) you can just type the script name
for example
C:\script.pl
w2k should find perl.exe in the register
"Assaf Lavie" <assafl@flashnetworks.com> wrote in message
news:ecc4590e.0111070103.63b902ac@posting.google.com...
> yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote in message
news:<3be85d93@news.victoria.tc.ca>...
> > Glen (tara5111@home.com) wrote:
> > : Hello,
> > : Tried running an ActivePearl script on Windows2000 system.
> > : It seems to open a dos-looking window for a microsecond with the
results of
> > : the pearl script then closes the window.
> > : I don't know if this is because win2k doesn't use DOS and so doesn't
like to
> > : run DOS like windows but does anybody know how to keep an ActivePearl
> > : program window up after it is finished running to see the results of
your
> > : script instead of the window disappearing?
>
> Do this:
> Instead of running perl.exe:
> perl.exe yourfile.pl
> Run it through the cmd.exe with a /k switch:
> cmd /k perl.exe yourfile.exe
------------------------------
Date: 7 Nov 2001 08:52:52 -0800
From: dylmason@hotmail.com (dmason)
Subject: ActivePerl / Perl using XP Pro
Message-Id: <bb69ecbe.0111070852.11d291c7@posting.google.com>
...anyone have exp with Perl + XP Pro?....I'm building a box and need
to know whether I should pick it up or stick with W2000 if there's any
bugs running under XP Pro...thanks in advance...
------------------------------
Date: Wed, 07 Nov 2001 13:37:33 -0400
From: Gil Vautour <vautourNO@SPAMunb.ca>
Subject: ActivePerl can't open file...sometimes
Message-Id: <3BE9715D.46C247EC@SPAMunb.ca>
Hello,
I'm running ActivePerl on a Windows2000 machine and I have a script will
run fine when when double-clicked or run from a command prompt like (ie.
c:\>perl script.pl) However, when I specify the path to Perl.exe and
specify the path to the
script it spits an error saying that it cannot open the file ("No such
file or directory at...") that exists in the same place as the script.
The same error occurs when running it from the command prompt like
C:\Perl\bin>c:\script.pl
Why would this be happening? Is the script run with different
permissions
when invoked that way? Below is the script.
#!/usr/local/bin/perl -w
open(CRSOUTFILE,">coursesnew.txt") || die "cannot open the file $!";
open(CRSINFILE,"COURSES.TXT") || die "cannot open the file $!";
while(<CRSINFILE>){
if (/\(.*?\)/) {
$_ =~ s/\(.*?\)//g;
print (CRSOUTFILE "$_");
} else {
print (CRSOUTFILE "$_");
}
}
close CRSINFILE;
close CRSOUTFILE;
Thanks,
------------------------------
Date: Wed, 07 Nov 2001 10:44:13 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: ActivePerl can't open file...sometimes
Message-Id: <3BE972ED.32B61156@indra.com>
Gil Vautour wrote:
>
> Hello,
>
> I'm running ActivePerl on a Windows2000 machine and I have a script will
> run fine when when double-clicked or run from a command prompt like (ie.
> c:\>perl script.pl) However, when I specify the path to Perl.exe and
> specify the path to the
> script it spits an error saying that it cannot open the file ("No such
> file or directory at...") that exists in the same place as the script.
> The same error occurs when running it from the command prompt like
> C:\Perl\bin>c:\script.pl
>
> Why would this be happening? Is the script run with different
> permissions
> when invoked that way? Below is the script.
>
> #!/usr/local/bin/perl -w
>
> open(CRSOUTFILE,">coursesnew.txt") || die "cannot open the file $!";
> open(CRSINFILE,"COURSES.TXT") || die "cannot open the file $!";
> while(<CRSINFILE>){
>
> if (/\(.*?\)/) {
> $_ =~ s/\(.*?\)//g;
> print (CRSOUTFILE "$_");
> } else {
> print (CRSOUTFILE "$_");
> }
> }
> close CRSINFILE;
> close CRSOUTFILE;
>
> Thanks,
I am not sure is sh-bang works in windows (search the FAQs). But this
error indicates that Perl is not found at the location specified in the
sh-bang line (at least in UNIX), or the current directory is not in your
%PATH% variable.
--
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.
------------------------------
Date: 07 Nov 2001 15:16:55 +0100
From: Ulrich Windl <wiu09524@rrzc2.rz.uni-regensburg.de>
Subject: Re: Best language for low IQ programmers?
Message-Id: <snfn11ywtrc.fsf@rrzc2.rz.uni-regensburg.de>
Just try to understand some example code (let someone explain it to
you). If you don't understand any of the code, either find some new
friends, or give up the idea of programming. As one of my professors
said, once you managed to learn one language and the concepts, you
shouldn'd have trouble to learn any language in two weeks. Actually I
learned the basics of Perl in one weekend, any I actually can write
ugly Perl code ;-)
Ulrich
BrianMetc@aol.com (Brian Metc) writes:
> I would like to get into the programing field. My problem is that I have low IQ due to
> early childhool learning deprivation and TV overdose. Simply said I am stuped, I am
> pretty good amongst my friends, but not solving problems. You know what I
> mean. Anyways, I want to go into computor programing because of money
> issue. I now need to choose languege for programming, simple enough
> for me.
>
> My friend wh does C plus plus recommended that I learn either Visual Basic or Eiffel.
> My ex girlfriend who is a sys admin who did perl, sugested that I learn Ada because
> it has "serious type system" which is fool proof.
>
> She dis couraged me from using Eiffel because itr was a language going out of the
> market, no longer used by any serious corporation, She said the same thing for Ada.
>
> Java is simple compared to c plus plus but a scam language, based on hype.
>
> This only leaves visual basic. Especally because it is used under Windows, Microsoft
> stuff is always easier.
>
> Would any one sugest the best language for me.
>
> Brian
------------------------------
Date: Wed, 7 Nov 2001 12:53:36 -0600
From: "Ken Stauffer" <kjs@stauffercom.com>
Subject: Re: Best language for low IQ programmers?
Message-Id: <9sbvr6$h74$1@nntp9.atl.mindspring.net>
> "Brian Metc" <BrianMetc@aol.com> wrote in message
> news:1004990076967295@aol.com...
> > I would like to get into the programing field. My problem is that I have
> low IQ due to
> > early childhool learning deprivation and TV overdose. Simply said I am
> stuped, I am
> > pretty good amongst my friends, but not solving problems. You know what
I
> > mean. Anyways, I want to go into computor programing because of money
> > issue. I now need to choose languege for programming, simple enough
> > for me.
> >
C++ is the best choice for dull programmers. The quality of your code will
be indistinguishable from that of a the C++ guru.
Ken Stauffer
"If C++ is a serious object oriented language then Eiffel isn't -- an visa
versa"
------------------------------
Date: Wed, 07 Nov 2001 17:50:51 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Best language for low self-esteem programmers?
Message-Id: <3be97093.187058636@localhost>
[Groups and Followups trimmed. I hope.]
On Tue, 06 Nov 2001 01:11:27 -0700, Dan Hinojosa <dhinojosa@qwest.net>
wrote:
>It's not the IQ, but the persistence that makes a programmer.
>
As I pointed out before in:
http://groups.google.com/groups?selm=s0dy5.1995%24hD4.575937%40news1.rdc1.mi.home.com
There are some programmers that should just quit. No slight to the
original poster, but if he's not a clear thinker or gets into it and
has nothing but problems...all of the persistance in the world
wouldn't make him a good programmer or even an adaquate one.
Which isn't to say "don't try." That'd be nonsense and stupid. You
could be a savant. This might be "your thing." Try it. But if it
doesn't work out, PLEASE try a related field instead.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Wed, 07 Nov 2001 16:36:11 GMT
From: Nobody <nospam@newsranger.com>
Subject: bottom of report
Message-Id: <%pdG7.16132$xS6.23977@www.newsranger.com>
If STDOUT_TOP puts the header of the report, what is the
equivalent of the bottom of the report, at the end of the page.
------------------------------
Date: Wed, 07 Nov 2001 13:37:39 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Calling a script via SSI to access MySQL
Message-Id: <slrn9ui9of.ec1.tadmc@tadmc26.august.net>
Alex Shi <chpshi@stonix.com> wrote:
>
>the hosting company
>disabled it and said it was using a huge amount of system resources.
I do not see where it wastes resources, or even uses much.
But I don't think it is your real code anyway, so looking at it
was pretty much a complete waste of time.
>#!/usr/local/bin/perl
use warnings;
use strict;
>use Mysql;
Why are you not using the DBI module?
>($one, $mid, $two ) = split( /\//, $ENV{'DOCUMENT_URI'} );
If there ever happens to be 3 slashes in the URI, you will
discard parts.
Best to supply split() with a 3rd argument.
>if( $mid eq 'us' ){
> $parts = "us_parts";
>} else if( $mid eq 'ca' ){
> $parts = "ca_parts";
>} else if( $mid eq '
Uh, did you mean to end the string with a single quote?
Is this your real code?
>$parts = "$mid_parts";
Uh, did you mean to close the else block here?
Is this your real code?
You also have some useless quotes there:
$parts = $mid_parts;
>$td1 = "<td width=\"50%\" valign=\"top\" align=\"left\">";
If you used single quotes it would make it easier to read
what you wrote:
my $td1 = '<td width="50%" valign="top" align="left">';
>#List all the query result
>while(@aRow = $sth->fetchrow())
> print "[<a href=\"prdinfo.php3?code=$aRow[1]\">Order</a>]$asp";
If you used an alternate quoting mechanism it would make it easier to read
what you wrote:
print qq([<a href="prdinfo.php3?code=$aRow[1]">Order</a>]$asp);
What if $aRow[1] contains characters that need to be URL encoded?
> if(@aRow = $sth->fetchrow()){
Why are you processing *two* query results per loop iteration?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 07 Nov 2001 11:04:29 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Code Review Needed!
Message-Id: <m13d3qpflu.fsf@halfdome.holdit.com>
>>>>> "Uri" == Uri Guttman <uri@stemsystems.com> writes:
Uri> the dispatch table is a also style to protect against potential
Uri> changes in the future as well. the OP never said that the list of sub
Uri> was fixed or would be permanently hardwired. i prefer to make the
Uri> assumption the code will change as we all know code does change.
But until it changes, you can do this:
BEGIN {
my %table;
@table{qw(email_zip email_txt cp_zip cp_txt)} = ();
sub call_send {
my $func = shift;
die "invalid func $func" unless exists $table{$func};
($table{$func} ||= do {
no strict 'refs';
\&{"_send_$func"};
})->(@_);
}
}
That restricts the names that can be used, and caches the result of
the symbol-table lookup. I think that should satisfy all parties now.
print "Just another Perl hacker,";
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 7 Nov 2001 06:56:02 -0800
From: jack@brainminers.net (jack)
Subject: dhcp client broadcasting to 255.255.255.255
Message-Id: <90de0398.0111070656.d548801@posting.google.com>
I wwrote the following code to broadcasting a message to a DHCP server
but having trouble getting feedback. Any suggestion would be highly
appreciated.
#!/usr/bin/perl -w
# dhcp_client -- To detect DHCP server on the network by sending a
broadcasting
# UDP message
use strict;
use IO::Socket;
use IO::Select;
my $addr = shift || '255.255.255.255';
my $DHCP_client=IO::Socket::INET->new(Proto=>'udp') or die"Couldn't be
a udp server on port";
$DHCP_client->sockopt(SO_BROADCAST() =>1) or die"sockopt: $!";
my $dest = sockaddr_in(68, inet_aton($addr));
print "Awaiting UDP messages on port\n";
my $select = IO::Select->new($DHCP_client, \*STDIN);
while(1){
my @ready = $select->can_read;
foreach(@ready){
do_stdin() if $_ eq \*STDIN;
do_socket() if $_ eq $DHCP_client;
}
}
sub do_stdin{
my $data;
sysread(STDIN, $data, 1024) || exit 0;
send($DHCP_client, $data, 0, $dest) or die "send(): $!";
}
sub do_socket{
my $data;
my $addr = recv($DHCP_client, $data, 1024,0) or die "recv(): $!";
my($port, $peer) = sockaddr_in($addr);
my $host = inet_ntoa($peer);
print "received", length($data), "bytes from $host:$port\n";
}
------------------------------
Date: 7 Nov 2001 08:06:41 -0800
From: jack@brainminers.net (jack)
Subject: DHCPDISCOVER message in PERL?
Message-Id: <90de0398.0111070806.219444f7@posting.google.com>
How to send a DHCPDISCOVER broadcasting message to a subnet in PERL?
------------------------------
Date: Wed, 7 Nov 2001 08:10:31 -0800
From: "Gregory Sherman" <grjash@yahoo.com>
Subject: diamond/buffering bug under Windows ME
Message-Id: <9sbmab$942$1@news.chatlink.com>
perl v5.6.1 for MSWin32-x86-multi-thread
binary build 628 provided by ActiveState Tool Corp.
---------------------------------------------
while (<>)
{
chomp ($a[$i++] = $_);
}
$| = 1;
# print "unseen \n";
for $i (0..$#a)
{
print "\$a[$i] is $a[$i]\n";
}
---------------------------------------------
if STDIO is:
zero
one
two
STDOUT is:
$a[1] is one
$a[2] is two
uncomment the print line and "$a[0] is zero" appears,
but NOT the word "unseen"
------------------------------
Date: 7 Nov 2001 08:28:40 -0800
From: leun98@yahoo.com (Timmy)
Subject: Download Site Redirect
Message-Id: <6084bdc4.0111070828.137bd4cb@posting.google.com>
Hi CGI gurus,
On the webpage multiple download options are provided to
visitors with a drop down listbox. When a download site
is chosen and a visitor press the "Download" botton,
the browser will be directed to the selected download
web page. I would like to make a cgi script to implement
this function in Perl. I am a newbie of Perl. Any help
is appreciated!
Timmy
------------------------------
Date: Wed, 7 Nov 2001 17:58:47 +0100
From: "Christian Winter" <thepoet@nexgo.de>
Subject: Re: Download Site Redirect
Message-Id: <9sbp3e$p37$1@newsread2.nexgo.de>
"Timmy" <leun98@yahoo.com> wrote:
> On the webpage multiple download options are provided to
> visitors with a drop down listbox. When a download site
> is chosen and a visitor press the "Download" botton,
> the browser will be directed to the selected download
> web page. I would like to make a cgi script to implement
> this function in Perl. I am a newbie of Perl. Any help
> is appreciated!
This is quite easy to do using the CGI module. Would look
like...
--------------------------------------------------------
#!/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
# You could add more redirect-targets in the hash:
my %targets = ( 'CPAN' => 'http://www.cpan.org',
'Perl' => 'http://www.perl.org' );
my $query = new CGI;
my $selected = $query->param('target');
if( exists( $target{$selected} ) ) {
print $query->redirect( -uri => $target{$selected} );
} else {
print $query->redirect( -uri => 'http://localhost/nosuchtarget.htm' );
}
--------------------------------------------------------
...assumed your Form has a DropDown-Field named "target"
with value "CPAN".
HTH
Christian
------------------------------
Date: Wed, 07 Nov 2001 12:31:19 +0100
From: Jens Luedicke <jens@irs-net.com>
Subject: Re: Emailing attachments
Message-Id: <9sb66t$5e4$02$1@news.t-online.com>
Tintin wrote:
> You really are going to make life much easier on yourself if you use
> MIME::Lite
> It's very simple to install and very simple to use.
He should encapsulate the send() method within an eval because
this module dies always if the mail transport fails (using SMTP in my
case). It doesn't return undef or so.
--
Jens Luedicke
jens@irs-net.com
------------------------------
Date: Wed, 07 Nov 2001 15:08:57 GMT
From: Fred Zimmerman <fredz@silversoftware.com>
Subject: Error on HTML tag blocks
Message-Id: <3BE94EFC.890A0978@silversoftware.com>
I wrote the following code taken directly from
a CGI tutorial on the net:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print <<EndOfHTML;
<html><head><title>Test Page</title></head>
<body>
<h2>Hello, world!</h2>
</body></html>
EndOfHTML
It generated the following error:
CGI Error
The specified CGI application misbehaved by not returning a complete set
of HTTP
headers. The headers it did return are:
Can't find string terminator "EndOfHTML" anywhere before EOF at
D:\Source\Perl\Cgi\firstcgi2.cgi line 5.
+++++++++++++++++++++++++++++++++++++++++++++++++++++
What is the problem with this syntax? What should it be?
Fred Z
------------------------------
Date: Wed, 07 Nov 2001 16:36:51 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: Error on HTML tag blocks
Message-Id: <Xns91527727449FDechangnetstormnet@207.106.93.86>
Fred Zimmerman <fredz@silversoftware.com> wrote in
news:3BE94EFC.890A0978@silversoftware.com:
> I wrote the following code taken directly from
> a CGI tutorial on the net:
>
>
>#!/usr/bin/perl
Ask for all the help you can get. learn about warnings
> print "Content-type:text/html\n\n";
>
> print <<EndOfHTML;
> <html><head><title>Test Page</title></head>
> <body>
> <h2>Hello, world!</h2>
> </body></html>
> EndOfHTML
>
>
> It generated the following error:
>
> CGI Error
> The specified CGI application misbehaved by not returning a
> complete set of HTTP
> headers. The headers it did return are:
>
> Can't find string terminator "EndOfHTML" anywhere before EOF at
> D:\Source\Perl\Cgi\firstcgi2.cgi line 5.
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> What is the problem with this syntax? What should it be?
>
It means the "EndOfHTML" isn't the only thing on a complete line.
Either you have extra spaces after it (or before) or it is not followed
by a newline.
--
EBC
------------------------------
Date: Wed, 07 Nov 2001 17:46:56 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Error on HTML tag blocks
Message-Id: <slrn9uiigm.far.tadmc@tadmc26.august.net>
Fred Zimmerman <fredz@silversoftware.com> wrote:
>I wrote the following code taken directly from
>a CGI tutorial on the net:
^^^^^^^^^^^^^^^^^^^^^^^
Be careful out there. There are lots more bad examples than
good examples. Where, exactly, did you get it from?
>
>#!/usr/bin/perl
use warnings;
use strict;
>print "Content-type:text/html\n\n";
^^
^^ where's the space?
>print <<EndOfHTML;
><html><head><title>Test Page</title></head>
><body>
><h2>Hello, world!</h2>
></body></html>
>EndOfHTML
>
>
>It generated the following error:
[snip]
>Can't find string terminator "EndOfHTML" anywhere before EOF at
>D:\Source\Perl\Cgi\firstcgi2.cgi line 5.
>
>+++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>What is the problem with this syntax?
Nothing (as far as the visible characters are concerned).
>What should it be?
use PSI::ESP;
print qq(did you use "ASCII" or "text" mode when you FTP'd),
"your program from your non-Unix OS to a Unix OS?\n";
If you have CR-LF line endings on a system where perl wants
LF line endings, you can have the symptoms your program displays.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 7 Nov 2001 08:27:07 -0800
From: martinblack26@yahoo.com (martinblack)
Subject: Re: Everything but the if...
Message-Id: <c025943b.0111070827.722e7cc@posting.google.com>
"Rob" <robsjobs@hotmail.com> wrote in message news:<0XYF7.904$Yb.275923@typhoon.tampabay.rr.com>...
> OK, my impression... When ($query eq 'set') you create your SQL statement,
> prepare the DBI handle and Execute it... But, what happens when you have no
> records returned? The while statement doesn't run and you later do the
> finish and disconnect.
>
> So, presuming that you have a title that matches $query, maybe you should
> alter the statement:
> >FROM product where title like \"$query\"";
>
> to use single quotes instead of doubles and "=" instead of "like"?
> >FROM product where title = \'$query\'";
>
I tried that, it still doesn't help.
> Your other query string uses the wildcard "%" at the beginning and end of
> the "\"%$query%\"" but you don't have the wild card at all in the first. Do
> you actually have a title called "set" within the rows in the table?
>
> -Rob
Yes, there is a number of products that are "set"(s). I can return the
items that contain 'set' when I remove the "if else" statements and
leave the:
$sql="SELECT company_id, product_id, title,
description, spex, price, sex, category_id
FROM product where title like \"%$query%\"";
$sth = $dbh->prepare($sql); etc...
The only problem is that it returns "sets", "preset" and anything else
with "set" in it. Thus, the need for the if-else statements.
------------------------------
Date: Wed, 07 Nov 2001 18:10:32 GMT
From: "Rob" <robsjobs@hotmail.com>
Subject: Re: Everything but the if...
Message-Id: <sOeG7.7266$Yb.1840669@typhoon.tampabay.rr.com>
"martinblack" <martinblack26@yahoo.com> wrote in message
news:c025943b.0111070827.722e7cc@posting.google.com...
> > Your other query string uses the wildcard "%" at the beginning and end
of
> > the "\"%$query%\"" but you don't have the wild card at all in the first.
Do
> > you actually have a title called "set" within the rows in the table?
>
> Yes, there is a number of products that are "set"(s). I can return the
> items that contain 'set' when I remove the "if else" statements and
> leave the:
>
> $sql="SELECT company_id, product_id, title,
> description, spex, price, sex, category_id
> FROM product where title like \"%$query%\"";
>
> $sth = $dbh->prepare($sql); etc...
>
> The only problem is that it returns "sets", "preset" and anything else
> with "set" in it. Thus, the need for the if-else statements.
The first query will only return a recordset containing rows where the title
= "set" literally. If it contains "sets" it won't match. If you want
everything where the title starts with the letters "set" and ends in
anything else you can use "set%" and the % wildcard will match anything
after the beginning letters "set".
The first query is inflexible in that you have to specify the exact entire
text within the title field in the table for any given row. Thus if you
have three records such as:
COMP_ID PROD_ID TITLE
----------- ----------- ---------------------------
0001551 12345 swing set
0000345 21123 socket set
0000100 32184 set of four t-shirts
You can select all three using the '%set%' but selecting 'set' will not
select any. In order to return the first two, you would want '%set' and for
the last record above you would want 'set%' in order to get only the second
you have to narrow the search by adding something to the query. You can use
'soc%set' or you could use both '%set' and add another item to the where
clause such as:
> FROM product where title like \'%set\' and title like \'%socket%\'
Or, if you know the exact string, you could select the third as such:
> FROM product where title = \'set of four t-shirts\'
Please clarify what you're trying to obtain if I am way off base.
Rob
------------------------------
Date: 7 Nov 2001 09:41:34 -0800
From: clayk@acu.edu (Keith Clay)
Subject: Re: getting just the variable names from inputs in a form
Message-Id: <8947fc5.0111070941.63ea7ca1@posting.google.com>
I want to do this before the page is published so the CGI route won't
work until it is published.
keith
"Greg Muth" <gamu829@yahoo.com> wrote in message news:<tuh200cqldhqdf@corp.supernews.com>...
> If you have CGI.pm, this should do it:
>
> use CGI;
> my $cgi = new CGI;
> my @fields = $cgi->param();
>
>
> "Keith Clay" <clayk@acu.edu> wrote in message
> news:8947fc5.0111061536.70988ec@posting.google.com...
> > Folks,
> >
> > I am trying to get the variable names on a form in an HTML document.
> > I want to be able to validate that the variable names are valid before
> > it is published so I am reading the file directly off disk.
> >
> > keith
------------------------------
Date: Wed, 07 Nov 2001 18:10:37 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: getting just the variable names from inputs in a form
Message-Id: <slrn9uire5.fmp.tadmc@tadmc26.august.net>
[ Jeopardectomy performed ]
Keith Clay <clayk@acu.edu> wrote:
>"Greg Muth" <gamu829@yahoo.com> wrote in message news:<tuh200cqldhqdf@corp.supernews.com>...
[snip interior Jeopardist quoted text]
>> "Keith Clay" <clayk@acu.edu> wrote in message
>> news:8947fc5.0111061536.70988ec@posting.google.com...
>> >
>> > I am trying to get the variable names on a form in an HTML document.
>> > I want to be able to validate that the variable names are valid before
>> > it is published so I am reading the file directly off disk.
>I want to do this before the page is published so the CGI route won't
>work until it is published.
Use a module that understands HTML if you want to process HTML.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 07 Nov 2001 08:38:20 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Help: simple perl question on Windows
Message-Id: <3BE9637C.CDA9FF4@vpservices.com>
Eric Bohlman wrote:
>
> Jeff Zucker <jeff@vpservices.com> wrote:
> > To the OP: redirection like "perl MyScript.pl < employees.txt" works for
> > me on win98. You might check to see if there are other problems in your
>
> And that will also work on NT. But if you set an automagic file
> association so that you can run a script by typing its name as if it were
> a command (not available in 98/ME), then redirection won't work (just as
> it won't if you're executing a batch file in 98/ME). So in this case, I
> think it's fair to call the shell lame.
I already stipulated its lameness :-). But let's not jump from it being
lame to it being incapable of doing anything.
--
Jeff
------------------------------
Date: Wed, 07 Nov 2001 08:50:46 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Help: simple perl question on Windows
Message-Id: <3BE96666.D3354848@vpservices.com>
Garry Williams wrote:
>
> On Tue, 06 Nov 2001 21:04:02 -0800, Jeff Zucker <jeff@vpservices.com>
> wrote:
>
> I *didn't* say Windows was lame. That's for someone else to decide.
> I said the Windows *shell* was lame.
Yeah, my bad, I should have specified the Windows shell since that is
what we are discussing.
> Maybe you don't consider Cygwin "much help".
I didn't say that.
> > and/or look at the Windows section of the ActivePerl docs and
> > some of the past postings on clpm re file globbing and redirection
> > issues on windoze.
>
> Yes and that will reveal the widely-known lameness of the Windows
> shell.
That's exactly the attitude I object to -- Windows shell is lame so
don't bother finding out how to use it.
--
Jeff
------------------------------
Date: Wed, 07 Nov 2001 12:20:46 -0500
From: John Edl <johnedl@us.ibm.com>
Subject: IO::SOCKET:INET
Message-Id: <3BE96D6E.B18717BB@us.ibm.com>
I am trying to test if the dhcp daemon is running on a Unix server. It
listens on port 67 using UDP only. I am
using the following to test:
use IO::Socket;
$sock=IO::Socket::INET->new(
PeerAddr=>$host,
PeerPort=>67,
Proto=>'udp',
Timeout=>$timeout || 3
);
hostname is being passed to the subroutine. This always returns a value
in $sock even though the
dhcp daemon is not running on the host.
Any ideas?
John Edl
IBM Global Services
johnedl@us.ibm.com
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
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 V10 Issue 2083
***************************************