[7369] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 994 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 8 11:27:40 1997

Date: Mon, 8 Sep 97 07:07:05 -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           Mon, 8 Sep 1997     Volume: 8 Number: 994

Today's topics:
     Re: "Odd number of elements in hash list": So? <tom@mitra.phys.uit.no>
     Re: "reget" with Net::FTP? <gbarr@ti.com>
     [Q] Converting text to image <kristian.elstad@interpost.no>
     Re: CGI.pm - redirect problem? (Mick Farmer)
     Converting strings to numbers (John J Holden)
     Datetime datatype in sybperl <perkva@itk.ntnu.no>
     Doing a POST as a client (John Woodstock)
     Re: Doing a POST as a client <tom@mitra.phys.uit.no>
     Re: Free Perl Docs (was: Re: (no subject) ) <camerond@mail.uca.edu>
     Re: Getting rid of ] and [ in perl <tom@mitra.phys.uit.no>
     Re: Getting rid of ] and [ in perl <tom@mitra.phys.uit.no>
     How to access the comments you can save with a Word doc <doc32@usa.net>
     Re: HTML Table to Array <kenlo@hk.super.net>
     Re: I seem to be missing something obvious with package (M.J.T. Guy)
     Re: Looking for PERL pattern to match nested braces. (Mick Farmer)
     nested subroutines? (Jim Turner )
     Re: Newbie File Locking (M.J.T. Guy)
     Re: pattern matching HELP! (Mick Farmer)
     Perl and MIME <weav@plover.havant.ibm.com>
     Re: Perl on win32 book (Chris Nandor)
     Re: Perl on win32 book <merlyn@stonehenge.com>
     Re: perldoc (M.J.T. Guy)
     Recommendations for escaping apostrophes in DBI SQL sta <ghowland@hotlava.com>
     Re: Recommendations for escaping apostrophes in DBI SQL (Mike Heins)
     Re: Shakespearian insult program (Dave Cross)
     Strip spaces in filenames <mrao@trincoll.edu>
     Re: Strip spaces in filenames (Andreas Schwab)
     utility for managing NIS password, groups and aliases f <osullm@cork.cig.mot.com>
     Re: Where is the FAQ?  Not at "www.perl.com"! (Grey Cloak)
     where's gunzip and tar for dos/win? <schan_ca@hotmail.com>
     Writing setup script for module <adu@lmt.lv>
     Re: Wrote new module, need help with system dependencie (Bart Lateur)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 08 Sep 1997 14:55:19 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: "Odd number of elements in hash list": So?
Message-Id: <nqoyb58t16w.fsf@mitra.phys.uit.no>

aml@world.std.com (Andrew M. Langmead) writes:

> Kingpin <mthurn@irnet.rest.tasc.com> writes:
> 
> >  Unfortunately, it also gives this warning if you assign undef to a
> >hash.  What's wrong with that?  What's even potentially wrong with that?
> 
> >%hash = undef;
> 
> Because you are assigning a single scalar to a list structure. What

Correct.

> perl is really doing is essentially:
> 
> %hash = (undef => undef);
> 
> The second undef is added by perl, so that the key has a corresponding
> value.

Wrong.  Try it in the debugger and see.

> Andrew Langmead

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Mon, 08 Sep 1997 07:58:31 -0500
From: Graham Barr <gbarr@ti.com>
To: Brett Denner <Brett.W.Denner@lmtas.lmco.com>
Subject: Re: "reget" with Net::FTP?
Message-Id: <3413F677.D9E56394@ti.com>

Brett Denner wrote:
> 
> Is it possible to do a "reget" command with Net::FTP?
> 
> My IRIX ftp has a reget command that does the following (excerpted from
> the
> IRIX ftp man page):
> 
>  reget remote-file [ local-file ]
>     Reget acts like get, except that if local-file exists and is
>     smaller than remote-file, local-file is presumed to be a
>     partially transferred copy of remote-file and the transfer is
>     continued from the apparent point of failure.  This command is
>     useful when transferring very large files over networks that are
>     prone to dropping connections.
>
> Is it currently possible to do this with Net::FTP?  If not, is there any
> reason why this could not be added to Net::FTP in the near future?

It is possible to do with Net::FTP, but not as a single
method. This kind of functionality goes beyond what Net::FTP
was originally intended to do, but that does not mean it's scope cannot
be widened.

Currently Net::FTP methods map to single FTP protocol operations,
to do what you are asking would require more. The reget command
is a command supplied by yor ftp client, first it will
enquire the size of the remote file, then it will do the
necessary comparisons and finally a get if it needs to.

If people think that adding this kind of functionality to Net::FTP
would be useful, then I am open to suggestions.

Regards,
Graham.


-- 
The road to success is lined with many tempting parking spaces.


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

Date: Mon, 08 Sep 1997 11:44:50 +0200
From: Kristian Elstad <kristian.elstad@interpost.no>
Subject: [Q] Converting text to image
Message-Id: <3413C912.357407C9@interpost.no>

Hi!

I am looking for a program that takes a text line or possibly several
text lines and produses an image that
displays this/these text lines. 

The text I want convertet to a image is a typical html table. And I
would like that either the whole table or 
each line (<tr>) in the table be convertet to an image. It is important
that the structure/layout of the table
will be keept in the image. (In other words; the text in the cols be
plased underneath eachother). 

The text will typically look like this:

<table>
<tr><td>Kristian Elstad <td>0587 Oslo  <td>12 34 56 78
<tr><td>Per Olsen       <td>0123 Oslo  <td>09 87 65 43
 .
 .
<tr><td>Tim Hammer      <td>9000 Troms <td>23 34 56 78
</table>

Is there anyone that knows of any program/module that can do something
like this. Possible written in 
Perl or C.

ThanX.

- Kristian.
-- 
---------------------------------------------------------------
 Kristian Elstad              Tlf (work):    23 14 53 99 / 91 37 44 73
 (System engineering)         Tlf (private): -- -- -- --
                              Email: kristian.elstad@interpost.no  
           
 //////////      //////////
 //      //      //      //   Statens Datasentral a.s   
 //  //////////////  //////   avd. Interpost
 //      //      //      //   
 //////  //  //  //////  //  "Real programmers don't comment
 //      //  /// //      //   their code. If it was hard to
 //////////  //  //////////   write, it should be hard to read"
         //     ///            
         //////////            
---------------------------------------------------------------


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

Date: Mon, 8 Sep 1997 10:55:07 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: CGI.pm - redirect problem?
Message-Id: <EG6rnv.EK0@mail2.ccs.bbk.ac.uk>

Dear Martin,

Remember that the double quotes merely delimit the
string.  If you have double quotes in your file, then
they'll end up being part of the string, which will cause
you a problem.

Regards,

Mick


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

Date: 8 Sep 1997 09:37:27 GMT
From: swrholdj@met.rdg.ac.uk (John J Holden)
Subject: Converting strings to numbers
Message-Id: <5v0h0n$fs1$1@susscsc1.reading.ac.uk>


I'm using a form on a web page to read some numbers into a perl
program. These numbers then need to be written to a file for a Fortran
program to subsequently read. It is vital that these numbers are valid
and do not contain non-numeric characters.

Is it possilbe to convert the string into a numeric variable in perl?

If not, how else can I ensure a variable is a valid number?

Thanks

John 


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

Date: Mon, 8 Sep 1997 13:21:05 +0200
From: Per Fredrik Kvarme <perkva@itk.ntnu.no>
Subject: Datetime datatype in sybperl
Message-Id: <Pine.SUN.3.95.970908131419.21882B-100000@odin>


Hello

	I`m just completing a www database interface using sybperl::DBlib,
and could use some help. I have a few smalldate attributes I want to
update and outpui. So, what I need to know is what datatype this field
becomes when I return it from a query, and how I need to decode and format
on the way to and from the database. Any help would be very welcoom!

Please reply by mail

Regards,

 - Per Fredrik Kvarme



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

Date: Mon, 08 Sep 1997 10:05:31 GMT
From: nospam@nospam.com (John Woodstock)
Subject: Doing a POST as a client
Message-Id: <3413cd71.524995@itf.arrow.com>



I need to do some database extracting. The CGI expects a "POST"..

Anyone have a code snippet that will do one ?

Thanks in advance..
John Woodstock
Internet Task Force
     *************************************************
     * Arrow Electronics         Voice: 516-391-1302 *
     * 25 Hub Drive                Fax: 516-391-1640 *
     * Melville, NY 11747 USA                        *
     * PGP Key fingerprint = EF 1F 2B 93 02 E4 53 BD *
     *                       F8 83 A9 90 29 9D 1E 1A *
     *************************************************


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

Date: 08 Sep 1997 15:22:34 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: Doing a POST as a client
Message-Id: <nqou3fwszxh.fsf@mitra.phys.uit.no>

nospam@nospam.com (John Woodstock) writes:

> Anyone have a code snippet that will do one ?

man LWP


> John Woodstock

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Mon, 08 Sep 1997 07:53:09 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Free Perl Docs (was: Re: (no subject) )
Message-Id: <3413F534.4DCBF2D4@mail.uca.edu>

<HTML>
Kenneth LO wrote:
<BLOCKQUOTE TYPE=CITE>On Fri, 5 Sep 1997, Erich Kreiselmaier wrote:

<P>> I am new to perl programming. Does anyone have a recommendation for
<BR>> free available documentation.

<P>Attached is a course notes I downloaded from MU Campus Computing. It
is
<BR>from <A HREF="http://www.phlab.missouri.edu/perl/perlcourse.html">http://www.phlab.missouri.edu/perl/perlcourse.html</A>.
This url is no
<BR>longer valid.</BLOCKQUOTE>
The URL has changed to:&nbsp; <A HREF="http://www.phlab.missouri.edu/perl/perlcourse.html">http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.html
</A>This is where I found it yesterday.

<P>Cameron Dorey
<BR>camerond@mail.uca.edu</HTML>



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

Date: 08 Sep 1997 15:06:27 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: Getting rid of ] and [ in perl
Message-Id: <nqowwkst0oc.fsf@mitra.phys.uit.no>

Matt Weber <mweber@vt.edu> writes:

> How do I get rid of these two charectors in perl: []

> Why is this not working?

This has been answered by many others, but nobody pointed out the
faster way of doing it:

tr/[]//d;

> M. Weber

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: 08 Sep 1997 15:14:01 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: Getting rid of ] and [ in perl
Message-Id: <nqovi0ct0bq.fsf@mitra.phys.uit.no>

Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:

> you'll want to wrap them back into a character class:
> s/[\[\]]//g;

Actually, inside a character class, many regex metacharacters don't
need quoting, you can represent this character class as the
(potentially confusing, programmor emptor)

[][]

which leaves the substitution as*

s/[][]//g

(but this particular usage is silly anyway, since you probably want

tr/[]//d

anyway.	See my other post on the subject)

> or use an alternation;
> s/\[|\]//g;

No.  Not if you care a bit for speed and efficiency.  Matching a
character in a character class is quick, almost as quick as matching a
single character.  Matching alternations is slow and involves
backtracking for every choice.  Single-character alternations should
always be avoided.

> andrew

_________________________________

* Of course you can change delimiters, for the even more obfuscated

s[[][]][]g

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: 8 Sep 1997 10:59:25 GMT
From: "Willy Bitter" <doc32@usa.net>
Subject: How to access the comments you can save with a Word document.
Message-Id: <01a91ca3$0194ba40$87c108c2@Sys-135.NetCologne.de>

Could somebody point me to some information on a Win32-Perl routine that
is able to access all of the file informations that can be saved with a
Word document?

Doc32@usa.net



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

Date: Mon, 08 Sep 1997 16:09:27 +0800
From: Kenneth LO <kenlo@hk.super.net>
To: John Steele <"$jsteele"@insyte.com>
Subject: Re: HTML Table to Array
Message-Id: <3413B2B7.ECB588E2@hk.super.net>

John Steele wrote:
> 
> Does anyone know of a module that will rip apart an HTML table and
> return the data in an array, etc.

No such module I think. I've searched thro' many web search engines and
tried various codes in the past months and the best I can have is

#assume you want to parse the HTML table in $c
$c=~s/^M//gi;                #remove dos ^M, if any
$c=~s/\n//gi;                #remove potential misplaced newline
$c=~s/<\/TD>/<\/TD>\n/gi;    #force a newline at each field
@r = ($c=~/<TD>.*<\/TD>/g);  #separate the fields into array @r
for ($i=0;$i<=$#r;$i++) {
 $r[$i]=~s/<.*?>//gi;        #remove the <> codes
 print "[r-$i]\t$r[$i]\n";
}

I don't know how to generalise the operation with table fields. Some
HTML pages use lower case </td><td> pairs. Some have formatting codes in
the pairs like <td align=right><font size=-1>. I need to customise the
parser for different pages.


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

Date: 8 Sep 1997 13:09:12 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: I seem to be missing something obvious with packages
Message-Id: <5v0tdo$eds$1@lyra.csx.cam.ac.uk>

Tom Phoenix  <rootbeer@teleport.com> wrote:
>I saw this happening with somebody else the other day. IMHO, it's an
>unnecessary shortcoming in 'use vars' that it can't declare vars in
>another package and thereby avoid the "used only once" warning.

I agree entirely.    To the extent that my proposed patch to vars.pm
is on its way to perl5-porters at this very moment.

>Until and unless this is fixed, you can use the first form as a
>workaround. But before anybody goes to fix it, I'm thinking: If vars.pm
>were just a little smarter, wouldn't this line be easier to type and
>understand? 
>
>    use vars qw(package Mixed::Nuts; $almond $cashew $peanut);

I use the style

     { package DB; use vars "$single" };

which isn't too ugly.


Mike Guy


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

Date: Mon, 8 Sep 1997 11:09:36 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Looking for PERL pattern to match nested braces.
Message-Id: <EG6sC0.F27@mail2.ccs.bbk.ac.uk>

Dear David,

Here's a technique I use for extracting blocks, but not
necessarity in the order you require.

	while (s/{([^{}]*)}//g) {
		# innermost, or leftmost block in $1
	}

Regards,

Mick


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

Date: 8 Sep 1997 13:25:19 GMT
From: turnerj@cliffy.lmtas.lmco.com (Jim Turner )
Subject: nested subroutines?
Message-Id: <5v0ubv$sse3@quest.lmtas.lmco.com>

Can anyone tell me why I get the following results?

	--bar: b=1=
	--foo: b=1=
	--bar: b=2=
	--foo: b==
	--bar: b=3=
	--foo: b==

from the following code (with a subroutine defined within the block of
subroutine foo).  Shouldn't "$b" defined within the lexical scope of "foo" be
visable to subroutine "bar" also lexically defined within "foo"?  Using
Local instead of my seems to fix my problem, but I am just curious about this.
It seems to work on the first invocation (b=1), but fails for subsequent calls.
Any enlightenment will be greatly appreciated.

Thanks,


Jim Turner
turnerj@mmc1001.lmtas.lmco.com



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

Date: 8 Sep 1997 13:02:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Newbie File Locking
Message-Id: <5v0t15$e66$1@lyra.csx.cam.ac.uk>

Tom Phoenix  <rootbeer@teleport.com> wrote:
>On 3 Sep 1997, Martin Fischer wrote: 
>
>> flock FILE, 8;  # not really needed, perl does it on closing the file
>> close FILE; 
>
>Not only is it not really needed, it's also not really recommended, not
>really good, and not really safe! :-)
>
>At the moment just after you release the lock, another program will get
>the chance to write to the file. But you may (and usually do) have data in
>a buffer in memory which has not been written to the file yet. That means
>that the file may be incomplete, but the other script now has permission
>to start working with it. Eek!
>
>The solution is to never, never, never release the lock on the file. (This
>rule can be disregarded by fools and experts, but by no one in between. 
>:-)  When you close the filehandle (or simply end your process) the buffer
>will always be flushed properly before the lock is released. It's simpler,
>safer, and cleaner. 

Good advice to follow, but as a matter of fact, the latest versions of
Perl (since 5.004 ??) do an automatic flush befor any flock operation.
So yet again Perl saves you from your own foolhardiness.

But with older Perls, you _must_ follow Tom's advice.


Mike Guy


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

Date: Mon, 8 Sep 1997 11:02:14 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: pattern matching HELP!
Message-Id: <EG6rzq.Ero@mail2.ccs.bbk.ac.uk>

Dear Mark,

Presumably you want your string to only contain characters
from your given set.  Therefore you need to match
everything, like this.

	unless ($string =~ /^[a-z0-9_&\.-]*$/) {
		die "Invalid characters encountered.\n";
	}

It's important to anchor both ends, to match zero or more
characters, and to match a real period.

Regards,

Mick


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

Date: Mon, 08 Sep 1997 10:20:24 +0100
From: Nick Weavers <weav@plover.havant.ibm.com>
Subject: Perl and MIME
Message-Id: <3413C357.DACC6209@plover.havant.ibm.com>

Is there some way of coding a MIME record into a perl script so that
it can be matched with a browser helper without using either the .pl
file extension or placing it in a cgi-bin directory? --
Nick Weavers, IBM SSD, Havant, PO9 1SA, UK. e-mail: weav@hursley.ibm.com
Tel: 011-44-(0)1705-486363 ext 5121  Fax: 011-44-(0)1705-499278





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

Date: Mon, 08 Sep 1997 09:35:54 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Perl on win32 book
Message-Id: <pudge-ya02408000R0809970935540001@news.idt.net>

In article <5uvpg9$spj$1@lennon.postino.com>, danny@lennon.postino.com
(Danny Aldham) wrote:

# Jonathan Tracey (jont@uunet.pipex.com) wrote:
# :  There is now a perl for win32 book available form O`reilly its a rewrite of
# : the learning perl (llama) book and is very good for NT perl people
# 
# This book is co-authored by Tom Christiansen, know for posts to
# win32 threads that one should get a real OS, a web page that slams
# any browser running on a win32 platform, and frequent posts of his
# kill file that includes anything to do with win32 or NT . Give it a miss. 

Are you sure any of that is relevant?  The Learning Perl for Win32 book is
an adaptation of the Learning Perl book.  Much of the book is general Perl
information, which is where Tom shines.  Now, if he was the sole author of
the book, I could see why there might be a problem.  But I see no problem
with the fact that he is co-author and the perception (real or not) that he
hates Windows.

--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])


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

