[8872] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2489 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 4 09:07:13 1998

Date: Mon, 4 May 98 06:01:11 -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, 4 May 1998     Volume: 8 Number: 2489

Today's topics:
    Re: 1701 days hath September (was: Re: rename funciton) (Jim Michael)
    Re: \D fails when [^0-9] doesn't <r.goeggel@atos-group.de>
    Re: \D fails when [^0-9] doesn't (Tad McClellan)
    Re: Bidirectional pipe filehandles? <lwp@flenser.ibm.net>
    Re: CGI.pm question - user friendly labels for popup_me <fty@utk.edu>
        Creating a text file from form variables <jasmatt@es.co.nz>
    Re: date problem <nr.edv@swipnet.se>
        How can I delete a file from my perl program ananta@w-o-i.com
    Re: How can I delete a file from my perl program (Hakan Hjelmstrom)
    Re: How can I delete a file from my perl program <perlguy@inlink.com>
    Re: How many files can I open? (Hakan Hjelmstrom)
    Re: How many files can I open? (Tad McClellan)
        Include libs from current CGI path NT4 IIS4?? <netset@powerup.com.au>
        Input to programs poster@prm.se
    Re: Length of a variable <r.goeggel@atos-group.de>
    Re: Length of a variable <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Length of a variable <jhi@alpha.hut.fi>
        magic <> and Term::ReadLine::Gnu <Tim.Mueller-Seydlitz@dresdner-bank.com>
        Making a package more efficient <tony@blackstar.co.uk>
        Max length of a string <Dieter_Stolpmann@hp.com>
    Re: PErl Functions <webmaster@fccjmail.fccj.org>
        Perl Randomness Question..any pointers? (MercuryZ)
        Perl Randomness Question..any pointers? (MercuryZ)
        Perl2Exe file for Unix? <tan@jettech.dircon.co.uk>
        s///g skips possible matches (Bart Lateur)
    Re: Simple Perl Databases <perlguy@inlink.com>
    Re: Strange problem. <webmaster@fccjmail.fccj.org>
        to arch...sorry for the lack of a RE but problems with  (MercuryZ)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 4 May 1998 10:33:45 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <genepoolEsFHCA.F1z@netcom.com>

John Stanley (stanley@skyking.OCE.ORST.EDU) wrote:

: Yes, the idea of paying for yet another account has already been
: suggested. You apparently missed the part where it involves paying for
: another account.

Then use one of the free email services. 


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

Date: Mon, 4 May 1998 10:06:33 +0200
From: "Ronald G\"oggel" <r.goeggel@atos-group.de>
Subject: Re: \D fails when [^0-9] doesn't
Message-Id: <6ijt0a$pgu$1@news.pop-stuttgart.de>


Terrence Brannon writes
>
>
 ...
>
>#$ignore_header_re="^[^0-9]+";  #           THIS DOES NOT!!!!!!
>$ignore_header_re="^\D+";       # <-------- THIS FAILS!!!!!!!!!
>


\d is the same as [0-9] (a digit)
\D is a non-digit
[^0-9] means an ^ or a digit.

HTH
Ronald




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

Date: Mon, 4 May 1998 07:11:32 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: \D fails when [^0-9] doesn't
Message-Id: <k9bki6.anl.ln@localhost>

Ronald G\ <r.goeggel@atos-group.de> (oggel) wrote:

: [^0-9] means an ^ or a digit.


No it doesn't.

It means the same as \D


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


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

Date: 4 May 1998 12:54:10 GMT
From: Lou Poppler <lwp@flenser.ibm.net>
Subject: Re: Bidirectional pipe filehandles?
Message-Id: <354dba72.0@news1.ibm.net>

I did not write the text quoted below.
Please be more careful with your attributions.

On 1 May 1998 16:52:20 GMT, tigger@io.com.nospaam wrote:
: Check out the open2() command, and the Comm.pl module.


: Lou Poppler <lwp@flenser.ibm.net> wrote:
:> : Now, on page 163 of the 1st Edition camel book (the "open" reference),
:> : Larry and Randal tell me that an open command which pipes both in and out
:> : should be easy to build. How, though? I've been poring over the pipe() and
:> : fork() man pages and function references for a couple hours now, and I'm
:> : not seeing it.

:> : Alik



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

