[9602] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3196 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 19 01:07:22 1998

Date: Sat, 18 Jul 98 22:00:22 -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           Sat, 18 Jul 1998     Volume: 8 Number: 3196

Today's topics:
    Re: Can be hashes tied to .dbm a.s.o be arbitrarily com <mpersico@erols.com>
    Re: Choosing DBMS: friendly to Linux, Apache, Perl, Jav (Milton)
    Re: Choosing DBMS: friendly to Linux, Apache, Perl, Jav (Milton)
    Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. p <mpersico@erols.com>
        HELP - MS personal web server and cgi <dales@enhanced-performance.com>
        How can I use a $ in s///? <worms2@centralnet.ch>
    Re: How can I use a $ in s///? (Ronald J Kimball)
    Re: How can I use a $ in s///? (Larry Rosler)
    Re: How can I use a $ in s///? (Larry Rosler)
    Re: How do I clear an array? (Ronald J Kimball)
    Re: How do I clear an array? (Larry Rosler)
    Re: How to interprete What Sucks/Rules? <mpersico@erols.com>
    Re: I'm baffled.. (and an amateur:) (Ronald J Kimball)
    Re: Lex for Perl / Object Dumper? <mpersico@erols.com>
        multiple forks??? <spence79@pilot.msu.edu>
    Re: NEED HELP: copydir function for Win95/WinNT scott@softbase.com
    Re: Oh man, DO I love Perl ! (References to things that <mpersico@erols.com>
    Re: Parsing Perl <mpersico@erols.com>
    Re: Perl Beautifier Home Page <rra@stanford.edu>
    Re: Perl CGI's under Windows NT <*clinton@consol.co.uk>
    Re: Problem with interpolation in 'exec' command <bericson@geocities.com>
    Re: Program to give day of the week from given date <melinda@acm.org>
    Re: Regular expressions and HTML (Earl Hood)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Sat, 18 Jul 1998 23:40:18 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: ws97-868@wsrz1.wiso.uni-erlangen.de
Subject: Re: Can be hashes tied to .dbm a.s.o be arbitrarily complex?
Message-Id: <35B16AA2.8F5CDB8D@erols.com>

Franz Kaufmann wrote:
> 
> Hello,
> 
> I recently wondered whethe ,when I tie a hash to a dbm or other database
> file,whether this hash needs to be straight KEY=>SCALAR or if it can
> contain KEY<->VALUE pairs where VALUE can be a arbitrary data type,e.g
> another hash or a 2d-array or a glob or a reference or.. you get it.
> 
> Does anyone know this?
> Thank you in advance.

The short answer is yes, it can be done. 

The medium answer is the big problem is serializing the VALUE to
something that can be written out in ascii to a DBM file and then
properly reinterpreted on the way back in. Try the MLDBM package. SHould
be at CPAN.

The long answer can be found in Chapter 10 of Advanced Perl Programming,
ISBN 1-56592-220-4. I just read that chapter over breakfast this morning
and that's where the MLDBM solution, with others, came from. Run, don't
walk, to your nearest respectible computer book store and spend the
$35.00. It's worth it.

And no, I am not the author or publisher; I get no money.


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

Date: Sat, 18 Jul 1998 23:12:28 GMT
From: m.hewitt@worldnet.att.net (Milton)
Subject: Re: Choosing DBMS: friendly to Linux, Apache, Perl, Java
Message-Id: <6ora2d$ldo@bgtnsc02.worldnet.att.net>

At precisely, Fri, 10 Jul 1998 17:36:32 -0400
ID: <35A68960.67D8@ictgroup.com>
Newsgroup: news:comp.databases

Jerry Gitomer proclaimed:

>Hi Gordo,
>
>I used Interbase in the past and found it to be a very solid product.  I
>used to use my Oracle manuals (since I preferred them to the Interbase
>manuals) so I can assure you that it is very compatible with Oracle (at
>least at the SQL level).
>
>OLTP performance is competitive with Oracle, Informix, and Sybase.
>
>From what I remember the company was founded and developed an RDBMS
>product.  They were acquired by Ashton-Tate which, in turn, was acquired
>by Borland.  Since, at the time, Interbase was a Unix product and
>Borland was a PC company Borland tried to sell Interbase (which upset
>the user community).  Fortunately Borland finally realized that they had
>a first class product and instead decided to make it the basis for their
>high end database products.  

Here's the history that I have been able to find:
(inacuracies are strictly my own)

InterBase was originally conceived and created by a group of former Digital
Equipment Corporation [DEC] employees out of a desire to produce an
innovative RDBMS that offered substantially greater benefits than other
existing databases. InterBase began in 1985 as Groton Database Systems and
was shortly thereafter renamed InterBase. It was purchased by Ashton Tate
in 1991. Borland acquired InterBase in 1992 as part of its takeover of
Ashton Tate. Throughout its development, InterBase has consistently
introduced a number of technological firsts. Among these are
Multi-Generational Architecture, Automatic Two Phase Commits, Database
Shadowing, Binary Large Objects [BLObs], Sparse Bit Mapped Indexes,
Multi-dimensional arrays, Event Alerters and the first native JDBC driver.
     Most existing RDBMS systems fail to offer equivalent technologies. For
instance, the SQL Server architecture utilizes a combination of page, table
and index locks in order to maintain data concurrency. SQL Server supports
two phase commits but requires extensive code to manage the commit and
rollback sequence. SQL Server offers BLOb access but it is limited in scope
and is substantially slower than BLOb access in InterBase.

I hope this helps
-- 
+++++++++++++++++++++++++;;;;;;;;;;;;;;;;;;;;;;;;;;
 Milton B. Hewitt                     
 CAUCE Member - http://www.cauce.org  
 Proud supporter of the Microsoft Boycott Campaign 
 http://www.vcnet.com/bms/
+++++++++++++++++++++++++;;;;;;;;;;;;;;;;;;;;;;;;;;


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

Date: Sat, 18 Jul 1998 23:32:27 GMT
From: m.hewitt@worldnet.att.net (Milton)
Subject: Re: Choosing DBMS: friendly to Linux, Apache, Perl, Java
Message-Id: <6orb7r$ldo@bgtnsc02.worldnet.att.net>

At precisely, Fri, 10 Jul 1998 14:44:48 GMT
ID: <6o59d0$8nl$1@nnrp1.dejanews.com>
Newsgroup: news:comp.databases

gordo@pclink.com proclaimed:

>Thanks. Do you know anything of INterbase's history and product development
>trajectory?

Here's the history
http://www.dbmsmag.com/9607d17.html

Only GOD knows the trajectory.
-- 
+++++++++++++++++++++++++;;;;;;;;;;;;;;;;;;;;;;;;;;
 Milton B. Hewitt                     
 CAUCE Member - http://www.cauce.org  
 Proud supporter of the Microsoft Boycott Campaign 
 http://www.vcnet.com/bms/
+++++++++++++++++++++++++;;;;;;;;;;;;;;;;;;;;;;;;;;


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

Date: Sat, 18 Jul 1998 23:51:10 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Uri Guttman <uri@sysarch.com>
Subject: Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. print)
Message-Id: <35B16D2E.5307AD8D@erols.com>

