[14047] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1457 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 22 12:10:36 1999

Date: Mon, 22 Nov 1999 09:10:20 -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: <943290620-v9-i1457@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 22 Nov 1999     Volume: 9 Number: 1457

Today's topics:
        Infernal pattern matching. Why won't this work. <epovazan@bc.sympatico.ca>
    Re: Infernal pattern matching. Why won't this work. (Simon Cozens)
    Re: Infernal pattern matching. Why won't this work. (Matthew Bafford)
    Re: Infernal pattern matching. Why won't this work. (Simon Cozens)
        install driver for mysql <tom.kralidis@ccrs.nrcanDOTgc.ca>
    Re: install driver for mysql <gellyfish@gellyfish.com>
    Re: mailto:Idon'tThinkSo <mrmustard45@hotmail.com>
    Re: mailto:Idon'tThinkSo <jarrowwx@home.com>
    Re: Mysql Works... and then doesn't.. and then does etc <iain_black@my-deja.com>
        New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
        NT to UNIX Question <zzawadzki@my-deja.com>
    Re: NT to UNIX Question <gellyfish@gellyfish.com>
    Re: OT Y2K, was Re: Problematic horizontal scrollbars <uri@sysarch.com>
    Re: Perl programming sytle - THANKS <j.mohr@gisma.de>
    Re: Perl programming sytle - THANKS (brian d foy)
    Re: Perl programming sytle - THANKS (Matthew Bafford)
    Re: perl script to change .htpasswd <tony_curtis32@yahoo.com>
    Re: Perl Shopping Cart with Inventory? <jojo@buchonline.net>
        read www-pages in perl <knigge@garnix.unix-ag.uni-hannover.de>
    Re: read www-pages in perl <gellyfish@gellyfish.com>
    Re: Recursion Problem using my() <skilchen@swissonline.ch>
    Re: RegEx: Replace new lines with <br> etc. (Bart Lateur)
        removing eol characters <l.goodman@edisoninteractive.com>
    Re: Serious memory leak in MacPERL? (Tom Sheppard)
        setuid Programm <m.scheferhoff@gmx.de>
    Re: setuid Programm <gellyfish@gellyfish.com>
    Re: setuid Programm <m.scheferhoff@gmx.de>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 22 Nov 1999 04:58:41 -0800
From: "X" <epovazan@bc.sympatico.ca>
Subject: Infernal pattern matching. Why won't this work.
Message-Id: <5%a_3.4$jf7.71967@news.bctel.net>

Hello All,

I have about a 4 days of Perl under my belt and I thought I was getting
somewhere and now this ...
Ok, I am incorporating the Java VM into a C++ 3d editor. So I want to use
Perl to generate the glue code, so I don't have a maintainance headache
every time I have to change some of the C++ internals. I trying was using
SWIG before but there is too much C++ base code that needs special treatment
for SWIG to help me.

So I am parsing away, and I have this:
$str=@cppClasses[$index++];                    # an array of class name |
method | method | ...
if(! ($str =~ /\G\s*([a-zA-Z_]+[\w_]*)\s*/gc))
{
    die "Invalid C++ class syntax: $str.\n";
}

I can't see why this doesn't match my stuff.
$str is simply "OObject" which the regex above should match right?
Anyone have any hints please?

BTW does \w match the underscore '_' too?

Anyone have any hints ... I'm just starting to enjoy Perl, but it does warp
ones mind at the beginning :)

Thanks
-Ed




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

Date: 22 Nov 1999 12:59:40 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Infernal pattern matching. Why won't this work.
Message-Id: <slrn83ifhr.u8p.simon@othersideofthe.earth.li>

X (comp.lang.perl.misc):
>Ok, I am incorporating the Java VM into a C++ 3d editor. So I want to use
>Perl to generate the glue code, so I don't have a maintainance headache
>every time I have to change some of the C++ internals.

Fairly ambitious, after 4 days of Perl.

>$str=@cppClasses[$index++];                    # an array of class name |

Turning -w on would have told you what's wrong with that line. 

This is what I tell everyone, and it's occasionally true:
	The type symbol stands for what you *want*, not what you've *got*.
	@ will give you an array. You don't want an array, you want a
	scalar, so the correct syntax would be $cppClasses[$index++]