Date: Mon, 04 May 1998 08:26:55 -0400
From: Jay Flaherty <fty@utk.edu>
To: scott.seaton@aus.sun.com
Subject: Re: CGI.pm question - user friendly labels for popup_menu
Message-Id: <354DB40F.FE775AC@utk.edu>

scott.seaton@aus.sun.com wrote:

> The menu comes up OK, but only displays the values. I'd like it to display
> something else, but can't get it working.
>
> Here's a code extract:
>                 td(popup_menu(-name=>'requestor',
>                 -values=>[qw/name1 name2 name3 name4 name5/],
>                 -labels=>{'Firstname Lastname1'=>'one',
>                           'Firstname Lastname2'=>'two',
>                           'Firstname Lastname3'=>'three',
>                           'Firstname Lastname4'=>'four',
>                           'Firstname Lastname5'=>'five'},
>                 -default=>'name1')),
>
> I'd like the popup_menu to display the "Firstname LastnameX" label, but don't
> seem to be able to get it working... All I get is the entry from the values
> array.

Your labels tag is backwords. Try it this way:
td(popup_menu(-name=>'requestor',
                -values=>[qw/name1 name2 name3 name4 name5/],
                -labels=>{'one'=>'Firstname Lastname1',
                                 'two'=>'Firstname Lastname2',
                                 etc ...

Also, your label keys have to match your values, so it should look like this:
td(popup_menu(-name=>'requestor',
                -values=>[qw/name1 name2 name3 name4 name5/],
                -labels=>{'name1'=>'Firstname Lastname1',
                                 'name2'=>'Firstname Lastname2',
                                 etc ...
An easier way is like this:
%labels = { 'name1'=>'Firstname Lastname1',
                   'name2'=>'Firstname Lastname2',
                   'name3'=>'Firstname Lastname3',
                   'name4'=>'Firstname Lastname4',
                   'name5'=>'Firstname Lastname5'};
@values = sort(keys(%labels));
popup_menu(
-name=>'requestor',
-values=>\@values,
-labels=>\%labels,
-default=>'name1'
);

Jay

--
**********************************************************************
Jay Flaherty                                               fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************




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

Date: Tue, 05 May 1998 00:12:07 +1200
From: Matt McKenzie <jasmatt@es.co.nz>
Subject: Creating a text file from form variables
Message-Id: <354DB097.E79D1C62@es.co.nz>

ok....here's a tricky one

1. I want to take two variables from a form. i.e $username and $password

2. Use a small perl script to create a .txt file named after the
$username. i.e. username.txt.
2. chmod the text file to 666
3. insert 2 lines into the .txt file containing the $username and
$password.
4. place this file in a specified dir.

I've had some documentation to do this, but for the life of me I can't
find it again.

post here or email if you think you can help

tia
Matt





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

Date: Mon, 04 May 1998 12:25:03 +0200
From: Nils-Roger Edvardsson <nr.edv@swipnet.se>
Subject: Re: date problem
Message-Id: <354D977F.58A4@swipnet.se>

Martien Verbruggen wrote:
> 
> How exactly does this have anything to do with perl modules?
> 
> In article <354CFBD1.3FF7@swipnet.se>,
>         Nils-Roger Edvardsson <nr.edv@swipnet.se> writes:
> > I have this string :
> >
> > $date_command = "/usr/bin/date";
> >
> > In my guestbook were the date shall show up, I get this instead :
> >
> > - $date_command +"%A, %B %d, %Y at %T (%Z)
> >
> > Hmm, what is wrong ?
> 
> How are we supposed to know? You probably alter your 'string'
> somewhere else. Run the thing in the debugger or something. grep your
> code for 'date_command'. Do the usual things one does when a problem
> occurs: DEBUG.
> 
> I really don't need this on a monday morning.
> 
> Martien
> 
> PS. Followup set. I wanted to set it to alt.dev-null first, but oh
> well..
> --
> Martien Verbruggen                      |
> Webmaster www.tradingpost.com.au        | "In a world without fences,
> Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
> NSW, Australia                          |
Hi, I have fixed it now with some helps.. Bye,


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

Date: Mon, 04 May 1998 05:30:25 -0600
From: ananta@w-o-i.com
Subject: How can I delete a file from my perl program
Message-Id: <6ik5c1$brm$1@nnrp1.dejanews.com>

I am using IIS3.0 (NT4.0) with Perl for win32. On of my programs(see below)
is supposed to accept the filenames to delete in $value[$i] and delete them.
I tried using the system function for this purpose but it didnt work. I am
desperately seeking a solution. You are most welcome to send me email
directly : ananta@w-o-i.com :-) Thanx Ananta
-------------------------------------delete.pl-------------------------------
-------------------------------- print "Content-type: text/html\n\n"; print
"<HTML>\n"; print "<HEAD>\n"; print "<TITLE>LIST OF FILES IN \U
$input\E</TITLE>\n"; print "</HEAD>\n"; print "<BODY BGCOLOR=#FFFFFF
TEXT=#000000 LINK=#000080 VLINK=#000080 ALINK=#FF0000>";


if ($ENV{'REQUEST_METHOD'} eq "get") { $buffer = $ENV{'QUERY_STRING'}; }
else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); }
#print "the buffer has $buffer\n";
@nvpairs = split(/&/, $buffer);

foreach $pair (@nvpairs){  ($name[$x], $value[$x]) = split(/=/, $pair); 
$value[$x] =~ tr/+/ /;	$value[$x] =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",
hex($1))/eg;		   $x++; } $len=@value-1; for ($i=0; $i<$len;$i++) { 
     #print "$value[$i]\n\n";	     system('rm $value[$i]'); } print "<font
face=\"MS Sans Serif\" size=\"3\" color=\"#800000\">Document templates
deleted</font><br>"; print "</body>"; print "</html>";

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Mon, 04 May 1998 11:24:14 GMT
From: hawk@algonet.se (Hakan Hjelmstrom)
Subject: Re: How can I delete a file from my perl program
Message-Id: <354da473.77205535@news.algonet.se>

On Mon, 04 May 1998 05:30:25 -0600, ananta@w-o-i.com wrote:
> I am using IIS3.0 (NT4.0) with Perl for win32. On of my programs(see below)
> is supposed to accept the filenames to delete in $value[$i] and delete them.

Check the manual in perlfunc under the heading
"Functions for filehandles, files, or directories".

Hekan Hjelmstrvm
hawk@algonet.se


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

Date: Mon, 4 May 1998 12:36:46 GMT
From: Brent Michalski <perlguy@inlink.com>
To: ananta@w-o-i.com
Subject: Re: How can I delete a file from my perl program
Message-Id: <354DB65E.847DB319@inlink.com>

>>I am using IIS3.0 (NT4.0) with Perl for win32
>> ...
>>system('rm $value[$i]'); }

rm is NOT an NT command!  Try changing the rm to del and see what
happens.

HTH,

Brent


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

Date: Mon, 04 May 1998 11:44:42 GMT
From: hawk@algonet.se (Hakan Hjelmstrom)
Subject: Re: How many files can I open?
Message-Id: <354fa9b0.78546774@news.algonet.se>

On Mon, 04 May 98 07:50:37 GMT, Hans Xie wrote:
> It looks like I can only open 60 files for writing.  When I try to open more, 
> the file is not created, and no complain information send back!
> How to get beyond this limits?  I need to open about 200 files for writing.
> I am using PERL 5.004_04 on Solaris 2.5

Not sure if this will do it since my experience with Solaris 2.5 is
limited but I spotted this little module in the docs:

"FileCache - keep more files open than the system permits"

Sounds promising, doesn't it?

Hekan Hjelmstrvm
hawk@algonet.se


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

Date: Mon, 4 May 1998 07:14:05 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How many files can I open?
Message-Id: <debki6.anl.ln@localhost>

Hans Xie (hans.xie@its.csiro.au) wrote:

: It looks like I can only open 60 files for writing.  When I try to open more, 
: the file is not created, and no complain information send back!

: How to get beyond this limits?  I need to open about 200 files for writing.

: I am using PERL 5.004_04 on Solaris 2.5


The number of file descriptors allowed is determined by your
Operating System, not by Perl.

You might want to try asking in a Solaris newsgroup.


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


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

Date: Mon, 04 May 1998 22:48:15 +1000
From: patrick <netset@powerup.com.au>
Subject: Include libs from current CGI path NT4 IIS4??
Message-Id: <354DB90E.27BE21B2@powerup.com.au>

Can anyone help me with this problem.
I am running NT 4 with IIS4 and Activestate Perl5.
Everything is fine under the command prompt.

Problem:
My Perl CGI script will not include .pm files from the same directory as
the script itself resides.

I have done all the req installation (REG etc) and CGI scripts that
don't call libraries in the same directory as the script (and just call
libs in the @INC ) work
I believe this can work without me adding each of my cgi-bin paths to
the @INC.

Please Help...

Patrick




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

Date: Mon, 04 May 1998 04:05:18 -0600
From: poster@prm.se
Subject: Input to programs
Message-Id: <6ik0ce$6ic$1@nnrp1.dejanews.com>

Hello

I have a problem that I can't seem to find the answer to anywhere.

What I'm trying to do:
I have to unzip crypted zip-files in Unix.
>From the command-line, after I started unzip, it stops and waits for the
password. There are no command-line arguments for passwords. I want the
perl-script to insert the password at the appropriate time.

The order of work is something like this:
1. Take all the crypted files into an array.
2. Make an unzip on all the files in the array. All files are encrypted with
the same password.

What I'd like to know:
How to give the password (string) to the (any) program when its waiting for
input.

This will normally give security problems but everything will run in a very
secure environment.

I hope I managed to explain myself :-)

