[12025] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5625 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 11 09:08:24 1999

Date: Tue, 11 May 99 06:00:17 -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           Tue, 11 May 1999     Volume: 8 Number: 5625

Today's topics:
    Re: Any good CGI script for searching files in personal <gellyfish@gellyfish.com>
    Re: email attachment <gellyfish@gellyfish.com>
    Re: FAQ 9.10: How do I redirect to another page? <sstarre@my-dejanews.com>
        how to test if a directory exist? <yzixin@hotmail.com>
    Re: how to test if a directory exist? <cschmitz@stud.informatik.uni-trier.de>
    Re: Need a little looping help todd_b_smith@my-dejanews.com
    Re: Need a little looping help todd_b_smith@my-dejanews.com
    Re: Need a little looping help <jdf@pobox.com>
    Re: need a perl/cgi tutorial please tertullian@my-dejanews.com
        neverendless loop in regexp <hvermeulen@nospam-correctnl.com>
    Re: neverendless loop in regexp (Tad McClellan)
    Re: Offline Mode CTRL-D Problem (Andrea L. Spinelli)
    Re: Offline Mode CTRL-D Problem <johan.schon@capgemini.se>
    Re: Oraperl question (newbie) <rereidy@uswest.net>
    Re: parse variables to a sub (Andrea L. Spinelli)
        Prlblems with Backtick Commands <Frank.Ilchmann@alcatel.de>
    Re: running a file from unix shell <rereidy@uswest.net>
    Re: SQL Escape routine <pm@univie.ac.at>
    Re: SQL Escape routine <eyounes@aol.com>
    Re: Warnings about uninintialised variables despite use tertullian@my-dejanews.com
    Re: Warnings about uninintialised variables despite use tertullian@my-dejanews.com
    Re: why won't this cgi script work? <sstarre@my-dejanews.com>
        Win32 system problem and quotes alexmc@my-dejanews.com
    Re: Win32 system problem and quotes <c4jgurney@my-dejanews.com>
    Re: Win32 system problem and quotes (Matti Johannes Kdrki)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 11 May 1999 10:54:00 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Any good CGI script for searching files in personal web site ?
Message-Id: <3737fe38@newsread3.dircon.co.uk>

Austin Ming <austin95002887@yahoo.com> wrote:
> 
> Any good CGI script for searching files in personal web site ?
> 

Probably. But what has that got to with Perl ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: 11 May 1999 10:52:29 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: email attachment
Message-Id: <3737fddd@newsread3.dircon.co.uk>

David Craig <david@icon.screaming.net> wrote:
> 
>>
>>Er.  If you are using a recent ActiveState Perl then you will be able to
>>use PPM to install it which is by far the best thing to do ...
>>
> 
> 
> Hmm, I'm not sure what ActiveState Perl is.  

I'd give up right now then ...

>                                             Sorry, I am learning Perl at
> the moment!  I installed Perl version 5.003 (Win32).  

Before you do anything else please download and install the latest
ActiveState Perl from <http://www.activestate.com/ActivePerl> and read 
*all* of the documentation that is installed under the ActivePerl group
in your start menu.

>                                                      I am trying to write a
> program to run on a UNIX webserver.  presumably if I can get the module, I
> can simply put it in my scripts directory on the webserver?  I've had a look
> at Lite.pm, and it is full of documentation - is the installation supposed
> to strip out the documentation?
> 

I assume you have unpacked the Module into some directory.  Read the
instructions in the README file in order to install the module.  

The documentation stays with the module because that is the way that it
works - there can be no excuse for not having it then ;-P

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Tue, 11 May 1999 11:43:23 GMT
From: S Starre <sstarre@my-dejanews.com>
Subject: Re: FAQ 9.10: How do I redirect to another page?
Message-Id: <7h954r$r6t$1@nnrp1.deja.com>



This was a very helpful post, Thank-You for taking the time to put it
up.

In a recent post (or one of the FAQ's I can't recall which) you
recomended strongly to use CGI.pm over other means of capturing POST
data such as processing the CONTENT_LENGTH and all of that. As I already
have dozens of CGI scripts that process POST data using CONTENT_LENGTH,
and I wonder about the value in going back and rewriting them. They seem
to be working fine, but are they timebombs? Should I mend my ways and
using CGI.pm from here on out, or make restitution for my sins?