>if(! ($str =~ /\G\s*([a-zA-Z_]+[\w_]*)\s*/gc))
>$str is simply "OObject" which the regex above should match right?

Try it, try it:

perl -e 'print "It matches!\n" if "OObject"=~ /\G\s*([a-zA-Z_]+[\w_]*)\s*/gc'
It matches!

How sure are you that $str contains OObject?
And if you're only doing one match, you don't need the /gc and the /\G

>BTW does \w match the underscore '_' too?

Try it, try it:

perl -e 'print "It matches!\n" if "_" =~ /\w/"'

Left as an exercise.

-- 
The system will be down for 10 days for preventive maintenance.


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

Date: Mon, 22 Nov 1999 15:33:04 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Infernal pattern matching. Why won't this work.
Message-Id: <slrn83ioft.qf.*@dragons.duesouth.net>

Simon:
: Try it, try it:
: 
: perl -e 'print "It matches!\n" if "_" =~ /\w/"'
: 
: Left as an exercise.

String found where operator expected at -e line 1, at end of line
        (Missing semicolon on previous line?)
Can't find string terminator '"' anywhere before EOF at -e line 1.

--Matthew


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

Date: 22 Nov 1999 15:37:14 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Infernal pattern matching. Why won't this work.
Message-Id: <slrn83iopa.u8p.simon@othersideofthe.earth.li>

Matthew Bafford (comp.lang.perl.misc):
>: perl -e 'print "It matches!\n" if "_" =~ /\w/"'
>: Left as an exercise.
>String found where operator expected at -e line 1, at end of line
>        (Missing semicolon on previous line?)
>Can't find string terminator '"' anywhere before EOF at -e line 1.

Debugging also left as an exercise. Botheration. I spotted it just
after posting, but thought it wasn't worth following up to myself until
someone picked me up on it. I knew it wouldn't be long. :)

-- 
I plugged my phone in where the blender used to be.  I called someone.  They
went "Aaaaahhhh..."  -- Steven Wright


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

Date: Mon, 22 Nov 1999 09:16:32 -0500
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: install driver for mysql
Message-Id: <38395040.D49BE3A9@ccrs.nrcanDOTgc.ca>

Hi,

I have a script to work with a mysql-derived database.  When I try to
run it, it says that the driver is not installed (DBD::mysql).  I do
have DBI; loaded.

I have downloaded Msql-Mysql-modules-1_2209.tar, and have tried to
install it, but still get errors.  I would like to use it outside of the
default directories given for @INC (eg. use lib "/home/perl5lib/").

Does anyone know of any online resources to help troubleshoot this?

Thanks in advance.

 ..Tom

-----------------------------------------------------------------------------------------
Tom Kralidis                                  Geo-Spatial Technologist 
Canada Centre for Remote Sensing              Tel: (613) 947-1828
588 Booth Street , Room 241                   Fax: (613) 947-1408
Ottawa , Ontario K1A 0Y7                     http://www.ccrs.nrcan.gc.ca
-----------------------------------------------------------------------------------------


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

Date: 22 Nov 1999 14:29:09 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: install driver for mysql
Message-Id: <38395335_1@newsread3.dircon.co.uk>

In comp.lang.perl.misc Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca> wrote:
> Hi,
> 
> I have a script to work with a mysql-derived database.  When I try to
> run it, it says that the driver is not installed (DBD::mysql).  I do
> have DBI; loaded.
> 
> I have downloaded Msql-Mysql-modules-1_2209.tar, and have tried to
> install it, but still get errors.  I would like to use it outside of the
> default directories given for @INC (eg. use lib "/home/perl5lib/").
> 
> Does anyone know of any online resources to help troubleshoot this?
> 

<http://www.mysql.org>

I think that you have to download the whole MySQL package in order to
get the cleint libraries.

/J\
-- 
"Babylon 5 has some impressive special effects and enough dodgy hairdos
to make the current Conservative front bench look trendy" - Radio Times


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