Thanks in advance

Peter Olsson
Software Tech.
Svenska Torget, Sweden

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Mon, 4 May 1998 10:14:54 +0200
From: "Ronald G\"oggel" <r.goeggel@atos-group.de>
Subject: Re: Length of a variable
Message-Id: <6ijtg1$pvg$1@news.pop-stuttgart.de>


niting@cyberdude.com writes
>Is there any function in PERL which will return the length of a
variable?
>
>e.g:
>
>$foo = "hello";
>
>length of $foo is 5 (numeric)
>
length    $foo;





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

Date: 04 May 1998 12:18:07 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Length of a variable
Message-Id: <7xiunms5k0.fsf@beavis.vcpc.univie.ac.at>

Re: Length of a variable, niting <niting@cyberdude.com>
said:

niting> Is there any function in PERL which will return the
niting> length of a variable?  e.g:

You mean: length of an expression in a string context.

niting> length of $foo is 5 (numeric)
        ^^^^^^
perldoc -f length

tony


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

Date: 04 May 1998 14:31:29 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Length of a variable
Message-Id: <oeepvhuxofi.fsf@alpha.hut.fi>


niting@cyberdude.com writes:

> 
> Is there any function in PERL which will return the length of a variable?
> 
> e.g:
> 
> $foo = "hello";
> 
> length of $foo is 5 (numeric)

