[8107] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1726 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 25 16:07:20 1998

Date: Sun, 25 Jan 98 13:00:36 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 25 Jan 1998     Volume: 8 Number: 1726

Today's topics:
    Re: /x regex mystery <rjk@coos.dartmouth.edu>
    Re: /x regex mystery (brian d foy)
        Access to parsed Perl program (C. Reid Turner)
        Bad (Swear) Word Checking (Dave Power)
    Re: Bad (Swear) Word Checking (I R A Aggie)
    Re: Bad (Swear) Word Checking <rjk@coos.dartmouth.edu>
        Bug in splice? (Malcolm Hoar)
    Re: Bug in splice? (brian d foy)
    Re: can not run a brand new install of PERL shaker@netusa1.net
    Re: can not run a brand new install of PERL <dcameron@bcs.org.uk>
    Re: Can unix Perl Modules be used under Win32 (Danny Aldham)
    Re: character comparison... (Chip Salzenberg)
        Customized LWP to Dejanews ad/or altavista (Danny Aldham)
    Re: Customized LWP to Dejanews ad/or altavista (Michael Fuhr)
    Re: Customized LWP to Dejanews ad/or altavista (brian d foy)
        DBM problems on Solaris <boromir@mindspring.com>
    Re: Decimal places <rootbeer@teleport.com>
    Re: Decimal places <rjk@coos.dartmouth.edu>
    Re: Decimal places (brian d foy)
    Re: Decrypting modules for Perl <rootbeer@teleport.com>
    Re: Decrypting modules for Perl (brian d foy)
    Re: Finding the missing bracket? (Ilya Zakharevich)
    Re: Finding the missing bracket? <rjk@coos.dartmouth.edu>
        Force Kill in perl? <effugas@shell3.ba.best.com>
    Re: Freidl's book mystery (Ilya Zakharevich)
        help: open an existing page and replace parts of it <ilia@detoronics.net>
    Re: how to do formfeed/pagebreak <rootbeer@teleport.com>
    Re: Interfacing a database through a perl script??? <rootbeer@teleport.com>
        My first script not doing exactly what I want it to (Erin Rouse)
    Re: Perl Source Obfuscator <rootbeer@teleport.com>
    Re: Reading persistent logs (Michael Fuhr)
    Re: Reading persistent logs (Chip Salzenberg)
        Reg-ex problem <steves@wco.com>
    Re: Reg-ex problem <jhi@alpha.hut.fi>
    Re: returning values out of a recursed sub <jason.holland@dial.pipex.com>
    Re: simple perl question, regx, please help. (Jeff Horwitz)
    Re: Survival Of perl (Frank)
    Re: Survival Of perl <merlyn@stonehenge.com>
    Re: Using a variable in a pattern match <rootbeer@teleport.com>
        Using Cgi Script to Redirect User By Domain Name? Help! (Mark)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 25 Jan 1998 14:41:12 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: /x regex mystery
Message-Id: <34CB9558.2A9E5772@coos.dartmouth.edu>

B. K. Oxley (binkley) wrote:
> 
> However, wouldn't it be a nice enhancement to /x to have it only strip
> whitespace adjacent to regex operators?  In which case, the above example
> would leave the space between "Tom" and "Christiansen" alone, but strip it
> elsewhere.

Enhancement?  That would be terrible!

Consider:

/
 a b c      # matches "a b c"
/x

/
 a [bB] c   # matches "abc" or "aBc"
/x

In replacing the letter b with the character class [bB], all of a sudden those
spaces are being stripped!

Chipmunk


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

Date: Sun, 25 Jan 1998 15:45:36 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: /x regex mystery
Message-Id: <comdog-ya02408000R2501981545360001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6afgok$sah$1@ndnws01.ne.highway1.com>, "B. K. Oxley (binkley)" <binkley@bigfoot.com> posted:

>However, wouldn't it be a nice enhancement to /x to have it only strip
>whitespace adjacent to regex operators? 

that would make it quite a bit less useful.  whitespace is not
the only boundary on which one might want to eXtend a pattern
to enhance readability.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: 25 Jan 1998 18:42:32 GMT
From: reid@tigger.cs.colorado.edu (C. Reid Turner)
Subject: Access to parsed Perl program
Message-Id: <6ag12o$3kd$1@csnews.cs.colorado.edu>

Is there any way to get access to something
like an abstract syntax tree representation 
of a Perl program from perl?  

I'd like to create tools like a def/use graph
and call tree.  Since perl is already parsing
the program, I'd rather not have to spend the
time writing something that parses parts of 
Perl if I could get perl to spit out something
useful.