Date: Mon, 22 Nov 1999 15:44:11 GMT
From: "styxx" <mrmustard45@hotmail.com>
Subject: Re: mailto:Idon'tThinkSo
Message-Id: <fxd_3.2773$qC1.192998@typhoon1.rdc-detw.rr.com>

Thank you John,
Indeed escaping the @ sign is necessary, however while the program displays
with no problem, the link is not hot. I am wondering If I have to go withone
of the standard Mail forms.

John Arrowwood <jarrowwx@NOSPAM.home.com> wrote in message
news:3838D543.C423FB9F@NOSPAM.home.com...
> styxx wrote:
>
> > So I am writing a reply perl script. And in the perlscript I want my
> > recipients to send me suggestions, if they please. But when I write the
HTML
> > contents in the
> > content-type: text/html\n\n;
> > print<<__end;
> > <html>so on and so forth
> >
> > __end
> >
> > I try and include a \<a \href="mailto:me@mysite.com\> (without the
escape
> > characters, of course). however the perl script will not accept the
mailto.
> > Even if I create form and set the "Action" equal to the mailto:address,
the
> > script will not accept it. Any suggestions?
>
> Start by turning on -w in perl then running from the command-line.  You
will
> PROBABLY (but not guaranteed) see that perl doesn't like you putting an @
sign
> that is unescaped.  Why?  Because it thinks you're referring to an array
> variable.  Prefix the @ with a backslash and it MIGHT work.  I say might
> because I can't predict what other problems might be lurking... :)
>
> -- John
>




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

Date: Mon, 22 Nov 1999 16:21:32 GMT
From: John Arrowwood <jarrowwx@home.com>
Subject: Re: mailto:Idon'tThinkSo
Message-Id: <Pine.LNX.4.10.9911220817170.5333-100000@c42753-a.potlnd1.or.home.com>

Hmmm...  Then it sounds like the HTML is malformed.  Or there is another
possibility...perhaps the browser you are using doesn't know what to do
with (or isn't configured for) mailto: links.  Try just creating a
straight HTML file with the desired link, then see if it works in your
browser.  If not, then the problem wasn't in your Perl script.  If it
does, then post the script so we can take a look at it.

On Mon, 22 Nov 1999, styxx wrote:

> Thank you John,
> Indeed escaping the @ sign is necessary, however while the program displays
> with no problem, the link is not hot. I am wondering If I have to go withone
> of the standard Mail forms.
> 
> John Arrowwood <jarrowwx@NOSPAM.home.com> wrote in message
> news:3838D543.C423FB9F@NOSPAM.home.com...
> > styxx wrote:
> >
> > > So I am writing a reply perl script. And in the perlscript I want my
> > > recipients to send me suggestions, if they please. But when I write the
> HTML
> > > contents in the
> > > content-type: text/html\n\n;
> > > print<<__end;
> > > <html>so on and so forth
> > >
> > > __end
> > >
> > > I try and include a \<a \href="mailto:me@mysite.com\> (without the
> escape
> > > characters, of course). however the perl script will not accept the
> mailto.
> > > Even if I create form and set the "Action" equal to the mailto:address,
> the
> > > script will not accept it. Any suggestions?
> >



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

Date: Mon, 22 Nov 1999 16:26:36 GMT
From: Iain Black <iain_black@my-deja.com>
Subject: Re: Mysql Works... and then doesn't.. and then does etc.
Message-Id: <81bqrl$5he$1@nnrp1.deja.com>


> This looks like a bug.  Presumably you want to either get rid of
> "unless $dbh" or replace || with ;.  Should be harmless for now.
>
> Beyond that, I am mystified.

That was the problem! It now works perfectally! All I need to do now is
figure out why my lattop goes into hibernate mode every time Linux boots
up and reaches the CMOS clock bit...... :)

Thanks!!

--
The Def Guide to Zzap!64
http://www.fortunecity.com/skyscraper/decimal/81/zzap.html

Iain's C64 Pages http://www.fortunecity.com/skyscraper/decimal/81/


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 22 Nov 1999 15:05:02 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <81bm2u$3f8$2@info2.uah.edu>

Following is a summary of articles from new posters spanning a 7 day
period, beginning at 15 Nov 1999 15:06:45 GMT and ending at
22 Nov 1999 07:59:24 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 1999 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Totals
======