Date: 08 Sep 1997 06:40:34 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Perl on win32 book
Message-Id: <8cen6z9b59.fsf@gadget.cscaper.com>

>>>>> "Danny" == Danny Aldham <danny@lennon.postino.com> writes:

Danny> Jonathan Tracey (jont@uunet.pipex.com) wrote:
Danny> :  There is now a perl for win32 book available form O`reilly its a rewrite of
Danny> : the learning perl (llama) book and is very good for NT perl people

Danny> This book is co-authored by Tom Christiansen, know for posts to
Danny> win32 threads that one should get a real OS, a web page that
Danny> slams any browser running on a win32 platform, and frequent
Danny> posts of his kill file that includes anything to do with win32
Danny> or NT . Give it a miss.

That's not exactly fair.  The non-win32 portion of the Gecko was
authored by me and Tom (it's called, "the blue llama" :-), and *all*
win32 changes were authored by Erik Olson, independently from a
version of the blue llama which he kept in sync with our final draft.
We had no input except as reviewers, and I didn't even review it that
much.

So, there's no reason to think that Tom's bias (or some of my bias,
for that matter :-) would have *any* influence on the Gecko.  In fact,
I haven't even read the Gecko... I'm afraid I might learning something
good about win32. :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 358 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 8 Sep 1997 12:56:28 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: perldoc
Message-Id: <5v0sls$dtf$1@lyra.csx.cam.ac.uk>

Kevin <klander@primenet> wrote:
>
>Let's see...without modification, $INC[0] is
>'/usr/local/lib/perl5/sun4-sunos/5.00401' and $INC{'IO/Socket'} is
>'/usr/local/lib/perl5/sun4-sunos/5.00401/IO/Socket.pm'.  Does that
>look right?

That all looks fine.   You could try looking in the IO/Socket.pm file
to see if there is any pod there, but I'd be surprised if there wasn't.

>The previous perl installation here was pretty screwed up, so maybe
>it's screwing this one up too...

Hmmm.   Perhaps you are getting the wrong version of perldoc?   Try running
it as

     /explicit/path/to/bin/perldoc IO::Socket


Mike Guy


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

Date: Mon, 08 Sep 1997 10:08:54 +0200
From: Gary Howland <ghowland@hotlava.com>
Subject: Recommendations for escaping apostrophes in DBI SQL statements?
Message-Id: <3413B296.5AE3@hotlava.com>

Hi,

I've been playing with DBI and SQL, and have a nice little CGI script
that accepts a form and inserts it into my database.  Problem is, when I
type an apostrophe in the CGI form, it breaks the SQL statement, due to
the quoting around some fields in the SQL statement.

What is the usual way to solve this problem?

At first I thought of replacing apostrophes with another character, and
mapping to and from every time I insert and select, but this just can't
be right since other (non perl) users may be using the database.

Gary


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

Date: 8 Sep 1997 08:49:55 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: Recommendations for escaping apostrophes in DBI SQL statements?
Message-Id: <5v0e7j$e4q$1@vixen.cso.uiuc.edu>


Gary Howland (ghowland@hotlava.com) wrote:
: Hi,
: 
: I've been playing with DBI and SQL, and have a nice little CGI script
: that accepts a form and inserts it into my database.  Problem is, when I
: type an apostrophe in the CGI form, it breaks the SQL statement, due to
: the quoting around some fields in the SQL statement.
: 
: What is the usual way to solve this problem?

    use DBI;
    $dbh = DBI->connect();
    $value = "It ain't goin' to work without this.";
    $value = $dbh->quote($value);
    $dbh->do("update test_table SET text_field = $value");

: 
: At first I thought of replacing apostrophes with another character, and
: mapping to and from every time I insert and select, but this just can't
: be right since other (non perl) users may be using the database.

Not only that, but the different databases quote differently.  MySQL and
mSQL like to backslash, others like to double up ala CSV.

That is why the quote() method is provided.  See 'perldoc DBI'.

-- 
Regards,
Mike Heins

This post reflects the
opinion of my employer.


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

Date: Mon, 8 Sep 1997 12:52:03 GMT
From: Dave.Cross@gb.swissbank.com (Dave Cross)
Subject: Re: Shakespearian insult program
Message-Id: <DAVE.CROSS.97Sep8135203@ln4d110swk.gb.swissbank.com>

In article <5umuqa$i16$0@207.17.114.19> Eric Anderson <eric@semaphore.com> writes:

> A friend emailed me a shakespearian insult kit. With it, you choose one
> word from each of three columns, put them together with a 'Thou' on the
> front of it, and you have a fully functional shakespearian insult. I've
> turned it into a small perl program. I have it set to run in my .bashrc
> file so I have the pleasure of a quality insult every time I login.
> Please feel free to use/misuse it however you see fit.
> 

[most of code snipped]
 
> print "\nThou $word_1 $word_2 $word_3!\n\n";

Eric,

<PEDANT>

One of the things about Shakespeare is that he generally wrote
grammatically correct English, which your script is guaranteed not
to do.

Given that $word_1 and $word_2 contain adjectives and that $word_3
is a noun, there should be a comma between words 1 and 2 in your
print statement.

print "\nThou $word_1, $word_2 $word_3!\n\n";

</PEDANT>

hth

Dave... .. ..
-- 
"...but Man created all gods equal."

Dave.Cross@gb.swissbank.com


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

Date: Mon, 8 Sep 1997 08:58:32 -0400
From: Mukund Rao <mrao@trincoll.edu>
Subject: Strip spaces in filenames
Message-Id: <Pine.SOL.3.95.970908085419.8011B-100000@shakti.cc.trincoll.edu>

Many of my scripts & perl routines bomb out when it comes to
(recursively) processing filenames/dirs that contain spaces or
whitespace-chars in them. Attempting to '| tr " " "?"' doesn't solve the
problem either. Has anyone come up with a workaround? How could I make
this one work, for example?  -->

#!/bin/ksh
# find and replace all occurrences of $1 with $2
# from current directory onwards (ie. all files/subdirectories below)

perl -pi -e 's/$1/$2/;' `find . -type f -print`

# doesn't work with filenames with spaces in 'em!!!

 _    _ ____
| \  / |    \     =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|  \/  | () /             Mukund Rao           |      Trinity College
|      | |\ \      "visualize whirled peas"    |   WWW Admin, Programmer
|_|\/|_|_| \_)    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



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

Date: 08 Sep 1997 15:18:47 +0200
From: schwab@issan.informatik.uni-dortmund.de (Andreas Schwab)
Subject: Re: Strip spaces in filenames
Message-Id: <vyz7mcsndu0.fsf@issan.informatik.uni-dortmund.de>

Mukund Rao <mrao@trincoll.edu> writes:

|> Many of my scripts & perl routines bomb out when it comes to
|> (recursively) processing filenames/dirs that contain spaces or
|> whitespace-chars in them. Attempting to '| tr " " "?"' doesn't solve the
|> problem either. Has anyone come up with a workaround? How could I make
|> this one work, for example?  -->

|> #!/bin/ksh
|> # find and replace all occurrences of $1 with $2
|> # from current directory onwards (ie. all files/subdirectories below)

|> perl -pi -e 's/$1/$2/;' `find . -type f -print`

|> # doesn't work with filenames with spaces in 'em!!!

With GNU find:

    find . -type -f -print0 | xargs -0 -r perl -pi -e 's/$1/$2/;'

This works even with the strangest file names.
-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"


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

Date: Mon, 08 Sep 1997 11:50:51 +0100
From: Michael O'Sullivan <osullm@cork.cig.mot.com>
Subject: utility for managing NIS password, groups and aliases files
Message-Id: <3413D88B.210B@cork.cig.mot.com>

Hi all,

I have recently discovered perl and look forward to programming in it.

My first project involves coming up with a user interface to the
/etc/{passwd,group,aliases} files.

I want to be able to maintain these files and keep a record of the
transactions in an Oracle database.

Now, one of my colleagues can handle the Oracle side of it.  

Where can I find a few handy scripts to manage the NIS files, e.g.
creating new accounts, adding users to UNIX groups etc.?

I'm sure this must have been done already.

Is perl the best way to do this?

Thanks in advance, Mike.

-- 
 _/ \_/ \_   Michael O'Sullivan       | 'Phone : +353-21-511204
/ \_/ \_/ \  Motorola Ireland Ltd.    | Fax    : +353-21-357635        
\_/ \_/ \_/  Mahon Industrial Estate  | Email  : osullm@cork.cig.mot.com
/ \ / \ / \  Blackrock, Cork, Ireland.| POST   : QCOR150@email.mot.com


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

Date: 8 Sep 1997 10:22:28 GMT
From: grycloak@greycloak.access.one.net (Grey Cloak)
Subject: Re: Where is the FAQ?  Not at "www.perl.com"!
Message-Id: <slrn617kro.98l.grycloak@greycloak.access.one.net>

On 8 Sep 1997, Grey Cloak <grycloak@greycloak.access.one.net> wrote:
I'm anwering my own Post. 

http://language.perl.com/faq/

The greeter bot sent me the mini FAQ with the answer
>
>]# perldoc perlfaq
>No documentation found for 'perlfaq'
>
>I running Red Hat 4.2 
>
>-- 
>Grey Cloak
>        _________________________________________
>
>  .-.      For pagan pages and not guitars      .|||||.
> :|#|:             or naked women               ||||||| 
>   #   http://www.geocities.com/Area51/7614     # o o #
>   #                                            #\ + /#
> __#__       Be one with the Source             __) (__
>(  #  )            Use Linux                   /   V   \
> )(#)(                                         (-  :  -)
>(_____)
>
>
> 


-- 
Grey Cloak
        _________________________________________

  .-.      For pagan pages and not guitars      .|||||.
 :|#|:             or naked women               ||||||| 
   #   http://www.geocities.com/Area51/7614     # o o #
   #                                            #\ + /#
 __#__       Be one with the Source             __) (__
(  #  )            Use Linux                   /   V   \
 )(#)(                                         (-  :  -)
(_____)


 


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

Date: 8 Sep 1997 11:10:09 GMT
From: "stephen" <schan_ca@hotmail.com>
Subject: where's gunzip and tar for dos/win?
Message-Id: <01bcbc47$9b16e4c0$60f8aecc@direct.ca.direct.ca>

Just downloaded the latest Perl for Windows/DOS,
but it's in a gzipped and tar format:

	perl5_00402-bindist04-bc_tar.gz

which utility do I use to gunzip and tar it?

thanks
stephen


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

Date: Mon, 08 Sep 1997 15:33:55 +0300
From: Andrew Dubovsky <adu@lmt.lv>
Subject: Writing setup script for module
Message-Id: <3413F0B3.C87FBD76@lmt.lv>

Hi.

I have written and tested Perl module and now want to make it
available for all user on UNIX box (and may be replicate on another
UNIX box).

Please, help me to select right way to solve this task.

Is neccecary to write perl/shell script which copy the module to public
/usr/local/lib/perl5/site_perl directory, set permissions and etc?

Best wishes, Andrew Dubovsky


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

Date: Mon, 08 Sep 1997 12:50:15 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Wrote new module, need help with system dependencies.
Message-Id: <3414f41f.467961@news.tornado.be>

schuller+news@lunatech.com (Bart Schuller) wrote:

>But watch out if you want *unsigned* longs or shorts, because those don't
>have their own pack() formats. You'll need to manually swap the result of
>a "native" unpack() where appropriate.

short to ushort (16 bits):
	$_ < 0 and $_+=(1<<16);
long to ulong (32 bits):
	$_ < 0 and $_+=(1<<32);

	Bart.


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 994
*************************************

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