I checked the FAQ, Deja News, and a couple of 
books and have seen zilch on the subject.

Thanks.

Reid Turner




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

Date: Sun, 25 Jan 1998 18:33:58 GMT
From: dave.power@adpdesign.com (Dave Power)
Subject: Bad (Swear) Word Checking
Message-Id: <34cb8329.25390362@news.virgin.net>


Does anyone know if a 'Bad Word' (dubious or definite swear words)
file exists which may be available. I think I know most of the English
ones (but then I'm not that sure that I do). I'm really looking for a
definitive list covering at least the western world languages.

An Alta Vista search turned up nothing relevant.


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

Date: Sun, 25 Jan 1998 14:04:37 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Bad (Swear) Word Checking
Message-Id: <fl_aggie-2501981404380001@aggie.coaps.fsu.edu>

In article <34cb8329.25390362@news.virgin.net>, dave.power@adpdesign.com
(Dave Power) wrote:

+ Does anyone know if a 'Bad Word' (dubious or definite swear words)
+ file exists which may be available. I think I know most of the English
+ ones (but then I'm not that sure that I do). I'm really looking for a
+ definitive list covering at least the western world languages.

I hate to say it, but its really a waste of time. For instance, let us
use the fine term 'fsck' as our 'dubious' word:

Funky Systems Crackpot Keeper  -or-

F S C K to you, to, buddy. -or- 

F unky
S ystems
C rackpot
K eeper

Of course, your idea would also bust certain valid uses of 'dubious' words.
For instance:

  My ex-girlfriend is such a bitch. [uncomplimentary]
  My five year old bitch had 10 pups last week. [nothing wrong with this]

You're better off trusting your users, and letting them know what
the accepted limits are. And when someone steps over the line, well, then
you lower the boom on 'em.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: Sun, 25 Jan 1998 15:03:15 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Bad (Swear) Word Checking
Message-Id: <34CB9A84.28ADBA62@coos.dartmouth.edu>

Dave Power wrote:
> 
> Does anyone know if a 'Bad Word' (dubious or definite swear words)
> file exists which may be available. I think I know most of the English
> ones (but then I'm not that sure that I do). I'm really looking for a
> definitive list covering at least the western world languages.

This one's more of a phrase than a word:

"People who post questions to clpm which have nothing to do with Perl."

Chipmunk

(Hope I didn't offend anyone. ;-)


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

Date: Sun, 25 Jan 1998 19:11:53 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: Bug in splice?
Message-Id: <6ag2pn$klk$1@nntp1.ba.best.com>

The following code:

@times = ();
$var = splice (@times, -9, 1);

sets $var to null under Perl4 and Perl5.00401. However, Perl5.00404
generates the following run time error (running from shell):

Modification of non-creatable array value attempted, subscript -9 at 
t.pl line 2

When run as a cgi script, it just bombs. However, there's nothing
in the httpd error log. So, although the error message is 
reasonable, I assume Perl must be calling exit() without an
error code and I reckon that's a bug. If there are any experts
who can confirm this analysis, I'll be happy to submit this
to Perlbugs.

-- 
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar           "The more I practice, the luckier I get". |
| malch@malch.com                                     Gary Player. |
| http://www.malch.com/               Shpx gur PQN.                |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Sun, 25 Jan 1998 15:58:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Bug in splice?
Message-Id: <comdog-ya02408000R2501981558090001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6ag2pn$klk$1@nntp1.ba.best.com>, malch@malch.com (Malcolm Hoar) posted:

>The following code:
>
>@times = ();
>$var = splice (@times, -9, 1);
>
>sets $var to null under Perl4 and Perl5.00401. However, Perl5.00404
>generates the following run time error (running from shell):
>
>Modification of non-creatable array value attempted, subscript -9 at 
>t.pl line 2
>
>When run as a cgi script, it just bombs. However, there's nothing
>in the httpd error log. 

when i run that as a CGI script, the same error message i saw from
the command line shows up in the error log.  perhaps your server
is broken or soemthing else is wrong.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Sun, 25 Jan 1998 12:51:35 -0600
From: shaker@netusa1.net
Subject: Re: can not run a brand new install of PERL
Message-Id: <885753374.35520520@dejanews.com>

In article ,
  "Duncan Cameron"  wrote:
>
> That's not quite the way to run perl under Windows 95
>
> Using your favourite editor create a perl script, e.g. myscript.pl
>
> run a DOS Command prompt then ...
> perl myscript.pl
>

This is more a Windows 95 question than a Perl question.

I just downloaded and installed Perl (from the ActiveState site), on my
Windows 95 pc.

I created a 'Hello, World' program and stored it in c:\dad\test.pl
If I do a

Start->Programs->MS-DOS Prompt and get a 'Dos' window and then
run

perl  c:\dad\test.pl

the program runs and prints out the expected. Is this the normal (and
only) of running Perl programs under a PC ? Or, is there a way I can stay
under Windows itself (as opposed to Dos) and Perl programs. [The problem
is that each time I have to type in 'exit' come back to Windows, make
source changes, go back to Dos and test it, and so on. Is there an
alternative ?]

If I do a

Start->Run

and then type in

perl c:\dada\test.pl

and click 'OK'

a 'Dos' typw window flashes by quickly - I cannot read what is  in it.
Is there a way to make the window stay ?

Thanks and regards.

Shaker

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 25 Jan 1998 20:48:09 GMT
From: "Duncan Cameron" <dcameron@bcs.org.uk>
Subject: Re: can not run a brand new install of PERL
Message-Id: <01bd29d2$79e0f9a0$873963c3@dns.btinternet.com>

Roughly, yes that is how to run perl under Windows 95 and, I guess, any
other system.  It's a command line based program.

It need not be as difficult as you suggest.  Leave your DOS window open
while you're creating and editing your scripts, then just switch back to
the DOS window and run perl again.  I use an editor, PFE, which lets me
launch a DOS shell or a DOS program directly from the editor, so I just
click a few buttons and the current script is executed.

You can get PFE free from http://www.lancs.ac.uk/people/cpaap/pfe/, but  I
imagine that there are many other editors which do a similar thing.  There
may well be more integrated perl environments around but I've not seen any
reference.

Hope this helps to get you going!

Duncan Cameron

shaker@netusa1.net wrote in article <885753374.35520520@dejanews.com>...

SNIP

> This is more a Windows 95 question than a Perl question.
> 
> I just downloaded and installed Perl (from the ActiveState site), on my
> Windows 95 pc.
> 
> I created a 'Hello, World' program and stored it in c:\dad\test.pl
> If I do a
> 
> Start->Programs->MS-DOS Prompt and get a 'Dos' window and then
> run
> 
> perl  c:\dad\test.pl
> 
> the program runs and prints out the expected. Is this the normal (and
> only) of running Perl programs under a PC ? Or, is there a way I can stay
> under Windows itself (as opposed to Dos) and Perl programs. [The problem
> is that each time I have to type in 'exit' come back to Windows, make
> source changes, go back to Dos and test it, and so on. Is there an
> alternative ?]
> 
> If I do a
> 
> Start->Run
> 
> and then type in
> 
> perl c:\dada\test.pl
> 
> and click 'OK'
> 
> a 'Dos' typw window flashes by quickly - I cannot read what is  in it.
> Is there a way to make the window stay ?
> 
> Thanks and regards.
> 
> Shaker
> 
> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet
> 


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

Date: 25 Jan 1998 10:24:19 -0800
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Can unix Perl Modules be used under Win32
Message-Id: <6ag00j$eev$1@lennon.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

Bernard Arumainathan (dilana@vcn.bc.ca) wrote:
: Is is possible to use perl modules from Perl distributions for Unix under
: Win32. 

Most of them seem to work fine. If you are using the core 
distribution, the installation process is exactly the same,
perl Makefile.PL , make, make test , & make install. If you
are using the Activestate distribution, which is short Makemaker
and does not assume you have make on your system, then you will need
to manually put the modules into the correct directories. 

--
Danny Aldham           SCO Ace , MCSE , JAPH , DAD
Ban the neutral zone trap. It's killing our National sport.


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

Date: Sun, 25 Jan 1998 19:27:42 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: character comparison...
Message-Id: <6ag3qr$9fp$1@cyprus.atlantic.net>

According to gabor@vnode.vmunix.com (Gabor):
>In comp.lang.perl.misc, Dane Christensen <dane@owlnet.rice.edu> wrote :
># Is there a way to alphebetically compare single characters?
>
>Try ord.
>print "foo\n" if ord "a" > ord $foo;

No, don't.  Try the string comparison operators:  eq ne lt le gt ge cmp

  print "foo\n" if "a" gt $foo;

-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
                  "We can shower it with neutrons."
              "Or we can do the Neutron Dance!"  // MST3K
** Perl Training from Stonehenge Consulting Services:  (503) 777-0095 **


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

Date: 25 Jan 1998 10:32:55 -0800
From: danny@lennon.postino.com (Danny Aldham)
Subject: Customized LWP to Dejanews ad/or altavista
Message-Id: <6ag0gn$ef8$1@lennon.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

Has anyone written a module to customize LWP for use as
a query tool of Dejanews or Altavista?

--
Danny Aldham           SCO Ace , MCSE , JAPH , DAD
Ban the neutral zone trap. It's killing our National sport.


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

Date: 25 Jan 1998 13:12:46 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Customized LWP to Dejanews ad/or altavista
Message-Id: <6ag6bu$q1u@flatland.dimensional.com>

danny@lennon.postino.com (Danny Aldham) writes:

> Has anyone written a module to customize LWP for use as
> a query tool of Dejanews or Altavista?

You can find all sorts of modules at the Comprehensive Perl Archive
Network (CPAN):

    http://www.perl.com/CPAN/CPAN.html
    http://www.perl.com/CPAN/modules/00modlist.long.html
    http://www.perl.com/CPAN-local/modules/01modules.index.html

Another useful site for searching is:

    http://reference.perl.com/

-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: Sun, 25 Jan 1998 15:52:00 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Customized LWP to Dejanews ad/or altavista
Message-Id: <comdog-ya02408000R2501981552000001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6ag0gn$ef8$1@lennon.postino.com>, danny@lennon.postino.com (Danny Aldham) posted:

>Has anyone written a module to customize LWP for use as
>a query tool of Dejanews or Altavista?

isn't that what WWW::Search is?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Sun, 25 Jan 1998 08:44:17 -0500
From: Boris Statnikov <boromir@mindspring.com>
Subject: DBM problems on Solaris
Message-Id: <34CB41B1.9069F313@mindspring.com>

I can't do anything (not even "dbmopen"): perl complains that this
machine
does not support Berkeley DB library or some such.  I found some vague
references to the Berkeley library files which I need to have on the
machine but I have no idea about where to get them.

Has anyone had this problem?

Boris


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

Date: Sun, 25 Jan 1998 10:00:45 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Brad Grove <brad.grove@b131.aone.net.au>
Subject: Re: Decimal places
Message-Id: <Pine.GSO.3.96.980125095904.22096K-100000@user2.teleport.com>

On Sun, 25 Jan 1998, Brad Grove wrote:

> How do I control the number of decimal places 

Section four of the FAQ has good information about this. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 25 Jan 1998 14:59:46 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Decimal places
Message-Id: <34CB99B3.EA64D355@coos.dartmouth.edu>

Brad Grove wrote:
> 
> Is there an int() function...?

You didn't even bother to try it, did you?

Maybe this will do what you want:

$num =~ s/\..*//s;

Chipmunk


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

Date: Sun, 25 Jan 1998 15:40:53 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Decimal places
Message-Id: <comdog-ya02408000R2501981540530001@news.panix.com>
Keywords: from just another new york perl hacker

In article <Pine.GSO.3.96.980125095904.22096K-100000@user2.teleport.com>, Tom Phoenix <rootbeer@teleport.com> posted:

>On Sun, 25 Jan 1998, Brad Grove wrote:
>
>> How do I control the number of decimal places 
>
>Section four of the FAQ has good information about this. Hope this helps!

i seem to recall someone writing a Perl Journal article on the 
subject as well - was that issue 8?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: Sun, 25 Jan 1998 12:37:36 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: David <davidu@electriciti.com>
Subject: Re: Decrypting modules for Perl
Message-Id: <Pine.GSO.3.96.980125123604.22096S-100000@user2.teleport.com>

On Sun, 25 Jan 1998, David wrote:

> I look at CPAN, and couldn't find anything that simply encrypted data, and
> decrypted data, If you have seen a perl script that does that, let me know
> please.

    http://www.perl.org/CPAN/modules/by-category/
	14_Authentication_Security_Encryption/

If none of the modules there seems to do what you need, you're welcome to
submit your own. Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 25 Jan 1998 15:59:55 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Decrypting modules for Perl
Message-Id: <comdog-ya02408000R2501981559550001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6aequf$800$1@volt.electriciti.com>, "David" <davidu@eciti.com> posted:

>I have written a perl script that takes input, incrypts it via 'crypt,' and
>then stores it in a file.  I need to be able to decrypt this file when it is
>needed, the 'crypt' function does not allow me to do this.  I am in search
>of existing code(preferably in OOP, but normal perl is fine) that will be
>able to sufficiently encrypt code, and the be able to decrypt with the
>correct salt.  DES encryption strength is sufficient.  as is RSA, MD5, or
>any other 'standard.'  If the code uses a custom algorithem, I must have the
>right to change the algorithem.


CPAN [1] is your friend.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>


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

Date: 25 Jan 1998 19:29:28 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Finding the missing bracket?
Message-Id: <6ag3qo$r4$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Douglas McNaught 
<doug@tc.net>],
who wrote in article <m2vhv9lvb3.fsf@ono.tc.net>:
> mbudash@sonic.net (Michael Budash) writes:
> 
> > Could you (and/or the others 'round here) be so kind as to recommend such
> > an editor, i.e., one that is perl-savvy?
> 
> GNU Emacs or XEmacs with cperl-mode.el.  Does a hard job really well.
> GNU Emacs runs on Win32 if you're a PoB. 

I discovered that the new font-lock.el of RMS Emacs 20.2 was removing
the markup that CPerl added to make syntax search Perl-savvy (I did
not see it with my patched version of 19.33).  New version of CPerl is
on the way (I would say a week or 10 days), it is going to handle
99.99% of Perl constructs.

Ilya


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

Date: Sun, 25 Jan 1998 14:31:11 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Finding the missing bracket?
Message-Id: <34CB9300.62255902@coos.dartmouth.edu>

Michael Budash wrote:
> 
> In article <34CA2111.A178761B@coos.dartmouth.edu>, rjk@coos.dartmouth.edu wrote:
> >> 
> >> emacs
> >>
> >> Did you have a specific platform in mind?
> >>
> 
> oops...win32 or mac, pls?

:-)  For the Mac, I recommend BBEdit 4.5.  It does syntax coloring too.
There is also a free version called BBEdit Lite.

<http://www.barebones.com/>

Chipmunk


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

Date: 25 Jan 1998 20:21:55 GMT
From: Dan Kaminsky <effugas@shell3.ba.best.com>
Subject: Force Kill in perl?
Message-Id: <6ag6t3$lo6$1@nntp1.ba.best.com>

Certain applications *really* don't want to die when a kill signal is sent
to them--for example. the "net view" application waiting for a reply that
will never come.  Is there *any* way to kill them, in perl or otherwise?
I'd like to have a general purpose way for perl to start up a win32 app
and have a *definite* and *iron clad* way of shutting it down?

Win32 bashers redirect to /dev/null :-D  :-D  :-D

(BTW:  Win32::Process::Create is used to create, and $ProcessObj->Kill(9)
is being used to zap.  It doesn't work.)



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

Date: 25 Jan 1998 18:07:20 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Freidl's book mystery
Message-Id: <6afv0o$qo7$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Joseph N. Hall
<joseph@5sigma.com>],
who wrote in article <34C89A00.60B1D6B2@5sigma.com>:
> Sheesh, give me a break.  OK, here's the one from my book, which
> is not particularly fast but is at least comprehensible.
> 
> # Split on strings and delimiters.
> for (split m!("(:?\\\W|.)*?"|/\*|\*/)!) { 
>   if ($in_comment) {
>     $in_comment = 0 if $_ eq "*/" # Look for */ if in a comment.
>   } else {
>     if ($_ eq "/*") {             # Look for /* if not in a comment.
>       $in_comment = 1;
>       print " ";                  # Comments become a space.
>     } else {
>       print;                      # If not in a comment, print.
>     }
>   }
> }
> 
> If I wanted this to be faster, I'd write an XSUB, not a long regex.
> Using regexes for comment preprocessing (and tokenizing in general)
> is, well, basically a losing approach if you like speed.

Come on!  Nothing can beat a good RE (though good RE are still hard
to write even with the newest RE engine - I hope this will be improved
very soon).

Ilya


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

Date: Sun, 25 Jan 1998 14:33:34 -0500
From: "Ilia Lobsanov" <ilia@detoronics.net>
Subject: help: open an existing page and replace parts of it
Message-Id: <#E3#WgcK9GA.59@upnetnews03>

Hello, I'm a beginner in Perl, and was wondering if there is an easy way to
open an existing html page, replace specific parts of it, and return the new
page to client.

So if the page has something like this:

<HEAD><TITLE>%%title%%</TITLE></HEAD>

I want to replace %%title%% with something else.

Is there a pre-made function that does this?

Something like
&f_ReplaceAll (@Array, $html_page);
where @Array can be an associative array with placeholders and corresponding
replacements?




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

Date: Sun, 25 Jan 1998 12:43:20 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Patience <feng@haas.berkeley.edu>
Subject: Re: how to do formfeed/pagebreak
Message-Id: <Pine.GSO.3.96.980125124005.22096T-100000@user2.teleport.com>

On Sun, 25 Jan 1998, Patience wrote:

> I want to use perl to generate simple forms for printout.  Would you
> tell me how to do formfeed/pagebreak? 

You simply print whatever character your system (or printer) uses to
denote a page break. Check your system's docs (or your printer's) to find
out what character that is. On some systems, it's character 12, also known
as control-L, so you might be able to use this:

    use constant FORMFEED => "\cL";

    print FORMFEED;

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 25 Jan 1998 09:57:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Bainbridge <coolj@zip.com.au>
Subject: Re: Interfacing a database through a perl script???
Message-Id: <Pine.GSO.3.96.980125095601.22096J-100000@user2.teleport.com>

On Sun, 25 Jan 1998, Jason Bainbridge wrote:

> I'm having trouble locating a way to get a perl chat script to interface
> with a database,

Perl comes with several modules which can implement databases, and there
are others available on CPAN. Check out the AnyDBM_File module to get
started. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 25 Jan 1998 20:25:24 GMT
From: eer6517@garnet.acns.fsu.edu (Erin Rouse)
Subject: My first script not doing exactly what I want it to
Message-Id: <6ag73k$17$1@news.fsu.edu>

This is my first script. I wrote it because I was curious what browsers people 
were using to access my homepage. I want it to get 3 environment variables 
$ENV{'REMOTE_HOST'} - &ENV{'HTTP_USER_AGENT'} - &ENV{'HTTP_REFERER'} and also 
the date and write it to a file I call logfile.html. Everything seems to work 
fine except it only writes the REMOTE_HOST and the date in the file. I checked 
my environment variables from my browser and HTTP_USER_AGENT and HTTP_REFERER 
were listed. 

When I run it in Telnet with -w on the end I get:

Content-type: text/html

<html><head><title>Experiment</title></head>
<body><h1>Experiment</h1>
<p>This is my logfile</p>
Use of uninitialized value at userid.pl line 27.
 - &ENV{'HTTP_USER_AGENT'} - &ENV{'HTTP_REFERER'} - Sunday, January 25, 1998 at
15:12:59 (EST)<br>
</body></html>           


This is the script:

#!/usr/bin/perl -w

##########################################################################

#define variables 

$logfile	= "/u/cob/fin/class/eer6517/public_html/log/logfile.html";
$date_loc	= "/usr/bin/date";
$date 		= `$date_loc +"%A, %B %d, %Y at %T (%Z)"`; chop($date);

# log the user 

open (LOG, ">>$logfile");
print LOG "$ENV{'REMOTE_HOST'} - &ENV{'HTTP_USER_AGENT'} - &ENV{'HTTP_REFERER'} 
- $date<br>\n";
close(LOG);


# Put in Content 

print "Content-type: text/html\n\n";

print "<html><head><title>Experiment</title></head>\n";
print "<body><h1>Experiment</h1>\n";
print "<p>This is my logfile</p>\n";
print "$ENV{'REMOTE_HOST'} - &ENV{'HTTP_USER_AGENT'} - &ENV{'HTTP_REFERER'} - 
$date<br>\n";
print "</body></html>\n";


It may be something simple. It may be my server. I don't know. Any advice or 
ideas are greatly appreciated. 

Thanks in advance.

Eric Smith



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

Date: Sun, 25 Jan 1998 12:45:07 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Nick <nmarino@home.com>
Subject: Re: Perl Source Obfuscator
Message-Id: <Pine.GSO.3.96.980125124411.22096U-100000@user2.teleport.com>

On Sun, 25 Jan 1998, Nick wrote:

> Subject: Perl Source Obfuscator

Have you seen what the FAQ has to say about hiding your source code? 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 25 Jan 1998 11:35:42 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Reading persistent logs
Message-Id: <6ag0lu$k34@flatland.dimensional.com>

Greg King <gking@c-com.net> writes:

> How do you setup a Perl program to look for incoming logs messages going
> to a log file without terminating?
>
> For example : then command tail -f filename opens a log file and then
> displays the incoming messages as they are written. How would this be
> done in Perl?

A couple of ways are shown in the Perl FAQ; there's also the
File::Tail module available on CPAN:

  #!/usr/local/bin/perl -w
  use File::Tail;
  $file = new File::Tail("/var/log/messages");
  while (defined ($line = $file->read)) {
      print $line;  # or whatever you want to do
  }

-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: Sun, 25 Jan 1998 19:12:10 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Reading persistent logs
Message-Id: <6ag2st$9eo$1@cyprus.atlantic.net>

According to chip@pobox.com:
 (some stupid code using O_NDELAY on plain files)

Please forgive this mental slip.  Here's some saner code:

   die "usage: $0 file\n" unless @ARGV;
   $FH = shift;
   open FH or die "Can't open $FH: $!\n";
   for (;;) {
      while (<FH>) { print }
      sleep 2;
      seek FH, 0, 1;
   }

-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
                  "We can shower it with neutrons."
              "Or we can do the Neutron Dance!"  // MST3K
** Perl Training from Stonehenge Consulting Services:  (503) 777-0095 **


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

Date: Sun, 25 Jan 1998 10:13:35 -0800
From: Steve Smith <steves@wco.com>
Subject: Reg-ex problem
Message-Id: <34CB80CF.7C22@wco.com>

I'm trying to remove comments from a c file and can't get
the regular expression to work.

For a test, I have
#!/usr/local/bin/perl 
$a = "/* * * This is a test * */ 1 1 2 3 4 /* - testing. */ hello.  ";

print $a, "\n";
$a =~ s!\s*/\*[^(/\*)]*\*/\s*!!g;
print $a, "\n";

and the program won't remove the first c comment.  It has to do
with the '*'s within the comment, but I can't see for the life
of me what's wrong.  If I replace the '-' in the second comment
with a '*', that match also fails.  What I expect is that the
expression will match anything that starts with /*, 0 or
more /*'s and ending with a */.  What am I missing?

Thanks.
Steve Smith
DSC Communications
Petaluma, CA


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

Date: 25 Jan 1998 20:21:45 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Reg-ex problem
Message-Id: <oeera5wpg7a.fsf@alpha.hut.fi>


Steve Smith <steves@wco.com> writes:
>
> I'm trying to remove comments from a c file and can't get
> the regular expression to work.
> [cut]
> more /*'s and ending with a */.  What am I missing?

Reading the Perl FAQ, part 6. 

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


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

Date: Sun, 25 Jan 1998 19:35:24 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: wcb4@erols.com
Subject: Re: returning values out of a recursed sub
Message-Id: <34CB93FB.645D4C80@dial.pipex.com>

William Byrd wrote:

> IF this is answered elsewhere, please forgive, but I need a little
> general purpose routine to collapse a variable changing all
> occourances of multiple spaces, regardless of how many into a single
> space. same goes for tabs.
>
> I have written this:
>
> $stringtocollapse="This is    only    a                         test";
>
> print $stringtocollapse;
> &collapse($stringtocollapse);
> print $stringtocollapse;
>
> sub collapse {
>         local ($line) = @_ if @_;
>         print $line."\n";               #here for debugging only
>         $line =~ s/\t/ /gi;     #substitute spaces for tabs in line
>         if ($line =~ m/  /i){
>                 $line =~ s/  / /gi;     #substitute 1 space for 2
>                 &collapse($line);            #recurse this routine
>         }
>         return($line);
> }
>
> I added the print routine so I could see what it is doing to $line,
> and it indeed does collapse it just as I had hoped, but the value does
>
> not return in the calling variable. Again, Please forgive if I am
> trying to do something that can be done much easier in perl, I still
> think in other computer langauges and try to make perl do what I am
> thinking, not always successfully.
>

Hello Bill,

I'm not sure why you are using a loop to do this, you can do an
instantaneous replace of all spaces like this:

    $string =~ s/ +/ /g; # This looks for one or more space characters
and changes them for a single space.

To include tabs as well, do this:

    $string =~ s/[\t ]+/ /g; # Use a character class of tabs and space
characters.


Sample:

sub collapse {
    my $line = shift;    # Get input
    $string =~ s/[\t ]+/ /g;     # Use a character class of tabs and
space characters.
    return( $line);
}

Test it to make sure it works properly, I haven't, but it should do what
you want. You could also expabd this example to work with arrays or
hashes as well.

Jason.

jason.holland@dial.pipex.com

http://dspace.dial.pipex.com/jason.holland/




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

Date: 25 Jan 1998 20:45:26 GMT
From: jhorwitz@umich.edu (Jeff Horwitz)
Subject: Re: simple perl question, regx, please help.
Message-Id: <6ag896$hnm$1@newbabylon.rs.itd.umich.edu>

/[a-zA-Z0-9]/ will match any string with those characters in it, even if
your unwanted characters are present.  try this instead:

if ($string =~ /[^a-zA-Z0-9]/) { fail; }

in english: if there are any characters other than a-zA-Z0-9, then fail.

------------------------------------------------------------------------
| Jeff Horwitz                                  University of Michigan |
| jhorwitz@umich.edu                                         Ann Arbor |
| http://www-personal.umich.edu/~jhorwitz            ITD Login Service |
------------------------------------------------------------------------

chad wrote:

: what is the code for this:

: $string should contain only a-z A-Z 0-9 if it contains anything else fail.

: I though it was:

:   if($string !~ /[a-zA-Z0-9]/) { fail; } but i guess that's wrong.

: thanks, chad

--


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

Date: Sun, 25 Jan 1998 17:48:35 GMT
From: FHeasley@chemistry.com (Frank)
Subject: Re: Survival Of perl
Message-Id: <34ce7ae0.10306401@news.halcyon.com>

On Fri, 23 Jan 1998 19:34:43 -0800, "Aamer Nazir"
<nazira@cadvision.com> wrote:

>Hi,
>I have a question which some people would consider 'dumb, but it is not.I
>want to ask all of you people that what is the FUTURE of perl.I mean with
>the coming of NT servers and Softwares like FrontPage ,is perl going to
>survive.I am asking this question because I want to learn this language but
>first of all I would like to know what you people think about the language
>and what are its applications.
>Thanks in advance,
>Aamer Nazir
>nazira@cadvision.com
>
>
perl is a very useful language for interfacing users to systems via
the world wide web.  In fact, that is probably where most of the new
users are coming from.  It's also a very useful language for dealing
with text on unix based systems - I suspect that that is where much of
its past strength is derived from.

Which brings me to the next point.  It's all well and good to advise
people to "use the perl modules" when the modules are pre-installed in
the version of perl you're using, or if you are writing programs on a
unix based system and can easily run makefile.  However, most new
users are windows based, and are writing programs in dos windows under
windows 95.  To them, perl modules are often useless.  

Similarly, the vi and emacs editors may indeed be very useful for
writing perl programs under UNIX, but unless you're willing to go out
and find (and learn) a windows or dos based version of them, they're
useless for most new users.

In order for perl to survive, it must continue to grow.  And in order
to grow, it must continue to meet the needs of established and new
users.  For the time being, perl is successful in that regard.
However, there are powerful corporations who have vested interests in
competitive languages for web interfacing, and they will continue to
enhance those languages.  If perl remains competitive with them, then
it will survive.  If not, it will be replaced.

Frank



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

Date: 25 Jan 1998 13:22:35 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: abigail@fnx.com
Subject: Re: Survival Of perl
Message-Id: <8ck9bo5mnn.fsf@gadget.cscaper.com>

>>>>> "Abigail" == Abigail  <abigail@fnx.com> writes:

Abigail> Perl was announced in the last weeks of 1987, a mere 2 years
Abigail> before the WWW was born.


Abigail>   With a background of system design in real-time
Abigail>   communications and text processing software development, in
Abigail>   1989 he [Tim Berners-Lee] invented the World Wide Web, an
Abigail>   internet-based hypermedia initiative for global information
Abigail>   sharing. while working at CERN, the European Particle
Abigail>   Physics Laboratory.

Abigail>   [http://www.w3.org/People/Berners-Lee/]


Abigail> Next time, please say "Perl has been around just 2 years
Abigail> longer than the web".

Quick.  Tell me what *browser* you used in 1989.  Or what day it
was the first time you typed "http.. something".

I bet it wasn't 1989.  The web *did not exist* for anyone outside of
CERN or NCSA until Mosaic was released publicly, which to my
recollection was sometime in mid 1993. In contrast, Perl *was*
released on comp.sources.unix in 1987.  Some six years before Mosaic.

*Those* are the figures I'm talking about.  *Those* are the ones that
matter.  OK, so now it's roughly 10/5's, not 10/4's, but pretty
close. :)

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

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


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

Date: Sun, 25 Jan 1998 09:52:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: malgosia askanas <ma@panix.com>
Subject: Re: Using a variable in a pattern match
Message-Id: <Pine.GSO.3.96.980125095212.22096I-100000@user2.teleport.com>

On 25 Jan 1998, malgosia askanas wrote:

> I am searching through a file to find a match with the value of
> a string variable, $user.  

Could you perhaps want the 'eq' string equality operator? Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 26 Jan 1998 07:15:45 GMT
From: harris@pysnet.net (Mark)
Subject: Using Cgi Script to Redirect User By Domain Name? Help!
Message-Id: <34cc381a.30833451@news.netvigator.com>

Dear all,

I wonder where can I find a cgi script that can redirect user by their
domain name. I know I can us .htaccess to deny access for certain but
my server can't use this fuction. So I need to use cgi script instead.
If you can tell me where can I find the script or email one for me, I
would be apprecipated. Please drop me an email. Thanks in advanced. 

Harris


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

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

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