The sarcastic answers:

> 1. Who is main the PERSON you should think about while you are writing code?

The PERSON who pays the contract.
 
> 2. Other than comments, what is the most important HUMAN aspect of code?

The ability to read it six months down the line so you can come back and
bill more hours to fix the bugs YOU introduced in the first place.

> 3. What is the main PURPOSE of comments?

To faciliate point #2. But then, you'd want to write them in such a way
that only YOU would understand them. In this manner, if a staff
programmer tries to fix your bugs, they'll fail. Then see #2.

Disclaimer: These are not my practices OR the practices of anyone I knew
before or know now. I'm just trying to be funny.

> Bonus: What is the OPPOSITE of spaghetti code?

Ravioli code. Each ravioli is a perfect black box. Throe them all into a
system (dish) with the proper interfacing (sauce) and voila!


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

Date: Sun, 19 Jul 1998 03:28:37 GMT
From: Dale Sutcliffe <dales@enhanced-performance.com>
Subject: HELP - MS personal web server and cgi
Message-Id: <35B167BF.EB15D86F@enhanced-performance.com>

How do I configure personal web server to accept cgi scripts?




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

Date: Sun, 19 Jul 1998 02:16:29 +0200
From: Thomas Volkmar Worm <worms2@centralnet.ch>
Subject: How can I use a $ in s///?
Message-Id: <35B13ADD.53DE2FBC@centralnet.ch>