Posters:  248 (48.9% of all posters)
Articles: 386 (20.0% of all articles)
Volume generated: 638.7 kb (19.6% of total volume)
    - headers:    296.5 kb (6,057 lines)
    - bodies:     334.6 kb (11,144 lines)
    - original:   240.0 kb (8,487 lines)
    - signatures: 7.2 kb (164 lines)

Original Content Rating: 0.717

Averages
========

Posts per poster: 1.6
    median: 1.0 post
    mode:   1 post - 172 posters
    s:      1.3 posts
Message size: 1694.3 bytes
    - header:     786.6 bytes (15.7 lines)
    - body:       887.6 bytes (28.9 lines)
    - original:   636.7 bytes (22.0 lines)
    - signature:  19.0 bytes (0.4 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

    7     9.4 (  5.3/  2.2/  2.1)  Waranun Bunjongsat <bunjonwa@trek.CS.ORST.EDU>
    7    16.4 (  6.3/ 10.0/  5.2)  jut@letterbox.com
    7    15.8 (  5.5/ 10.2/  6.0)  "Chris Collins" <cpcollin@wam.umd.edu>
    7    16.0 (  5.3/ 10.7/  5.6)  "Tom Clark" <tomclark@btinternet.com>
    6    14.0 (  5.7/  8.3/  4.4)  John Arrowwood <jarrowwx@NOSPAM.home.com>
    5     7.6 (  3.8/  3.8/  1.7)  "Uwe W. Gehring" <gehring.u@zdf.de>
    5     6.6 (  3.9/  2.7/  1.5)  Tony Curtis <tony_curtis32@yahoo.com>
    4     6.1 (  2.9/  3.2/  1.2)  "Jun Xu" <jxu@wcom.net>
    4     5.9 (  2.7/  3.2/  2.3)  jampa@my-deja.com
    4     5.3 (  2.5/  2.8/  2.7)  "Ong" <lhengc1@pd.jaring.my>

These posters accounted for 2.9% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  16.4 (  6.3/ 10.0/  5.2)      7  jut@letterbox.com
  16.0 (  5.3/ 10.7/  5.6)      7  "Tom Clark" <tomclark@btinternet.com>
  15.8 (  5.5/ 10.2/  6.0)      7  "Chris Collins" <cpcollin@wam.umd.edu>
  14.0 (  5.7/  8.3/  4.4)      6  John Arrowwood <jarrowwx@NOSPAM.home.com>
   9.4 (  3.1/  6.3/  3.8)      3  "Dave Roth" <rothd@roth.REMOVE.net>
   9.4 (  5.3/  2.2/  2.1)      7  Waranun Bunjongsat <bunjonwa@trek.CS.ORST.EDU>
   8.6 (  1.9/  6.6/  4.7)      3  jaakko.puurunen@_iki.fi (Jaakko Puurunen)
   7.6 (  3.8/  3.8/  1.7)      5  "Uwe W. Gehring" <gehring.u@zdf.de>
   7.3 (  3.8/  3.4/  1.1)      4  "Matthew H. Devlin III" <mhdevlin@nycap.rr.com>
   6.6 (  0.8/  5.8/  3.0)      1  "Michael" <mboerner@i1.net>

These posters accounted for 3.4% of the total volume.

Top 10 Posters by OCR (minimum of three posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

1.000  (  1.2 /  1.2)      3  vsam1 <gte017gNOgtSPAM@prism.gatech.edu.invalid>
1.000  (  1.6 /  1.6)      3  "Steven Lybeck" <alanis@softhome.net>
0.963  (  2.7 /  2.8)      4  "Ong" <lhengc1@pd.jaring.my>
0.949  (  2.1 /  2.2)      7  Waranun Bunjongsat <bunjonwa@trek.CS.ORST.EDU>
0.880  (  0.6 /  0.7)      3  "Lassi Hautakangas" <lhauta@koti.tpo.fi>
0.742  (  1.2 /  1.6)      3  avivA Starkman <aviva.starkman@exchange.sp.trw.com>
0.725  (  1.9 /  2.6)      3  dukat@burkittsville.org
0.723  (  2.3 /  3.2)      4  jampa@my-deja.com
0.704  (  2.4 /  3.4)      3  che@worker.com (Adam Levenstein)
0.702  (  4.7 /  6.6)      3  jaakko.puurunen@_iki.fi (Jaakko Puurunen)

Bottom 10 Posters by OCR (minimum of three posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.507  (  1.5 /  3.0)      4  Cure <cure@texas.net>
0.479  (  0.6 /  1.3)      3  jonas.nilsson@mbox326.swipnet.se (Jonas Nilsson)
0.440  (  1.7 /  3.8)      5  "Uwe W. Gehring" <gehring.u@zdf.de>
0.382  (  1.4 /  3.7)      3  Nigel W <nigel_williams@my-deja.com>
0.375  (  1.2 /  3.2)      4  "Jun Xu" <jxu@wcom.net>
0.374  (  0.7 /  1.8)      3  "Harini" <harinirayadurgam@hotmail.com>
0.319  (  0.6 /  1.8)      3  csaba_r@my-deja.com (Csaba Raduly)
0.319  (  0.6 /  1.9)      3  "Mike Bickham" <mbickham@photographics.co.uk>
0.314  (  1.1 /  3.4)      4  "Matthew H. Devlin III" <mhdevlin@nycap.rr.com>
0.273  (  0.2 /  0.9)      3  ah@datapharm.de

32 posters (12%) had at least three posts.


Top 10 Crossposters
===================

Articles  Address
--------  -------

       8  zlatko@gmx.at
       6  "Tom Clark" <tomclark@btinternet.com>
       4  dkjh <kjh@kljd.dk>
       4  Echo the Wonder Tube <rick@violetshiversBITE-ME-YOU-SPAMMING-SCUM.com>
       4  Richard Padley <richard@semantico.com>
       4  Big Daddy <white.chocolate@iname.com>
       4  "Sandbox Studios HR" <jobs@sandboxstudios.com>
       4  "Ross Crawford" <rossc@prologic.com.au>
       4  "DigitalSorceress" <digitalsorceress@d1g1t4!$0rc3$$.com>
       4  "xtrm" <xtrm@xtrm.karoo.co.uk>


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

Date: Mon, 22 Nov 1999 11:27:39 GMT
From: Zachar <zzawadzki@my-deja.com>
Subject: NT to UNIX Question
Message-Id: <81b9b9$oo3$1@nnrp1.deja.com>

Hi!

I need to know the follofing thing:

If I develop a product under NT (Perl for NT, Sybase for NT and
SybaseDBI for NT) do I need to make any significant changes before I can
use the Perl code under UNIX?

Thanks in advance!
Zachar


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 22 Nov 1999 11:52:03 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: NT to UNIX Question
Message-Id: <38392e63_1@newsread3.dircon.co.uk>

Zachar <zzawadzki@my-deja.com> wrote:
> Hi!
> 
> I need to know the follofing thing:
> 
> If I develop a product under NT (Perl for NT, Sybase for NT and
> SybaseDBI for NT) do I need to make any significant changes before I can
> use the Perl code under UNIX?
> 

If you are using DBD::Sybase then no - also you will want to look at the
perlport manpage to see some of the things that do catch people out ...

/J\
-- 
"I want to be like Oprah" - Sarah, Duchess of York


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

Date: 22 Nov 1999 10:45:22 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: OT Y2K, was Re: Problematic horizontal scrollbars
Message-Id: <x7pux2o7hp.fsf@home.sysarch.com>

>>>>> "JS" == Jonathan Stowe <gellyfish@gellyfish.com> writes:

  JS> I am amused that this page cites two of my clpm articles ... Interestingly
  JS> both of which go to some lengths to make the point that the misuse of
  JS> (localtime)[5] is a symptom of wider bad programming practice that can
  JS> be found in the bulk of Matt Wrights  output ...

so you're the cause of the spread of bad y2k perl code! stop doing this
now or i will sic some sick .nz female nut case on your ass! she will
teach you the difference between y2k and meta y2k!

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Mon, 22 Nov 1999 15:47:11 +0100
From: James Mohr <j.mohr@gisma.de>
Subject: Re: Perl programming sytle - THANKS
Message-Id: <3839576F.61FC1941@gisma.de>

Well, there are obviously as many opinions about this issue as there are
people. For me,
the biggest issue is maintainability. If the people who are going to
maintain the code come
from a UNIX-C background, I should make things easier for them by
programming
that way. If the people are coming from an NT-VB background, I should
programm that
way.

At any rate, thanks for the comments.

--
Regards,

jimmo
---------------------------------------
"Science has promised man power...But, as so often happens when
people are seduced by promises of power, the price is servitude
and impotence.  Power is nothing if it is not the power to choose."
Joseph Weizenbaum of MIT said in reference to Computers.
---------------------------------------
The Great Linux-NT Debate: <http://www.jimmo.com/Debate/intro.html>

James Mohr schrieb:

> Hi All!
>
> I was recently "chastised" by someone for programming perl on  WinNT
> like I programm
> C on UNIX. He insisted that I should programm more "perl-like" and many
> of the constructs
> he suggested as changes were definately not C-like, and were definately
> harder to read. (IMO)
>
> I figure that computers have reached the point where there is no need
> for making "tighter" code.
> Unless you are programming 3-D graphics and are really pushing the
> limits of your 128MB RAM
> and 500MHz machines, then spending time to make it run in 0.1 second as
> compared to 0.5 second
> is not worth the trouble. In addition, writing it C-like makes it easier
> for non-Perl programmers to
> understand it.
>
> Now I know I am free to write my programs. However, I would like to hear
> other people's thoughts
> on perl programming style.
>
> --
> Regards,
>
> jimmo
> ---------------------------------------
> "Science has promised man power...But, as so often happens when
> people are seduced by promises of power, the price is servitude
> and impotence.  Power is nothing if it is not the power to choose."
> Joseph Weizenbaum of MIT said in reference to Computers.
> ---------------------------------------
> The Great Linux-NT Debate: <http://www.jimmo.com/Debate/intro.html>





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

Date: Mon, 22 Nov 1999 10:12:27 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Perl programming sytle - THANKS
Message-Id: <brian-ya02408000R2211991012270001@news.panix.com>

In article <3839576F.61FC1941@gisma.de>, James Mohr <j.mohr@gisma.de> posted:

> Well, there are obviously as many opinions about this issue as there are
> people. 

probably more opinions that people - like the old joke - ask four
economists a question and get five answers.

seriously though, my style varies depending on what i'm doing.  i'm
much more verbose in teaching situations but very structured and
concise in my own programming, and i follow the style of the original 
coder for maintenance programming.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Mon, 22 Nov 1999 16:00:03 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Perl programming sytle - THANKS
Message-Id: <slrn83ipcl.qf.*@dragons.duesouth.net>

> X-Newsreader: Sony PlayStation 5.0PPC alpha

Interesting... :)

On Mon, 22 Nov 1999 10:12:27 -0500, brian d foy) poured coffee onto a
keyboard, producing the following in comp.lang.perl.misc: 
: seriously though, my style varies depending on what i'm doing.  i'm
: much more verbose in teaching situations but very structured and
: concise in my own programming, and i follow the style of the original 
: coder for maintenance programming.

And then there's golf!

:-)