Is this a trick question?  Or are your forbidden to read the documentation?
Or forbidden to try out code?  Hint: you already answered your own question.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Mon, 04 May 1998 13:08:31 +0200
From: Tim Mueller-Seydlitz <Tim.Mueller-Seydlitz@dresdner-bank.com>
Subject: magic <> and Term::ReadLine::Gnu
Message-Id: <354DA1AE.9FBA8FFF@dresdner-bank.com>

Hi,
I am writing a program that shall have a shell like interface for users
and/or shall be used in a pipeline of processes.

This behavior is easily achieved if I use the line input (angle)
operator <>; but to make the user interface more comfortable, I would
like to use the Perl portation (Term::ReadLine::Gnu) of the ReadLine
library.
How can I switch between the ReadLine library and <>?
How can I check how the program got called?

Either as a filter:

cat input | program
program < input

or as an interactive program:

program


Any ideas?
TIM





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

Date: Mon, 04 May 1998 12:40:28 GMT
From: Tony Bowden <tony@blackstar.co.uk>
Subject: Making a package more efficient
Message-Id: <894289237.569936@sparc.tibus.net>

For an on-line video shop I have a package which gets called to 'study'
all the info on a particular video stored in the database. This is done
via a series of SQL calls when the package is called with
  $vid = new BlackStar::Video::Study $id # $id = unique ID of that video.
(code is below)

Now this works fine, but is very wasteful if, for instance, I _only_
wanted to know the title of the video.

So, how do I go about breaking all the queries off into seperate subs
(find_title, find_plot etc), so that a script which calls $vid->title
doesn't need to make both SQL queries, but also that a script which
does $vid->plot followed by $vid->blurb doesn't need to do the same SQL
query twice?

Anyone any tips, or pointers to examples of this sort of thing on CPAN
or somewher in the docs that I've missed?

Tony