Hi,
I am trying to write a programm which escapes some characters in a
textfile with an @-character.

How do I characters like $ * ( ) + [ and ] with s/// ?

Regards,
Thomas

This is what I programmed until now:
==============================================================================
@rep=("@","!","#","%","&","{","}","-","=",",",";",
      "<",">","/");

# Missing in list rep: $ * ( ) + [ ] 

@ARGV = ('-') unless @ARGV;
foreach $argv (@ARGV) {

    open(FILE, "$argv") or die "File not found: $!\n";
    open(oFILE, ">x$argv") or die "File not found: $!\n";
    print "\nPREPTEXT: preparing file $argv ...";

    while(<FILE>){
	foreach $c (@rep){
	    s/$c/$rep[0]$c/g;
	}
	
	#Some Word-codes
	tr/\204/"/;
        tr/\223/"/;
	tr/\224/"/;
	tr/\222/\047/;
	tr/\221/\047/;
	
	print oFILE $_;
    }
}



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

Date: Sat, 18 Jul 1998 22:24:33 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: How can I use a $ in s///?
Message-Id: <1dcdv6d.171j5sj1mqsqdyN@bay1-197.quincy.ziplink.net>

Thomas Volkmar Worm <worms2@centralnet.ch> wrote:

> How do I characters like $ * ( ) + [ and ] with s/// ?

You're off to a good start by realizing that those characters are all
regex metacharacters, so you have to treat them specially.  You can
match the literal characters by preceding them with a backslash:
s/\$/dollar/, for example.

With your script, you could do this in one of two ways.

Add the backslash when you create the array:
@rep = ('\$', '\*', '\(', ...);

Add the backslash when you use the regex:
s/\Q$c\E/replace/;

Look up \Q in perldata, and also quotemeta in perlfunc.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sat, 18 Jul 1998 19:29:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How can I use a $ in s///?
Message-Id: <MPG.101af9fb7eede08a98975a@nntp.hpl.hp.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <35B13ADD.53DE2FBC@centralnet.ch> on Sun, 19 Jul 1998 02:16:29 
+0200, Thomas Volkmar Worm <worms2@centralnet.ch> says...
> Hi,
> I am trying to write a programm which escapes some characters in a
> textfile with an @-character.
> 
> How do I characters like $ * ( ) + [ and ] with s/// ?
> 
> Regards,
> Thomas
> 
> This is what I programmed until now:
> ==============================================================================
> @rep=("@","!","#","%","&","{","}","-","=",",",";",
>       "<",">","/");
> 
> # Missing in list rep: $ * ( ) + [ ] 
> 
 ... 