: brian d foy                    

--Matthew


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

Date: 22 Nov 1999 12:01:36 +0000
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: perl script to change .htpasswd
Message-Id: <wk3dty4twf.fsf@yahoo.com>


mr_potato_head@my-deja.com writes:

> hi,
>    I have a internal web page that I want to give my users the ability
> to change there password.  Can anyone direct me to a simple perl cgi
> script that will change someone's password in a .htpasswd file?  Thanks
> in advance...

perldoc HTTPD::UserAdmin

There's also Lincoln Stein's HTTPD-User-Manage
package (from CPAN).

hth
tony


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

Date: Mon, 22 Nov 1999 15:15:12 +0100
From: Hans-Joachim Leidinger <jojo@buchonline.net>
Subject: Re: Perl Shopping Cart with Inventory?
Message-Id: <38394FF0.AD62AB79@buchonline.net>

Look at

www.minivend.com

Regards,

Joachim

Miles Burke schrieb:
> 
> Hi Folks,
> 
> I have spent the better part of today searching for a perl based shopping
> cart that allows for an inventory, ie: part X with 10 remaining, sell one
> it becomes nine remaining, etc and when it gets to zero, removes the part
> from the list.
> 
> Anyone seen anything like it? It only needs to handle perhaps 50 items at
> any one period, but needs to be able to have an inventory...I expected to
> find one with no trouble, but alas, neither free nor commercial ones can
> be found (maybe good idea for perl expert to write?).
> 
> Please remove 'nospamplease' from my address to email me.
> 
> Cheers!
> 
> Miles.