-- Sample (working) code

   package BlackStar::Video::Study;
   use Carp;
   use Mysql;

   sub new {
     my $class = @_ ? shift : 'BlackStar::Video';
     @_ == 1 or croak "usage: new $class ID";
     my $id = shift;
     my %info;
     my $dbh = Mysql->connect || return; $dbh -> selectdb("blackstar");
     my ($query,$sth,%matched);

     $query = "SELECT title FROM titles WHERE titleid = '$id' ";
     $sth = $dbh->query($query); %matched = $sth->fetchhash;
     $info{TITLE} = $matched{'title'};

     $query = "SELECT plot,blurbs FROM plots WHERE titleid = '$id' ";
     $sth = $dbh->query($query); %matched = $sth->fetchhash;
     $info{PLOT} = $matched{'plot'};
     $info{BLURB} = $matched{'blurb'};

     # lots more similar queries here to fetch the remaining info

     bless [\%info], $class;
   }

   sub title       { my $self = shift; $self->[0]->{TITLE}; }
   sub plot        { my $self = shift; $self->[0]->{PLOT}; }
   sub blurb       { my $self = shift; $self->[0]->{BLURB}; }
   # etc...

---

--
-----------------------------------------------------------------------------
 Tony Bowden |  tony@tmtm.com / NooNoo@teletubbies.org / http://www.tmtm.com/
 Belfast, NI |                       you are a free moth - go chase the light
-----------------------------------------------------------------------------



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

Date: Mon, 04 May 1998 13:03:46 +0200
From: Dieter Stolpmann <Dieter_Stolpmann@hp.com>
Subject: Max length of a string
Message-Id: <354DA092.1D9E9E1C@hp.com>

I need to analyse a huge file (up to 50MByte or more) which I have
to read from STDIN. To make working/passing the file more easy to me,
I would like to read it into a single string at the beginning of my program insteat of reading it
line by line.

Is there a limit in the string size, or any other major performance hit
doing so? Anything else to watch out for?

Thanks for help
Dieter


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

Date: Mon, 04 May 1998 10:41:53 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: PErl Functions
Message-Id: <354D99B6.5DA4C0BD@fccjmail.fccj.org>

Jonathan Feinberg wrote:
> 
> Ronald J Kimball <rjk@coos.dartmouth.edu> writes:
> 
> > Destini T. Butler wrote:
> > >
> > > what does the Perl built in function "die" do?  and what is the snytax and
> > > synopsis for this function
> >
> > die LIST
> >         die() takes a list of users who post questions that are clearly
> >         answered in Perl's documentation and instructs each of them to
> >         die.  Returns the number of users that followed the instruction.
> 
> Hmm.  Perhaps you ought to consider warn().  At any rate, as with
> alarm/sleep, die() doesn't work well with confess().  HTH.
> 
> --
> Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY

LOL :-)

Especialy since the Bush administration and all those new
computer laws fobidding it :-)
-Sneex- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: 4 May 1998 08:47:19 GMT
From: mercuryz@mail.alabanza.com (MercuryZ)
Subject: Perl Randomness Question..any pointers?
Message-Id: <6ijvan$54r@suriname.earthlink.net>

Hello all....I am creating an online text adventure in perl
that includes character data and storage, hitpoints, monsters,
etc....most of the code is already complete and working but I 
still need to flesh out the rooms.  What I need, if someone
could either tell me or point to a site with relevant information,
is how to randomize an html file.  What I mean by this is that
if the character goes north, the file is area1_1a.cgi and of
course shows up in the address field. Is it possible to have
the address field show 12we4rf.cgi and still point to area1_1a.cgi?

If you don't want to clutter up the newsgroup email me at 
mercuryz@mail.alabanza.com or simply post your reply
for other interested readers.  

I appreciate all responses....many of you pros have helped
me out considerably time and time again.

Thanks, Sean



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

Date: 4 May 1998 08:46:57 GMT
From: mercuryz@mail.alabanza.com (MercuryZ)
Subject: Perl Randomness Question..any pointers?
Message-Id: <6ijva1$54r@suriname.earthlink.net>

Hello all....I am creating an online text adventure in perl
that includes character data and storage, hitpoints, monsters,
etc....most of the code is already complete and working but I 
still need to flesh out the rooms.  What I need, if someone
could either tell me or point to a site with relevant information,
is how to randomize an html file.  What I mean by this is that
if the character goes north, the file is area1_1a.cgi and of
course shows up in the address field. Is it possible to have
the address field show 12we4rf.cgi and still point to area1_1a.cgi?