>     while(<FILE>){
> 	foreach $c (@rep){
> 	    s/$c/$rep[0]$c/g;
> 	}

This is hideously slow, as you are compiling a regex for every character 
in your list and for every line in the input.  It can be done directly by 
including the characters in a character class.  Within the character 
class, the characters lose most of their metacharacter meanings.  It ends 
up like this:

       s/([@!#%&{}\-=,;<>\/$*()+[\]])/\@$1/g;

where the only characters with special meanings are '-' (range, though 
that could be fixed by making it the last character in the class), '/' 
(regex delimiter, though that could be fixed by changing the delimiter, 
to '|' for example), and ']' (end-of-class delimiter, though that could 
be fixed by making it the first character in the class).  Without escapes 
(except on the @ in the substitution, which is needed to prevent it being 
interpreted as a request to interpolate an array):

       s|([]@!#%&{}=,;<>/$*()+]-])|\@$1|g;

> 	#Some Word-codes
> 	tr/\204/"/;
>         tr/\223/"/;
> 	tr/\224/"/;
> 	tr/\222/\047/;
> 	tr/\221/\047/;

This could be done in one line also:

       tr/\204\223\224\222\221/"""\047\047/;

You will find all this in `perldoc perlre`.  Good luck with it.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 18 Jul 1998 21:57:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How can I use a $ in s///?
Message-Id: <MPG.101b1c763429fb9998975c@nntp.hpl.hp.com>

In article <MPG.101af9fb7eede08a98975a@nntp.hpl.hp.com> on Sat, 18 Jul 
1998 19:29:54 -0700, Larry Rosler <lr@hpl.hp.com> says...
 ...
> This is hideously slow, as you are compiling a regex for every character 
> in your list and for every line in the input.  It can be done directly by 
> including the characters in a character class.  Within the character 
> class, the characters lose most of their metacharacter meanings.  It ends 
> up like this:
> 
>        s/([@!#%&{}\-=,;<>\/$*()+[\]])/\@$1/g;
> 
 ...
> 
>        s|([]@!#%&{}=,;<>/$*()+]-])|\@$1|g;

Reposted to correct a couple of problems in the regex, and to provide a 
Benchmark.

#!/usr/local/bin/perl -w
use Benchmark;

@rep = qw( @ ! # % & { } - = , ; < > / $ * ( ) + [ ] );

timethese(1 << (shift || 0), {
    'Class' => sub { $_ = ']x' x 20; s|([]@!#%&{}=,;<>/$(*)+-])|\@$1|g },
    'Orig'  => sub { $_ = ']x' x 20;
        foreach my $c (@rep) { s/\Q$c/\@$c/g } },
});

Benchmark: timing 4096 iterations of Class, Orig...
     Class: 15 secs ( 2.86 usr  0.04 sys =  2.90 cpu)
      Orig: 27 secs ( 6.99 usr  0.02 sys =  7.01 cpu)
 
Well, not as hideously slow as I expected, but still poor compared to the 
character-class approach.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 18 Jul 1998 20:34:44 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: How do I clear an array?
Message-Id: <1dcdph3.1xne7e1lv8esaN@bay2-83.quincy.ziplink.net>

Craig Berry <cberry@cinenet.net> wrote:

> Not true (to my way of thinking).  'undef @array' says "I'm entirely done
> with @array; nuke it," while '@array = ()' says "@array is still around,
> it just doesn't contain anything right now."  That's a big (semantic)
> distinction.  And if I mean "it's empty now" but use undef to get there, I
> get "use of undefined value" warnings (quite properly).

I wasn't able to reproduce this behavior.  Could you post a bit of code
that shows how @array = () gives different warnings than undef @array?

Here's what I tried.  When printing the entire array, I got no warning
in either case.  When printing the first element in the array, I got a
warning in both cases.

#!perl -w

@array = (1, 2, 3);

print "@array\n";
print "$array[0]\n";

@array = ();

print "@array\n";
print "$array[0]\n";  # line 11

@array = (1, 2, 3);

print "@array\n";
print "$array[0]\n";

undef @array;

print "@array\n";
print "$array[0]\n";  # line 21
__END__
1 2 3
1

Use of uninitialized value at tmp line 11.

1 2 3
1

Use of uninitialized value at tmp line 21.


-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sat, 18 Jul 1998 21:06:05 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I clear an array?
Message-Id: <MPG.101b1087123b34e398975b@nntp.hpl.hp.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <1dcdph3.1xne7e1lv8esaN@bay2-83.quincy.ziplink.net> on Sat, 18 
Jul 1998 20:34:44 -0400, Ronald J Kimball <rjk@coos.dartmouth.edu> 
says...
> Craig Berry <cberry@cinenet.net> wrote:
> 
> > Not true (to my way of thinking).  'undef @array' says "I'm entirely done
> > with @array; nuke it," while '@array = ()' says "@array is still around,
> > it just doesn't contain anything right now."  That's a big (semantic)
> > distinction.  And if I mean "it's empty now" but use undef to get there, I
> > get "use of undefined value" warnings (quite properly).
> 
> I wasn't able to reproduce this behavior.  Could you post a bit of code
> that shows how @array = () gives different warnings than undef @array?

I tried evaluating 'scalar @array' and $#array, and got 0 and -1 
respectively in each case as expected, but no 'use of undefined' warning 
for the undef case.  I'm surprised.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 18 Jul 1998 23:56:15 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Josh Kortbein <kortbein@iastate.edu>
Subject: Re: How to interprete What Sucks/Rules?
Message-Id: <35B16E5F.76ABA26D@erols.com>

Josh Kortbein wrote:
> 
> Yong Huang (yong@shell.com) wrote:
> : At http://www.tpj.com/tpj/rules/ and
> : http://electriclichen.com/linux/srom.html, it talks about What
> : Sucks/Rules. But the article is not clear as to the criterion. Seems the
> : result comes from a Web search for "XXX rules" and "XXX sucks" strings
> : and count them. Can anybody explain? The fact that Java sucks even more
> : than Visual BASIC seems to counteract most people's impression.
> 
> Perhaps some normalization is in order. There are probably simply
> more people talking about Java sucking. :)
> 
Maybe VB has sucked for so much longer than Java has had the change to
that VB people are numb and just don't bother complaining anymore.


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

Date: Sat, 18 Jul 1998 20:34:46 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: I'm baffled.. (and an amateur:)
Message-Id: <1dcdppu.1krngv91dcue6aN@bay2-83.quincy.ziplink.net>

JFR <jeremiah@ganymede.net> wrote:

> In order to delete an entry from the file, you would select the entry
> you want to delete from a pulldown menu (1 entry on each line), then
> press the Delete submit button.  Once the delete button is pressed, it
> should delete the appropriate line -- but it doesn't.  It seems to
> reload the HTML form, instead.  I figured maybe my if param('action')
> line is resulting false, or. . I dunno, actually.  :/

Perhaps that's because you print the form before checking the value of
param('action')?  (By the way, the code you posted uses param('submit').
You might want to check that.)  I wonder if you were to look at the
source after attempting a delete, whether you would see to sets of HTML
tags...

Here's a tip: you might need to wrap *both* sets of prints in the blocks
of an if statement.  :-)

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sat, 18 Jul 1998 23:59:26 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Paul <swoboda@uvic.ca>
Subject: Re: Lex for Perl / Object Dumper?
Message-Id: <35B16F1E.CD47AF97@erols.com>

I always assumed that the only thing that could parse Perl was Perl
itelf.

And of course, Larry.

 :-)

Paul wrote:
> 
> Andrew M. Langmead wrote:
> 
> > Have you thought of making an XS module that includes the C code
> > output by lex? I think all you would need is a C yyparse() that
> > converted its tokens to perl variables and called perl's yyparse().
> > --
> > Andrew Langmead
> 
> Yes, but that's just so...  IMPURE.  I like to do as much as possible
> in Perl and nothing else.  Actually, after I had to make a few changes
> to the same lexer yesterday, I decided to re-write the whole thing in
> Parse::Lex.  I hope that Parse::Lex comes standard in the next official
> Perl release.
> 
> PS
> .


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

Date: Sat, 18 Jul 1998 22:30:28 -0400
From: "AJS" <spence79@pilot.msu.edu>
Subject: multiple forks???
Message-Id: <6orlcu$4b4$1@msunews.cl.msu.edu>

Hey All:

I am wondering how I can spawn multiple children from 1 parent?  I am
comfortable with one child process, but multiple is giving me problems.  I
want to run a synchronous row/column sort on a matrix.  Any basic multiple
process pointers would be great.

Thanks

AJS
Michigan State University
E. Lansing Michigan





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

Date: 18 Jul 1998 21:42:38 GMT
From: scott@softbase.com
Subject: Re: NEED HELP: copydir function for Win95/WinNT
Message-Id: <6or4se$dk0$2@mainsrv.main.nc.us>

David Morris (dbm@cadence.com) wrote:

> *or*, some help with a crafted piece of code.

Use zip.

	chdir($whereever);
	system("zip -r whereever $whereever");
	chdir($newdir);
	system("unzip whereever $newdir");
	unlink("whereever.zip");

Use the -r to copy the directory structure.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Sun, 19 Jul 1998 00:02:40 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: David Coldrick <davidc@selectst.com>
Subject: Re: Oh man, DO I love Perl ! (References to things that go out of scope)
Message-Id: <35B16FE0.684EE43B@erols.com>

For the uninitiated, could you supply the title ad maybe the ISBN. I
fear that asking for "Nigel Chapman's" book at your local comupter book
seller might not cut it.

David Coldrick wrote:
> 
> John Chambers wrote:
> 
> <snip>
> 
> I have written several 1000+ perl programs, and I've
> > OOified some parts of some of them.  But in looking back, I can't
> > really say that it has ever been a big win.  The code is much more
> > opaque than before, and I'm the only one that understands why I
> > wasted all that time just making the code harder to read.  And in
> > most cases, the resulting code has run slower, for reasons that I
> > don't quite fathom.
> >
> > Also, OO is much more difficult to learn and debug.  The perl debugger
> > seems to have problems with it: "my" variables always come up null,
> > references display as hex values, and so on.  You are pretty much reduced
> > to the old "add another print" to find out what's gone wrong.  So it's
> > easy to write something first in a non-OO fashion, so you can use the
> > debugger.  And then, once you've got it running, you think that you
> > should redo it in OO style, but you have other tasks that are higher
> > priority, so it gets put aside for now ...
> 
> <snip>
> 
> Nigel Chapman's book has an excellent section on OO in Perl, the example
> in which really nicely demonstrates the value of the approach. He also
> discusses his earlier similar apprehension about the value of OO, and
> how well it works out in so many situations. Worth a read!
> 
> Regards,
> David


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

Date: Sun, 19 Jul 1998 00:04:55 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Parsing Perl
Message-Id: <35B17067.BEEF6658@erols.com>

Dan Schmidt wrote:
> 
> It appears that the only program that is sufficiently sophisticated to
> parse Perl code is perl itself.
> 

C-Perl in xemacs sure isn't. But it does work 95% of the time. That's
better than I do when I read it! <grin>


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

Date: 18 Jul 1998 20:09:04 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl Beautifier Home Page
Message-Id: <m3yatqa65r.fsf@windlord.Stanford.EDU>

Zenin <zenin@bawdycaste.org> writes:
> Russ Allbery <rra@stanford.edu> wrote:

>> It's *definitely* not.  There's no reason whatsoever to use more than
>> 80 columns.

> $VERSION = do { my @r = (q$Revision: 2.0 $ =~ /\d+/g); sprintf '%d.%03d'.'%02d' x ($#r-1), @r};

> 	Try putting that on multiple lines.  Hint: check with MakeMaker.

That's unnecessarily long for most people's version numbers.  Try this
instead.  :)

($VERSION = (split (' ', q$Revision: 1.2 $ ))[1]) =~ s/\.(\d)$/.0$1/;

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Sun, 19 Jul 1998 00:05:08 +0100
From: "Clinton Gormley" <*clinton@consol.co.uk>
Subject: Re: Perl CGI's under Windows NT
Message-Id: <6ora15$6am$1@taliesin.netcom.net.uk>

When I tried to do this with Personal Web Sever under Win95, Microsoft told
me that PWS wouldn't run Perl scripts. Don't know about NT?

Why not use IIS?

kanak@pobox.com wrote in message <6or7vh$fgl$1@nnrp1.dejanews.com>...
>Hi,
>
>If I'm in the wrong group, I apologize, and would appreciate it if someone
>would be able to direct me to a more appropriate group.
>
>I've been having a problem getting Perl scripts to run as cgi's under
Windows
>NT with Micro$oft Personal Web Server. The .pl files and .cgi files run
fine
>by hand.  But when launched from the web server, the symptom is that the
web
>server will try to do an http transfer of a .pl file, and will whine about
>the .cgi file with a "%1 is not a valid Windows NT application.".
>
>-My two local guru's remember having this problem but don't remember how to
>get around it!
>
>-All directories in the Personal Web Server are checked execute.
>
>-I've added d:\perl\bin\perl.exe %s %s to
>My Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet
>\Services\W3SVC\Parameters\ScriptMap for .plx, .pl and .cgi
>
>-I've manually associated .pl and .cgi with the perl binary
>-I've run a little registry script like this:
>REGEDIT4
>
>[HKEY_CLASSES_ROOT\.PL]
>@ = "PL_auto_file"
>
>[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PL_auto_file]
>@ = ""
>
>[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PL_auto_file\shell]
>
>[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PL_auto_file\shell\open]
>@ = ""
>
>[HKEY_CLASSES_ROOT\PL_auto_file\shell\open\command]
>@ = "\"D:\\perl\\bin\\perl.exe\" %1 %*"
>
>
>Please if anybody has any ideas for this, I'd really like to know!
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




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

Date: Sun, 19 Jul 1998 00:49:39 +0000
From: Bryan Ericson <bericson@geocities.com>
Subject: Re: Problem with interpolation in 'exec' command
Message-Id: <35B142A2.1036EC8@geocities.com>

Bryan Ericson wrote:

> Hello all
>
> I seem to be having a strange problem with Perl's 'exec' command.  I'm
> trying
> to set up a script that executes an rxvt (in Linux) with a randomly
> chosen pixmap
> for the background.  The problem is, the 'exec' command doesn't behave
> the way
> it should when when there are variables to be interpolated.  Here's what
> I have:
>
> # ... $tile_dir is the directory containing the pixmaps ...
> # ... fill @pix with the .xpm filenames ...
> # ... $r is a random number between 0 and $#pix ...
> exec "rxvt -pixmap \"$pixmap_dir/$pix[$r];0x0\"";
>
> (Note that the -pixmap switch needs the literal quotes so that the shell
>
> interpreter doesn't think that the semicolon is a new command instead of
> a
> geometry setting)
>
> This will start an rxvt with the message:
>
> rxvt: couldn't load XPM file "/home/bry/AfterStep/bkimage/tiled/4.xpm"
> (where 4.xpm is the randomly chosen pixmap)
>
> However, when I change the script to reflect an actual file name, as in:
>
> exec "rxvt -pixmap \"$pixmap_dir/4.xpm;0x0\"";
>
> then the rxvt starts with the proper image in the background, as
> expected.
> Note that I can use the $pixmap_dir variable without any problems.
>
> Is there something I've missed here?  I'm using Perl 5.004 in Redhat
> Linux 5.0
> (2.0.32 kernel).  If anyone can tell me what I'm doing wrong, I'd
> appreciate it.

Well, in reply to my own post, I've solved the problem, if anyone's
interested in the answer.  I just put the entire command into a variable
and then pass it to exec, as in:

$cmd = "rxvt -pixmap \"$pixmap_dir/$pix[$r];0x0\"";
exec "$cmd";

I still haven't figured out why it won't work the way I had it before,
as appears in my earlier post.  A possible bug, perhaps?

Bry



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

Date: Sun, 19 Jul 1998 01:54:45 GMT
From: "Quinn,M" <melinda@acm.org>
Subject: Re: Program to give day of the week from given date
Message-Id: <35B153C6.D0620A7D@acm.org>

Here's what worked for me (refer also to man page "date":
  #!/usr/bin/perl -w
  #--This uses Linux system command "date" with
  #-- optional formatting
  $DateDay = `date -d 16-July-1998 '+%A'`;
  print ("DateDay is $DateDay \n");
Melinda Quinn  melinda@acm.org
==============================================
Hari Patel wrote:
 Does anybody know how to output day of teh week for a given date
> in perl
 e.g. if you have date as 13/5/98 pass it to some function which
> would output
>     Wednesday........
>     Please email me with any suggestions
>     hari.patel@bt.com
> Many thanks -  hari


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

Date: 19 Jul 1998 00:41:48 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Regular expressions and HTML
Message-Id: <6orfcc$pno@news.service.uci.edu>

	[mailed & posted]
In article <6or7j3$gkv$1@rand.dimensional.com>,
Daniel Grisinger  <dgris@rand.dimensional.com> wrote:
>I have often read that it is impossible to properly
>match HTML using a single regular expression.  I have
>never seen an explanation, though, of whether this means
>that it is impossible to reliably match a single tag,
>or if it means that it is impossible to reliably match
>a complete element.

Since matching start tags is a subset of matching a complete element,
they are not independent.  Hence, if you cannot match all legal start
tags with a single regex, then you cannot match a single element.


>In more concrete terms, is there a difference between
>trying to match-
>    <img src= "rt-arrow.gif" alt= "==>" >
>and
>    <p> This is a paragraph </p>

Yes.  An, element can contain embedded elements, making things much
more complex.  Example:

    <p align="center">This is a para with an image
    <img src='foo.gif' alt="Stupid </p> ==>'alt'<== text.">
    <em>Some emphasized text</em>
    <!-- And a comment with <p>Tags that should be treated
    aspart of the comment </p> -->
    </p>

In simple terms, due to the alternation of single and double quotes
for deliminiting attribute values, and attribute values can contain
less-then and greater-then characters and quote characters, a single
regex will not work to match all legal start tags.  Elements are
worse since they include start tags and other constructs.

Note, "matching" an element requires more than just checking for
the right delimiters.  Since end tags are optional, it requires
knowledge of the possible content models allowed to accurately
dermine the ending (and possible the beginning) of some elements.

If you want the gory details, check the various standards.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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