-- 
Hans-Joachim Leidinger
buch online                 jojo@buchonline.net
Munscheidstr. 14            FAX: +49 209 1971449
45886 Gelsenkirchen


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

Date: Mon, 22 Nov 1999 14:19:05 +0100
From: Christian WIese <knigge@garnix.unix-ag.uni-hannover.de>
Subject: read www-pages in perl
Message-Id: <383942C9.AB734568@garnix.unix-ag.uni-hannover.de>


what modyle can I use?
How can I read an Url eg http://www.uni-hannover.de/
in a variable?

Thanks
Christian


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

Date: 22 Nov 1999 13:36:01 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: read www-pages in perl
Message-Id: <383946c1_2@newsread3.dircon.co.uk>

In comp.lang.perl.misc Christian WIese <knigge@garnix.unix-ag.uni-hannover.de> wrote:
> 
> what modyle can I use?
> How can I read an Url eg http://www.uni-hannover.de/
> in a variable?
> 
LWP::Simple part of libwww-perl available from CPAN <http://www.cpan.org>

The document lwpcook that comes with it has plenty of examples.

/J\
-- 
"We've even been asked to review a luxury hotel. I can't think why" -
Neil Hamilton


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

Date: Mon, 22 Nov 1999 12:09:55 +0100
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Recursion Problem using my()
Message-Id: <81b8a1$1kijq$1@fu-berlin.de>