-S

PS: When I started writing CGI I don't think CGI.pm existed, so under
the law I must be partially vindicated!

***********************************************************************

In article <373794fd@cs.colorado.edu>,
  perlfaq-suggestions@perl.com (Tom and Gnat) wrote:
> (This excerpt from perlfaq9 - Networking
>     ($Revision: 1.25 $, $Date: 1999/04/14 03:46:19 $)
> part of the standard set of documentation included with every
> valid Perl distribution, like the one on your system.
> See also http://language.perl.com/newdocs/pod/perlfaq9.html
> if your negligent system adminstrator has been remiss in his duties.)
>
>   How do I redirect to another page?
>
>     Instead of sending back a `Content-Type' as the headers of your
>     reply, send back a `Location:' header. Officially this should be a
>     `URI:' header, so the CGI.pm module (available from CPAN) sends
>     back both:
>
>         Location: http://www.domain.com/newpage
>         URI: http://www.domain.com/newpage
>
>     Note that relative URLs in these headers can cause strange effects
>     because of "optimizations" that servers do.
>
>         $url = "http://www.perl.com/CPAN/";
>         print "Location: $url\n\n";
>         exit;
>
>     To be correct to the spec, each of those `"\n"' should really each
>     be `"\015\012"', but unless you're stuck on MacOS, you probably
>     won't notice.
>
> --
> +C is not a big language, and it's not well served by a big book.;
(Brian W.
> Kernighan and Dennis M. Ritchie, in +The C programming Language;,
Prentice
> Hall 1988)
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 04 May 1999 15:10:23 -0400
From: Zixin Yin <yzixin@hotmail.com>
Subject: how to test if a directory exist?
Message-Id: <372F461D.93C2C161@hotmail.com>

thx.



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

Date: 11 May 1999 11:26:15 GMT
From: Christoph Schmitz <cschmitz@stud.informatik.uni-trier.de>
Subject: Re: how to test if a directory exist?
Message-Id: <7h944n$112$1@fu-berlin.de>

if ( -d /etc ) {
	do_something();
}

Christoph 

-- 
-- Christoph Schmitz <cschmitz(at)stud.informatik.uni-trier.de> --
The very ink with which all history is written is merely fluid prejudice.
                -- Mark Twain


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

Date: Tue, 11 May 1999 12:12:27 GMT
From: todd_b_smith@my-dejanews.com
Subject: Re: Need a little looping help
Message-Id: <7h96r9$sfg$1@nnrp1.deja.com>

In article <m3pv496mq7.fsf@joshua.panix.com>,
  Jonathan Feinberg <jdf@pobox.com> wrote:
> todd_b_smith@my-dejanews.com writes:
>
> > I need to be able to 'eval' the top of a loop, write normal code in
the
> > middle, and 'eval' the end. Example (doesn't work):
>
> I don't see why.  What are you actually trying to do?

I don't want to write 20 nested for's.

>
> > I'm copying from sight, so please forgive typos:
>
> That's silly.  Does your OS not support copy & paste?

I have two boxes w/o a working network. Windows (on the net) and Linux.

>
> --
> Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
> http://pobox.com/~jdf
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 11 May 1999 12:20:16 GMT
From: todd_b_smith@my-dejanews.com
Subject: Re: Need a little looping help
Message-Id: <7h979u$sre$1@nnrp1.deja.com>

In article <X4IZ2.318$%j4.1099@news.rdc1.sfba.home.com>,
  "Stephen Warren" <swarren@www.wwwdotorg.org> wrote:
> Dave Evans <devans@radius-retail.kom> wrote in message
> news:7h72sf$2s9m2@news.gomontana.com...
> > Jeez, if you can't be bothered to respond to a particular query,
then
> don't!
> > At least rebuff nicely.
>
> But why - the original poster basically said:


>
> paraphrased:
> >>>I need help.
> >>>Here's some partially-random code that probably isn't quite what I
need
> help with.

no, I basically said, "I'm having to copy this code directly from my
program but from sight (I would copy and paste if I could), so please
forgive obvious errors." I didn't think it was difficult to understand.


>
> It was sufficiently complicated code that it required a little though
as to
> what the actual intention was, hence making spotting even simple
errors that
> much harder. A better request would have included a description of the
> requirements too so people could think up good ways of doing it,
rather than
> having to reverse-engineer them...

I could think of a better way, but in doing that I would never know how
to make it work the first way, and so I would be losing some new Perl
info that I may need to use later, when there is no better way.

>
> --
> Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
> mailto:swarren@techhouse.com                http://www.techhouse.com/
> mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
>               MIME, S/MIME and HTML mail are acceptable
>
>

______________
Todd Smith
Perl Programmer
ITC^DeltaCom



--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 11 May 1999 08:54:34 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: todd_b_smith@my-dejanews.com
Subject: Re: Need a little looping help
Message-Id: <m3pv474vhx.fsf@joshua.panix.com>

todd_b_smith@my-dejanews.com writes:

> no, I basically said, "I'm having to copy this code directly from my
> program but from sight (I would copy and paste if I could), so please
> forgive obvious errors." I didn't think it was difficult to understand.

How on earth do we know what is an "obvious" error to you?

At any rate, we're all still waiting to see a description of the
*problem* you're trying to solve, so we can suggest a WTDI or two.  It
may in fact be that constructing and eval()ing code is the best way to
go.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Tue, 11 May 1999 12:22:24 GMT
From: tertullian@my-dejanews.com
Subject: Re: need a perl/cgi tutorial please
Message-Id: <7h97dt$ssf$1@nnrp1.deja.com>



> http://www.free-ed.net/fr03/lfc/course%20030207_01/index.html
>

Looks like this has been moved or removed

This isn't quite a tutorial but it does have some good stuff ...

http://www.cpan.org/doc/FAQs/cgi/perl-cgi-faq.html

Dan


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 11 May 1999 12:35:30 +0200
From: Henry <hvermeulen@nospam-correctnl.com>
Subject: neverendless loop in regexp
Message-Id: <373807F1.2447D263@nospam-correctnl.com>

Hi to you all.
I've got a bit of a problem with the following piece of code.
It starts a loop while it should read about 500 lines from $ov.
It does, only it starts over and over.
I've spit out pod/perlre but can't get it working the right way.

Thanx for all willing to get me a solution.
Henry


undef $/;
open OV, $ov or die "Cannot open $OV for read :$!";
while (<OV>)  {
    while ( /<!--start-->(.*?)<!--sov-->/sm )   {
                      open OUT1, ">$out1" or die "Cannot open $out1 for
write. :$!\n";
                      while ($1 ne "<!--stop-->")  {
                          print "$1\n";    }
        close OUT1;

                                             }
             }



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

Date: Tue, 11 May 1999 03:27:35 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: neverendless loop in regexp
Message-Id: <75m8h7.pje.ln@magna.metronet.com>

Henry (hvermeulen@nospam-correctnl.com) wrote:

: I've got a bit of a problem with the following piece of code.
: It starts a loop while it should read about 500 lines from $ov.
: It does, only it starts over and over.

: Thanx for all willing to get me a solution.


: undef $/;
: open OV, $ov or die "Cannot open $OV for read :$!";
: while (<OV>)  {
:     while ( /<!--start-->(.*?)<!--sov-->/sm )   {


   The m//m option only effects the interpretation of anchors.

   Your regex has no anchors.

   m//m is not needed.


   You never change the loop condition, so of course it can never
   become false, so the loop can never exit.

   I think maybe you want m//sg there instead?



:                       open OUT1, ">$out1" or die "Cannot open $out1 for
: write. :$!\n";


   Why do you open a filehandle and then never use it?


:                       while ($1 ne "<!--stop-->")  {

   You never change the loop condition, so of course it can never
   become false, so the loop can never exit.

   Maybe you want if() instead of while() ?


:                           print "$1\n";    }
:         close OUT1;

:                                              }
:              }


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 11 May 1999 11:25:23 GMT
From: aspinelli@ismes.it (Andrea L. Spinelli)
Subject: Re: Offline Mode CTRL-D Problem
Message-Id: <3738133a.353063395@news.inet.it>

On Tue, 11 May 1999 04:07:21 GMT, trw_sqrd@my-dejanews.com wrote:

>I'm using perl 5.00402 on a windows '98 OS.  The
>problem is when I go into offline mode to try to
>test my perl scripts, CTRL-D does not work to get
>out of the entering of the name-value pairs.

Windoze uses CTRL-Z for end-of-file.  On some
versions of ActivePerl you have to hit Enter
after that, by the way.

HTH
--
Andrea Spinelli, Ismes SpA, Via Pastrengo 9, 24068 Seriate BG, Italy
e-mail: aspinelli@ismes.it Phone: +39-035-307209  Fax: +39-035-302999


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

Date: Tue, 11 May 1999 13:25:35 +0200
From: "johan schoen" <johan.schon@capgemini.se>
Subject: Re: Offline Mode CTRL-D Problem
Message-Id: <7h93u6$1pd$1@news.capgemini.se>

try CTRL-Z!
# schoen

trw_sqrd@my-dejanews.com wrote in message <7h8adi$779$1@nnrp1.deja.com>...
>I'm using perl 5.00402 on a windows '98 OS.  The
>problem is when I go into offline mode to try to
>test my perl scripts, CTRL-D does not work to get
[ rest of message deleted ]




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

Date: Tue, 11 May 1999 05:50:06 -0600
From: Ron Reidy <rereidy@uswest.net>
Subject: Re: Oraperl question (newbie)
Message-Id: <3738196E.C65D0132@uswest.net>

This is a multi-part message in MIME format.
--------------50BCFCAD4D9B32FBBBDD2203
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

There is no array insert method in DBI.  You will need to set up a loop to do
this.  Or alternately, you could leave your current script stand, but have
your output go to a named pipe and run that into a SQL*Loader process to
insert the data.  For large (REALLY LARGE) sets of data, this would be much
faster than inserting in your code.

Maybe you could write one that handles both array refs and hash refs?

rr

Jared Hecker wrote:

> Hi, all -
>
> I am an Oracle DBA with light perl experience, getting to know Oraperl.
>
> I have a perl script that writes a multi-column array to a flat file.  I
> would like to amend it to write to an Oracle table.
>
> I have the latest Oracle DBD installed, along with the latest perl
> release.  I have been reviewing the 'commit.pl' example script included
> with the DBD distribution and wondered how one inserts multiple records
> into a table out of an array.   Does one set up a small loop and do it one
> record at a time? That would be inefficient, and doesn't seem a perl-ish
> approach to me.
>
> If it is convenient, e-mail will reach me faster.
>
> TIA -
>
> Regards,
> jh
> --
> Jared Hecker    | HWA Inc. - Oracle architecture and Administration
> jared@hwai.com  |  ** serving NYC and New Jersey **

--------------50BCFCAD4D9B32FBBBDD2203
Content-Type: text/x-vcard; charset=us-ascii;
 name="rereidy.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ron Reidy
Content-Disposition: attachment;
 filename="rereidy.vcf"

begin:vcard 
n:Reidy;Ron
x-mozilla-html:FALSE
org:Reidy Consulting, L.L.C.
version:2.1
email;internet:rereidy@uswest.net
title:Owner
x-mozilla-cpt:;0
fn:Ron Reidy
end:vcard

--------------50BCFCAD4D9B32FBBBDD2203--



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

Date: Tue, 11 May 1999 11:47:49 GMT
From: aspinelli@ismes.it (Andrea L. Spinelli)
Subject: Re: parse variables to a sub
Message-Id: <37381419.353286810@news.inet.it>

On Tue, 11 May 1999 04:59:01 GMT, design@raincloud-studios.com
(Charles R. Thompson) wrote:
>In article <37376e11@nemo.idirect.com>, james gough says...
>> if I have a script like this,
>> #!/usr/local/bin/perl -w
>> use CGI;
>> $q=new CGI;
>> &MySub($q);
>> #bla,bla...
>> sub MySub {
>>     my ($this, $that) = @_;    # what do I get in $this and $that?
>> #bla,bla...
>> }

In $this you will have a copy of $q; therefore
you will access values of CGI input fields
using the 'param' method of CGI.
For instance,

  my $foo = $this->param( 'foo_field' );

Vice versa, in $that you will find nothing (=undef).
You can try my assertion with

  if( not defined $that ){
    system( "touch /tmp/that_is_not_defined" );
  }
and 'ls -l /tmp'

This happens because $q is just a reference to an object
of type CGI, which may be passed as argument.

>>     my ($this, $that) = @_;    # what do I get in $this and $that?
>a world of mess.
Why? It's a perfectly legal question.

>If you are trying to access your passed data from a form 
>(which I think is what you were thinking would happen) then use param 
>from the CGI module like below.

I think it is a bit too easy to say to a young soul

  "pooh-pooh, your question is unessential, see what I
   able to do"

you have to answer the poster's question!

># ADD THIS - will keep you in line. :)
># when you get errors, look in your log files!
>use strict;
>
>$q=new CGI;
 ^^^^^^^^^^^---- use strict did not keep _you_ in line!

Did you test what you posted? I did, and got

  Global symbol "$q" requires explicit package name at aj.pl line 9.
  Execution of aj.pl aborted due to compilation errors.

Do you realise you
are further confusing an already confused mind?

># if you don't use this, your results will not
># show in the browser
>print $q->header;
>
># param is the same as $q->param
># you will probably see it more
># like below in documentation
what documentation?  Moreover, I do not think it
is a good thing to mix OO and functional notation in the
same file.

>Refer to FAQ 9 for more info on CGI with Perl for more info...
>
>http://language.perl.com/newdocs/pod/perlfaq9.html

I agree. However, the poster has already the concept
that he must use CGI.pm, and has probably already
had a look at its documentation.

Sorry, Charles, nothing personal...

HTH
   Andrea
--
Andrea Spinelli, Ismes SpA, Via Pastrengo 9, 24068 Seriate BG, Italy
e-mail: aspinelli@ismes.it Phone: +39-035-307209  Fax: +39-035-302999


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

Date: Tue, 11 May 1999 11:38:11 +0200
From: Frank Ilchmann <Frank.Ilchmann@alcatel.de>
Subject: Prlblems with Backtick Commands
Message-Id: <3737FA83.56E6D9C9@alcatel.de>

Hello,

I'm working on HP-UX 10.20 (Perl version 5.004_01) and Compaq/Digital Unix 4.0D 
(Perl version 5.004_04 built for alpha-dec_osf).
I wrote some perl scripts which must be able to run under both platforms.
Somtimes I need the MAC address of one of the LAN cards. On HP
I use the command "/usr/sbin/lanscan" and on Compaq "netstat -I tu0",
performed as backtick commands.
The script works on both platforms without problems, see below. 
Now I have added a signal handler routine for SIGCHLD. After
this modification the behaviour of the script is different on both
platforms. On HP-UX the script works correct, but on Compaq the backtick
commands works somtimes correct and sometimes not, i.e. the
contens of @cmdOut is sometimes empty. 
Then I have 'simplified the script' performing only the backtick command
in a loop - with the same result. If the signal handler routine is not
installed the script works correct on both platforms; if the routine
is installed the script works sometimes incorrect on Compaq.

Has someone an idea about the reason for this behaviour?
How can I solve this problem?

Best regards,

Frank
 ............................

   my (@cmdOut) = ();
   my ($platform, $macAddr);
   
   $platform = `uname`;
  
   $SIG{CHLD} = \&signalHandler;
   
   if ($platform eq "OSF1") {
      @cmdOut = `netstat -I tu0 2>&1`;
      if (scalar(@cmdOutArr) != 0 ) {
	 $macAddr =~ ... # grep MAC from Output
      }
      else {
         die "No return of command <netstat -I tu0>"
      }
   }
   elsif ($platform eq "HP-UX") {
      @cmdOut = `/usr/sbin/lanscan 2>&1`;
      if (scalar(@cmdOutArr) != 0 ) {
         $macAddr =~ ... # grep MAC from Output 
      }
      else {
         die "No return of command </usr/sbin/lanscan>"
      }
   }
   else {
      # error
      die "Platform not supported";
   }

   print STDOUT "MAC Address found is $macAddr";

 ...
   
sub signalHandler
{
   local ($signalName) = @_;

   print STDOUT "\n\nINFO ===> Caught a Signal: SIG$signalName --\n";

   return;
}
-- 
Frank Ilchmann
mailto:Frank.Ilchmann@alcatel.de


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

Date: Tue, 11 May 1999 05:53:49 -0600
From: Ron Reidy <rereidy@uswest.net>
Subject: Re: running a file from unix shell
Message-Id: <37381A4D.12E28250@uswest.net>

This is a multi-part message in MIME format.
--------------B8046C895FC5806A1EA975EB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



mikej wrote:

> Hi,
>
> Im trying to run a file called "Configure" from a unix shell. The file
> has full execute permissions and when I am in the same direcory as the
> file I type:
>
> ../Configure

This will run Configure from the parent directory.  Is this what you want
or do you mean "./Configure"?


>
>
> from the command line. Then it tells me ./Configure: not found
>
> it will say the same thing if I just type:
>
> Configure
>
> About a few months ago we had to reinstall our unix system. Before the
> reinstall i could run anything i wanted from the command line (perl
> scripts and things), but now it keeps saying "not found". Am I missing
> something here?
>
> -mike
>
>

--------------B8046C895FC5806A1EA975EB
Content-Type: text/x-vcard; charset=us-ascii;
 name="rereidy.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ron Reidy
Content-Disposition: attachment;
 filename="rereidy.vcf"

begin:vcard 
n:Reidy;Ron
x-mozilla-html:FALSE
org:Reidy Consulting, L.L.C.
version:2.1
email;internet:rereidy@uswest.net
title:Owner
x-mozilla-cpt:;0
fn:Ron Reidy
end:vcard

--------------B8046C895FC5806A1EA975EB--



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

Date: 11 May 1999 10:12:09 GMT
From: Peter Marksteiner <pm@univie.ac.at>
Subject: Re: SQL Escape routine
Message-Id: <7h8vpp$1h5c$2@www.univie.ac.at>

Darren <darrensw@ix.netcom.com> wrote:
: I am trying to find a quick subroutine which will escape characters such as
: " and ' so that a user cannot try to put them into a text field ... or, even
: better, to have the sub replace them with an escape character 

The DBI module has the quote method for this purpose:

    $sql = $dbh->quote($value);
    $sql = $dbh->quote($value, $data_type);

-- 
Peter Marksteiner
Vienna University Computer Center


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

Date: Tue, 11 May 1999 13:59:44 +0200
From: "Ysteric's" <eyounes@aol.com>
Subject: Re: SQL Escape routine
Message-Id: <7h95me$9g2@news.vtcom.fr>


Darren a icrit dans le message <7h80eg$24h@dfw-ixnews10.ix.netcom.com>...
>Hi
>
>I am trying to find a quick subroutine which will escape characters such as
>" and ' so that a user cannot try to put them into a text field ... or,
even
>better, to have the sub replace them with an escape character to allow them
>in so that my text field can accept, for example:
>


Why ??? DBI makes it for you !

eg:
$sql = qq{select * from MIAMMIAM where beef = ?};
$var = "Mouton";

$sth = $dbh->prepare($sql);
$sth->execute($var);

$var is cast to the type of 'beef', it is automatic ...

Eric - France





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

Date: Tue, 11 May 1999 10:13:10 GMT
From: tertullian@my-dejanews.com
Subject: Re: Warnings about uninintialised variables despite use strict
Message-Id: <7h8vrk$nha$1@nnrp1.deja.com>

In article <fiIZ2.321$%j4.1082@news.rdc1.sfba.home.com>,
  "Stephen Warren" <swarren@www.wwwdotorg.org> wrote:
>
> Declare, possibly, but not *initialize*:
>

Aha - many thanks!

Dan


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 11 May 1999 10:24:49 GMT
From: tertullian@my-dejanews.com
Subject: Re: Warnings about uninintialised variables despite use strict
Message-Id: <7h90hg$ntd$1@nnrp1.deja.com>

In article <m3n1zd6lr6.fsf@joshua.panix.com>,
  Jonathan Feinberg <jdf@pobox.com> wrote:
> tertullian@my-dejanews.com writes:
>
> > #!/usr/bin/perl  -dw
>
> That's a peculiar combination of switches to see in a shebang line!
> You really want to use the perl debugger every time you run the
> program?

While developing yes, or nearly all the time!

> Nope.  Have you read the documentation for strict?

My, if I had 10p for everytime someone asked me that ... I'd have 70p!

But I do find that each time I read the documentation a little more of
it makes sense and/or gets through.

>
> You ought to be using CGI.pm, anyway.
>

Now, I seem to be getting this from all angles so I'll look into it -
thanks. Any good references and what are the advantages of using CGI.pm
rather than the CGI::* Modules?

Thanks for the info

Dan



--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 11 May 1999 11:35:24 GMT
From: S Starre <sstarre@my-dejanews.com>
Subject: Re: why won't this cgi script work?
Message-Id: <7h94ls$qsr$1@nnrp1.deja.com>

In article <37375256.148077@news.skynet.be>,
  bart.lateur@skynet.be (Bart Lateur) wrote:
> Drew Simonis wrote:
>
> >And, while I'm here, why are you reading a file into a scalar?
>
> Surely, the file contains just a number...
>
> 	Bart.
>

What other means of reading the file did you have in mind?
-S


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 11 May 1999 10:30:24 GMT
From: alexmc@my-dejanews.com
Subject: Win32 system problem and quotes
Message-Id: <7h90s0$o82$1@nnrp1.deja.com>

I have a problem which may be a bug in the ActiveState Win32 perl
build 515. (I am running NT4, sp3)

essentially if I put quotes around the program, and put quotes
around one of the parameters (eg to cope with spaces in file names)
I get a "command not found" style error.

I can demonstrate the problem with the following script:


$cmd = "ls \"c:\\program files\" ";
system $cmd;                         # Works
print "This completed ($cmd) \n";

$cmd = "\"ls\" c:\\win32app ";
system $cmd;                          # Works
print "This completed ($cmd) \n";

$cmd = "\"ls\" \"c:\\program files\" ";
system $cmd;                          # DOESN'T Work
print "This completed ($cmd) \n";

Any ideas?

note that the command as written _does_ seem to work
if I enter it normally in a command shell, so that
doesn't seem to be the problem...








--
Alex McLintock	http://www.arcfan.demon.co.uk/sf/books/    SF REVIEWS


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 11 May 1999 11:21:17 GMT
From: Jeremy Gurney <c4jgurney@my-dejanews.com>
Subject: Re: Win32 system problem and quotes
Message-Id: <7h93r9$qc6$1@nnrp1.deja.com>

In article <7h90s0$o82$1@nnrp1.deja.com>,
  alexmc@my-dejanews.com wrote:
> I have a problem which may be a bug in the ActiveState Win32 perl
> build 515. (I am running NT4, sp3)

> $cmd = "\"ls\" \"c:\\program files\" ";
> system $cmd;                          # DOESN'T Work
> print "This completed ($cmd) \n";

I tried
$cmd = 'dir "c:\program files"';
with no problems at all.

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: 11 May 1999 11:59:48 GMT
From: makarki.NOSPAM@news.hit.fi (Matti Johannes Kdrki)
Subject: Re: Win32 system problem and quotes
Message-Id: <7h963k$sah$1@news.hit.fi>

alexmc@my-dejanews.com wrote:


: $cmd = "\"ls\" \"c:\\program files\" ";
: system $cmd;                          # DOESN'T Work
: print "This completed ($cmd) \n";

This doesn't work because if you put quotes around the whole command
including parameters. The system function of the OS (NT or Win95) thinks
that the quoted text is only a name of the executable with some spaces in 
it. ie the system tries to start the executable named as: 

  "ls c:\program files"

I think that this isn't a bug. It is a 'feature' of the Microsoft product.
I have generated similar effects with .BAT files with Win95 and NT. It
seems that commands sent to the system via system function are handled
in different way that those sent via command line.

: note that the command as written _does_ seem to work
: if I enter it normally in a command shell, so that
: doesn't seem to be the problem...

It IS the problem. But somehow the command line resolvers the string
correctly (don't know why...).




--
Matti J. Kdrki


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

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

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