If you don't want to clutter up the newsgroup email me at 
mercuryz@mail.alabanza.com or simply post your reply
for other interested readers.  

I appreciate all responses....many of you pros have helped
me out considerably time and time again.

Thanks, Sean



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

Date: Mon, 4 May 1998 04:05:30 +0100
From: "Tan" <tan@jettech.dircon.co.uk>
Subject: Perl2Exe file for Unix?
Message-Id: <354d8bb7.0@newsread1.dircon.co.uk>

Is there any way that I can convert a Perl script into an executable under
unix? Basically I am developing some code and would prefer it if people
couldn't see the underlying Perl script. I am using HPUX 9 & 10.

Would be grateful for any help received.

Tan





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

Date: Mon, 04 May 1998 12:24:36 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: s///g skips possible matches
Message-Id: <354db1f0.17648391@news.tornado.be>

I've noticed that my current Perl port (5.004001, I think) displays odd
behaviour, that could very well be a regexp engine bug.

I can't run PERLBUG from my computer. But there might be something wrong
with my regexp. :-). Can you people take a look?

#! perl
$_ = "I need a {title} and a {body}. Or a {body} and a {title}.\n";
%hash = ( title => 'TITLE', body => 'BODY' );
{ local ($_) = $_;
   # this one does what it should
   s/\{(\{|(\w+))\}/defined $2? $hash{$2}:$1/ge;
   print; 
}
{ local($_)=$_;
   # this one skips possible matches!
   # only difference: inserted '\=?' in regexp.
   # replacing this with other optional fields has the same effect.
   # even adding extra parentheses doesn't do any good.
   s/\{(\{|(\w+)\=?)\}/defined $2? $hash{$2}:$1/ge;
   print;
}
__END__
Result:
I need a TITLE and a BODY. Or a BODY and a TITLE.
I need a {title} and a BODY. Or a {body} and a TITLE.

	Bart.


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

Date: Mon, 4 May 1998 11:13:39 GMT
From: Brent Michalski <perlguy@inlink.com>
To: Mike Brown <mike@emporium-antiques.co.uk>
Subject: Re: Simple Perl Databases
Message-Id: <354DA2E3.C97199E1@inlink.com>

Mike,

Actually it is just Brent, my parents condemned me to my middle name ;-)

I was thinking, scary, and you say you are on an NT system.  On NT
systems, you need to provide the FULL path to the file, I also include
the drive letter but don't know if it is necessary.  

So, in search.pl you line that reads:

&search("phonebk.dat","simple");

Should read:

&search("d:/inetpub/scripts/phonebk.dat","simple");  

Or wherever your true path to the phonebook.data file is.  This
modification is needed in all of the scripts that reference the data
file.  Also, your "require" statements need the same thing done to them.

For a while, I had the script ported over to NT and these were the only
changes I had to make.

Try it out and let me know if it helped...

Brent


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

Date: Mon, 04 May 1998 10:35:30 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: Strange problem.
Message-Id: <354D9837.3449DA72@fccjmail.fccj.org>

Bob Tate wrote:
> 
> Bill,
> 
> It was not that Perl did not like the leading spaces.  In fact, Perl could
> care less it the first character was a space.  It is Unix.  Unix, like Dos,
> does not allow the first character to be a space.  When I converted all the
> leading spaces to zeros, it worked fine.

Hmmm, spaces in Unix are a pain, but not if you know they are possible.
Just about any character can used for a filename in Unix.  I have even 
created 'hidden' logins using funny characters - which all tend to sort
higher, if not at the top, in directory listings...

:-)
-Sneex- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: 4 May 1998 10:10:25 GMT
From: mercuryz@mail.alabanza.com (MercuryZ)
Subject: to arch...sorry for the lack of a RE but problems with news server
Message-Id: <6ik46h$4im@chile.earthlink.net>

www.perl.com
www.cgi-resources.com
www.worldwidemart.com
www.cpan.org

Get the "learning perl" book by Randal L. Schwartz and the advanced 
perl book by the company.  Also, and exhaustive Perl book is the 
"Perl 5 interactive course" by the waite group. Lastly,
the Perl Cookbook by Tom Christiansen is one of the best
out there.  Good luck...Perl is one of the most flexible languages 
out there so have fun.



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

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

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