Jason Eggleston <jegglest@my-deja.com> wrote in message
news:81b0a9$j20$1@nnrp1.deja.com...
>
> Now, with the first call of the function, $localmin refers to the
> same variable both inside and outside of the while() loop.  By
> the last call, the variables refer to different values...
> values of previous function calls!
>
> Is there something I have to do to re-bind the variables in the
> while() loop to the correct values?
>
First i have to admit that i don't understand your code.
But the differences in the $localmin values have nothing to due with
the wile loop but with different recursion levels at the moment when
you print the value and "address" of $localmin.
The second time you call GetRange the subroutine immediately returns
after printing the a-case because the condition of the while loop is
false ($localmin is equal to $min and $localmax is not greater than
$max). So when the b- and c-cases are printed what happens, is exactly
what you described above: the values are from the previous function
call because the context after the return from the second call to
GetRange is indeed the one from the previous call to GetRange.

Singlestepping using the debugger helps a lot in such cases.





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

Date: Mon, 22 Nov 1999 14:46:45 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: RegEx: Replace new lines with <br> etc.
Message-Id: <3840449e.5220017@news.skynet.be>

Brackett wrote:

>For example, on the <p> front, I've been trying various permutations on
>the following to no avail.
>
>s/\n{2,}/<p>/g;

Looks good. You *have* read the entire file into $_, have you?
Otherwise, on a line-by-line basis, it won't work. Undef $/, e.g. by
localizing it, that will allow you to read in the file in one string.

If you insist on doing a line-by-line processing, search for empty
lines. The ".." or "..." operators can help preventing getting multiple
"<p>"'s in a row. This works, but IMO, it's ugly.

  while(<>) {
      if((my $first = s/^$/<p>/) ... (my $last = !/^$/)){
          next unless $first or $last;
      }
      print;
  }

-- 
	Bart.


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

Date: Mon, 22 Nov 1999 16:24:14 -0800
From: "Lloyd Goodman" <l.goodman@edisoninteractive.com>
Subject: removing eol characters
Message-Id: <38396f0c@ferret.highwayone.net>

Apologies in advance for posting such a basic question.

I have a tab delineated file from which I am need to remove keyfields.  One
of them is a long description which, for reasons out of my control, often
contain unwanted end of line characters.  How can I remove just the ones
that appear in the middle of the text?

thanks
lloyd




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

Date: Mon, 22 Nov 1999 14:42:39 GMT
From: sheppard@magma.ca (Tom Sheppard)
Subject: Re: Serious memory leak in MacPERL?
Message-Id: <sheppard-2211990942380001@192.168.0.1>

In article <pudge-2111991549340001@192.168.0.7>, pudge@pobox.com (Chris
Nandor) wrote:

> each() can be used specifically to avoid this.
> 
>   while (my($k, $v) = each %hash) { # get one pair at a time
>     # ...
>   }

I tried that without success. What I'm doing is calling a subroutine with
a set of files to diff. The files are not sorted and are huge, that's why
I just load one of the files into a big hash and read the other file line
by line looking for a match in the hash (first file). This allows me to
create add and delete transactions for my database.

The largest file has almost 450,000 records containing names and numbers.
I can get past that file but the next file runs out of memory. Since I'm
trying to process a total of 21 files, I have to do this in two passes,
quitting between runs to free memory.

It would seem that if a script terminates, then all memory is freed up
such that running a new script would be like running it immediately after
relaunching. Using the Finder's About This Computer to check on memory,
you can see the usage bar move to the right, the script ends but no memory
is recovered. Running the next script, even one which uses much less
memory, results in an out of memory error.

So there must be a memory leak within a script if an "undef" doesn't free
the memory and an even more serious leak if exiting a script doesn't free
up the memory.

So the problems I see are:

- hashes seem to use an inordinate amount of memory (but I don't know much
about the internals of hashing, so this may be the norm).

- "undef" doesn't appear to free the memory.

- "delete" doesn't appear to help either.

- preallocating using "keys %myhash = 500000;" has almost no benefit and
doesn't stop the memory leak when using an "undef".

- exiting a script does not free all the memory it used.

- MacPerl only wants to use around 72 MB and no more. Allocating more
memory does not help.

I don't have access to a Unix box so I can't try that, but I'll see if I
can install a Windows version on Virtual PC and see if the memory leak
persists there.

Thanks for your suggestions.

 ...Tom


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

Date: Mon, 22 Nov 1999 13:05:08 +0100
From: Michael Scheferhoff <m.scheferhoff@gmx.de>
Subject: setuid Programm
Message-Id: <38393174.60BA67DC@gmx.de>

Hello,

can anybody tell me, how to write a setuid program? I read perlsec and
still don't know, how to change the user ID.

Thanks,

Michael



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

Date: 22 Nov 1999 12:12:23 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: setuid Programm
Message-Id: <38393327_1@newsread3.dircon.co.uk>

Michael Scheferhoff <m.scheferhoff@gmx.de> wrote:
> Hello,
> 
> can anybody tell me, how to write a setuid program? I read perlsec and
> still don't know, how to change the user ID.
> 

You will need to read your systems manpage for chmod (that is the Unix 
command not the Perl builtin).  You might be able to change UID by
playing with $< and $> but this might not work on all systems and you
have to be root anyway ...

/J\
-- 
"It's times like this I wish I had a penis" - Duckman


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

Date: Mon, 22 Nov 1999 13:42:41 +0100
From: Michael Scheferhoff <m.scheferhoff@gmx.de>
To: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: setuid Programm
Message-Id: <38393A41.FF2745C5@gmx.de>

> > can anybody tell me, how to write a setuid program? I read perlsec and
> > still don't know, how to change the user ID.
>

> You will need to read your systems manpage for chmod (that is the Unix
> command not the Perl builtin).  You might be able to change UID by
> playing with $< and $> but this might not work on all systems and you
> have to be root anyway ...

But I wrote a little perl programm which works fine:

#!/usr/bin/perl -wT

print "This is a test with UID: $<\n";
$<=119;
print "After changing the UID: $<\n";

I can run this program as every user, I don't have to be root.

If I want to implement this in a CGI script, this does not work.

Michael



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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 1457
**************************************


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