[7796] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1421 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 6 00:07:23 1997

Date: Fri, 5 Dec 97 21:00:29 -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           Fri, 5 Dec 1997     Volume: 8 Number: 1421

Today's topics:
     Re: ... rumours run amok (Abigail)
     Re: 001 + 1 = 002; 002 - 1 = 1 ARGH (Bart Lateur)
     Re: [Q] Master/Slave pty module ? <ghowland@hotlava.com>
     ANNOUNCE: IndexMaker 3.2: an index.html maker from PDF, <pivari@geocities.com>
     Better way to do this? snailgem@aol.com
     Re: Better way to do this? (Emile Heyns)
     Can anybody Help me in this!!! (Lops)
     Re: Creating Calling Trees (Tushar Samant)
     Re: D:\perl\SOURCE\CHAP03\sess01>perl -e `print "\a"    <ebohlman@netcom.com>
     Re: Dynamic text-to-GIF utility (Emile Heyns)
     Re: Dynamic text-to-GIF utility (Tushar Samant)
     Re: Executing a Perl script inside a HMTL page ? (Mike)
     forked processes not exiting <dan@ukonline.co.uk>
     HELP!!! FTP script suddenly NOT working... (Connie)
     Re: How about a new type of "OR" (lazy evaluation)? <markm@nortel.ca>
     How to create reference to anonymous scalar variable ? <man@digsys.bg>
     Re: How to create reference to anonymous scalar variabl tobez@plab.ku.dk
     Re: how to do dos command inside perl (in nt) (Roy Brander)
     lib inst. directory for Win32 (Periat Henri)
     Mailing binary file <mikel@ap.net>
     Re: Matching lowercase letter in regexp (Honza Pazdziora)
     Re: need the skinny on my() vs local() (Raymond Chen)
     Re: Perl Overhead <marius@ace.funcom.com>
     Perl probs with files <nic@cyber-west.com>
     Re: Perl4 is not Y2K (was Re: Forced to use brain-dead  (Bill Totten)
     Re: Perl4 is not Y2K (was Re: Forced to use brain-dead  (Bart Lateur)
     Re: Perl4 is not Y2K (was Re: Forced to use brain-dead  (Chris Nandor)
     Re: printing and screen output (Mike)
     problem with unlink <e.christensen@netjob.dk>
     Problems with .db files (Fabian Warkalla)
     Re: Question about the =~ operator <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
     Re: Question about the =~ operator (John Stanley)
     Re: Recommended PERL-book? <ghowland@hotlava.com>
     Re: Resource Kit Anomaly (Tushar Samant)
     searching indexed file (Kitty Smith)
     Re: Seems to be just another  5.004_* bug:-( (Vladimir Sovetov)
     Re: Seems to be just another  5.004_* bug:-( (Ilya Zakharevich)
     Re: Setting default printer under Windows NT <jim.michael@gecm.com>
     validation problem <hvanlint@lodestar.be>
     Win32::EventLog <kabe01@idt.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 5 Dec 1997 09:02:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: ... rumours run amok
Message-Id: <slrn68fgt4.175.abigail@betelgeuse.wayne.fnx.com>

Randal Schwartz (merlyn@stonehenge.com) wrote on 1557 September 1993 in
<URL: news:8c90u0pqqx.fsf@gadget.cscaper.com>:
++ 
++ On IRC-EFNET #perl the other day, we came up with some more precisely
++ accurate, but scary phrases:
++ 
++     Larry Wall has no plans to make Perl4 be Y2K!
++     No patches will ever be released to make Perl4 Y2K.
++     It is unlikely that Perl4 will ever be Y2K certified.
++ 
++ And yes, this is forcing the issue via FUD, but remember that we're
++ merely combatting the *other* FUD, that moving from P4 to P5 is
++ impossible and/or will break things.

I think we should spread the rumour that there *is* a patch that
makes Perl4 Y2K complaint. That patch can be found at
<http://language.perl.com/CPAN/src/latest.tar.gz>

Oh, and it will you Perl4 OO too.



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


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

Date: Fri, 05 Dec 1997 10:56:46 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: 001 + 1 = 002; 002 - 1 = 1 ARGH
Message-Id: <348cdb18.9232288@news.tornado.be>

Tom Phoenix <rootbeer@teleport.com> wrote:

>> I checked the book and indeed only the ++ op is magical (I wonder
>> why?).
>
>Probably because there's no obvious predecessor to 'a000', for example.

Ok. So what comes after "a999"?

	Bart.


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

Date: Fri, 05 Dec 1997 10:07:56 +0100
From: Gary Howland <ghowland@hotlava.com>
To: nicholas@neko.binary9.net
Subject: Re: [Q] Master/Slave pty module ?
Message-Id: <3487C46C.34AB@hotlava.com>

nicholas@neko.binary9.net wrote:
> 
> Quickie: is there a prewritten module for handling the finding/creation
> of master/slave pty pairs? In a perfect world, it would work like this:
> 
> ($master,$slave)=File::Pty->new;
> 
> where $master/$slave are FileHandles that I can instantly use...


use IO::File;

sub openpty ()
{
        my ($pty, $tty, $pty_fh, $tty_fh, $i, $j);
        foreach $i ('p', 'q', 'r', 's', 'P', 'Q', 'R', 'S')
        {
                foreach $j ('0'..'9', 'a'..'v')
                {
                        $pty = "/dev/pty$i$j";
                        ($tty = $pty) =~ s/pty/tty/;
 
                        $pty_fh = new IO::File "+> $pty";
                        ref $pty_fh || next;
 
                        $tty_fh = new IO::File "+> $tty";
                        ref $tty_fh || next;
 
                        return ($pty, $tty, $pty_fh, $tty_fh);
                }
        }
        die "Out of pty's";
}


Gary
--
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: Fri, 05 Dec 1997 13:05:17 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: IndexMaker 3.2: an index.html maker from PDF, HTML, VRML and other files
Message-Id: <3487FC0D.167E@geocities.com>

Hi,

I'm glad to announce the version 3.2 of IndexMaker a perl script to make
an index.html file from PDF, HTML and other files.
At the moment, it uses the /Author field and the first /Title field in
every matched PDF files, the <TITLE> </TITLE> field in every matched
HTML files and the name of the file in the others.
It should work with PERL 4 and 5.

What's new with version 3.2
New input file format: VRML v 1.0 (Info node), VRML v 2.0 and 97
(WorldInfo node field info and title)
Added docs/PDF.notes and docs/VRML.notes

This is the URL where you can find the tool
http://www.geocities.com/CapeCanaveral/Lab/3469

Enjoy it!

Send me your suggestions.
-- 
     _/_/_/_/ _/_/_/     Fabrizio Pivari
    _/       _/    _/   mailto:pivari@hotmail.com
   _/_/_/   _/_/_/     mailto:pivari@yahoo.com
  _/       _/         mailto:pivari@geocities.com
 _/       _/         http://www.geocities.com/CapeCanaveral/Lab/3469/


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

Date: Fri, 05 Dec 1997 01:21:20 -0500
From: snailgem@aol.com
Subject: Better way to do this?
Message-Id: <34879D0D.1E49@aol.com>

I'm reading from a file and am interested in lines like this:
something=alpha,beta,gamma

I use the following code to do things with alpha, beta, gamma:

open (FILEHANDLE, $myfile) or die ("Can't open $myfile");
while (<FILEHANDLE>){
@lines=split /=/, $_ if /^something=/;
}
shift @lines;
#I dislike this one:
@mylines=split /,/, join(",", @lines);
chomp @lines;
foreach $line (@mylines) {
##do things here
}

This works fine, but is there a better way of doing this?
Thanks.
-- 
Will


"Take any demand, however slight, which any creature, however weak, may
make. Ought it not, for its own sole sake, to be satisfied?  If not,
prove why not."
			William James


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

Date: Fri, 5 Dec 1997 10:07:12 GMT
From: qqehe@st5-oa6.oce.nl (Emile Heyns)
Subject: Re: Better way to do this?
Message-Id: <EKpo40.y4@oce.nl>

On Fri, 05 Dec 1997 01:21:20 -0500, snailgem@aol.com wrote:
:I'm reading from a file and am interested in lines like this:
:something=alpha,beta,gamma
:
:I use the following code to do things with alpha, beta, gamma:
:
:open (FILEHANDLE, $myfile) or die ("Can't open $myfile");
:while (<FILEHANDLE>){
:@lines=split /=/, $_ if /^something=/;
:}
:shift @lines;
:#I dislike this one:
:@mylines=split /,/, join(",", @lines);
:chomp @lines;
:foreach $line (@mylines) {
:##do things here
:}

You might try

while (<FILEHANDLE>)
{
  if (/^something=/)
  {
    ($alpha, $beta, $gamma) = (split(/=|,/))[1..3];
    #do something with $alpha $beta and $gamma here
  }
}

-- 
It's the thought, if any, that counts!


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

Date: Fri, 5 Dec 1997 17:05:25 GMT
From: lops@I_should_put_my_domain_in_etc_NNTP_INEWS_DOMAIN (Lops)
Subject: Can anybody Help me in this!!!
Message-Id: <EKq7H1.LtC@konark.ncst.ernet.in>

Hi,
	I am writing a guest book . The records entered by users are put in a 
	record file. Later I want to allow the users to edit the data entered 
	by them after validating user by password.
		So to allow this facility I have to edit the particular record in 
		the record file . Is it possible to overwrite the particular record
		in the text file . Is there any method of directly manipulating the
		text file in PERl ? ( other than copying the file in a string , doing 
		changes & again copying that string in the file . File size is big so
		it is not a good idea!!)

Thanking you in advance 
uday@kapivar.ncst.ernet.in



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

Date: 4 Dec 1997 23:44:02 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Creating Calling Trees
Message-Id: <6684b2$mk8@tekka.wwa.com>

jwilf@darepc.jpl.nasa.gov writes:
>In article <879875446.6680@dejanews.com>,
>pverdret@sonovision-itep.fr (philippe Verdret) posted his excellent
>Devel::CallTree.pm and Tree.pm packages.
>
>Thank you, Philippe.  I'm finding these to be excellent for tracing
>program/function execution.

I agree, it was awesome.



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

Date: Fri, 5 Dec 1997 04:49:20 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: D:\perl\SOURCE\CHAP03\sess01>perl -e `print "\a"   while $_++ != 5`
Message-Id: <ebohlmanEKp9E8.54A@netcom.com>

yuan <s13621@er.uqam.ca> wrote:
: could anyone tell me what's wrong with that call from a dos prompt? 
: Can't find string terminator "`" anywhere before EOF at -e line 1.

: D:\perl\SOURCE\CHAP03\sess01>perl -e 'print "\t"  while $_++ != 5'

In DOS-derived shells, the escape mechanism requires double rather than 
single (as in Unix) quotes.  Of course, once you change those quotes, 
you'll need to use the qq() mechanism on your \t rather than the double 
quotes you have.



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

Date: Fri, 5 Dec 1997 08:59:28 GMT
From: qqehe@st5-oa6.oce.nl (Emile Heyns)
Subject: Re: Dynamic text-to-GIF utility
Message-Id: <EKpKz5.GnH@oce.nl>

On Thu, 4 Dec 1997 20:01:26 GMT, Steve Manes wrote:
:I'm looking for a freeware tool which will generate an on-the-fly
:GIF given some text, a font style from a local database and, ideally,
:a background GIF.  Oh yeah, and it has to run on Linux.  This is

Try ImageMagick.

Bye,

Emile
-- 
What this country needs is a dime that will buy a good five-cent bagel.


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

Date: 5 Dec 1997 07:17:46 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Dynamic text-to-GIF utility
Message-Id: <668utq$djp@tekka.wwa.com>

smanes@nospam.evermagpie.com writes:
>I'm looking for a freeware tool which will generate an on-the-fly
>GIF given some text, a font style from a local database and, ideally,
>a background GIF.  Oh yeah, and it has to run on Linux.

I do this with an X font server, ImageMagick (a truly excellent product),
and PerlMagick. Yes, all of it runs on a Linux box. I am sticking to the
"arbitrarily resizable" fonts, because the arithmetic is easier (and I know
next to nothing about fonts). Given that, the advantages of this approach
are: you can add almost any font you want to; the results are always clean
and pleasant; you are not restricted to gifs, etc. We are definitely not
going to use GD for this again. The disadvantage is, you can't really do
it on the fly. We intend to make this service publicly available as soon
as we can afford the resources.

It's not freeware, because I don't know how to package it. Very little
of it is actually code, the rest is just putting things together. Mail
me if you want details.



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

Date: Fri, 05 Dec 1997 06:15:33 GMT
From: v@v.com (Mike)
Subject: Re: Executing a Perl script inside a HMTL page ?
Message-Id: <348d9bea.134629475@news.coastalnet.com>

On Wed, 02 Oct 1996 22:30:13 GMT, nilsson@algonet.se (Hans Nilsson)
wrote:

>Does anyone know (how?) if it4s possible to execute
>a Perl script as a part of a page under IIS ?

>Can it be done ?

Sounds like you can do what you want using Server-Side Includes, which
are covered pretty well in the NCSA HTTP FAQ.

In a nutshell, use <!--exec cgi="/cgi-bin/yourscript.pl"-->, but only
if your server is set up to handle SSI (check the FAQ).




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

Date: Fri, 5 Dec 1997 12:51:02 -0000
From: "Dan Hopkins" <dan@ukonline.co.uk>
Subject: forked processes not exiting
Message-Id: <668t8t$r8b$1@apple.news.easynet.net>

I've recently set up a perl client-server system running on BSDI UNIX. A lot
of the code was ..ahem... 'borrowed' from a freely available client-server
example.

It all works reasonably well ..... apart from killing off the forked servers
once they've completed their tasks. They don't actually exit (using 'exit
0;') , instead they become zombie processes. Anyone have any ideas, or could
point me in the right direction ?

Cheers.

-------------------------------------------------
Dan Hopkins
Systems Admin & Development
UK Online Ltd.
email: dan@ukonline.co.uk
-------------------------------------------------




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

Date: Fri, 05 Dec 1997 02:19:48 GMT
From: connie@bitterpills.com (Connie)
Subject: HELP!!! FTP script suddenly NOT working...
Message-Id: <348a6495.120462921@news.coastalnet.com>



Can ANYBODY help with the following???

I've been using the commonly available ftplib.pl routines for almost a
year now on a variety of platforms, and have been happy with the
results. The PERL scripts I've developed have done exactly as I'd
hoped on a Macintosh system for the past eight months, but now the
company for whom I developed a specialized FTP script has switched to
using a GlobalVillage OneWorld network modem.

The result: Everything else using standard TCP/IP protocols seems to
work fine, but MY programs (which rely on the ftplib 1.1's ftp'put
command), returns a "426 Connection Reset By Peer" error any time it
is asked to transfer a file larger than, say, 12K.

Smaller files seem to transfer fine, and other FTP, HTTP and telnet
transmissions seem to go without a hitch. Any suggestions???

Any help would be greatly appreciated! Thanks!


Connie Nichols
connie@bitterpills.com



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

Date: 04 Dec 1997 23:43:08 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: How about a new type of "OR" (lazy evaluation)?
Message-Id: <lq1pvnc4cyr.fsf@bmers2e5.nortel.ca>

bart.mediamind@tornado.be (Bart Lateur) writes:
> I know that you can also do the following:
> 
> 	$result = defined($temp=&calc(@params))?$temp:&default(@params)
> 
> But it doesn't look as nice, and like most people, I don't use it if
> it's not necessary.
> 
> So I would suggest the introduction of a new type of lazy evaluation
> operator, in which case the right side is only executed if the left side
> evaluates to undef.
> 
> So what do you think about this?

In code you often see lines like the following:

      $var ||= "default value";

With the purpose being "if $var is not defined... set it to the default"
This is similar to use of ${var:=defaultvalue} in most shells.

Only thing is this don't work if '0' is a possible. As i don't like spending
time figuring out all the possibilities in my code, i usually try to handle
everything the first time around...

      $var = "default value" if !defined($var);

Not as neat... but unlike ||=, it does what i want. I guess it comes down
to the better of two evils. When perl decided to allow strings and numbers
to be interchangeable, rules were required to determine "what is a true
value" so we get the "0 but true" from some function calls. evil... but...
possibly the lesser of two :-)

mark

--                                                  _________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|


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

Date: Fri, 5 Dec 1997 12:21:52 +0200
From: Margarit Nickolov <man@digsys.bg>
Subject: How to create reference to anonymous scalar variable ?
Message-Id: <Pine.BSI.3.95.971205120403.3642A-100000@school.digsys.bg>


For example some elements of hash reference to one value of scalar
variable, then value of scalar variable changes, and I want another
elements of hash reference to 'new value' of the same scalar variable.

while( $line = <FH>) {
  
# value of 'scalar $line' changes each iteration

$hash{ $key1 } = \$line; # I want each iteration create some references
$hash{ $key2 } = \$line; # to the 'CURRENT VALUE' of scalar $line

}

P.S.: I apology about poor English (and probably, stupid question) !!!

My Address:   man@school.digsys.bg



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

Date: Fri, 05 Dec 1997 12:53:15 +0100
From: tobez@plab.ku.dk
Subject: Re: How to create reference to anonymous scalar variable ?
Message-Id: <3487EB2B.B25@plab.ku.dk>

Margarit Nickolov wrote:

> while( $line = <FH>) {
> 
> # value of 'scalar $line' changes each iteration
> 
> $hash{ $key1 } = \$line; # I want each iteration create some references
> $hash{ $key2 } = \$line; # to the 'CURRENT VALUE' of scalar $line
> 
> }

1.  Why do you need it?  Isn't that simplier just to assign a value
instead of the reference?

2. If you NEED it, you may try

   $hash{$key} = \(${[$line]}[0]);

   The syntax is nasty, but it does generate a reference to the
anonymous scalar
   (a reference to the element of an anonymous array, to be precise).


Hope this helps,
Anton.


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

Date: 4 Dec 1997 23:38:27 -0700
From: branderr@cuug.ab.ca (Roy Brander)
Subject: Re: how to do dos command inside perl (in nt)
Message-Id: <6687h3$9nh@hp.cuug.ab.ca>

: Rey Andrada wrote:
: > 
: > Hi All,
: > 
: > how to do dos command inside perl (in nt)
: > 

Good Question, Rey.  Hmmmmmmmm.....
How to do a DOS command inside Perl.....  Hmmmm...

Disdainfully, I should say.  With gritted teeth and pinched nostrils... Yes.

Doing it with utter contempt and revulsion would be going overboard, just
too fanatical.

 ...and the "system" function, as described in the docs should work in the
Win32 & NT versions...


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

Date: 5 Dec 1997 13:23:00 GMT
From: periat@ens.ascom.ch (Periat Henri)
Subject: lib inst. directory for Win32
Message-Id: <668v7k$sq3@ascomax.hasler.ascom.ch>

Hi Perl porters

Wouldn't it be possible to make the library installation directory
definable by the user?

- move line 'INST_LIB=$(INST_TOP)\lib' up in the win32/Makefile to
  the user definable area
- replace '~INST_TOP~\lib' by '~INST_LIB~' in 'config.vc' and 'config.bc'
  where ever it's found

Will this always work ?


Thanks
Henri



-----------------------------------------------------------------------
Henri Periat				Phone:	0041 32 624 35 78
Ascom Business Systems AG		E-Mail:	periat@ens.ascom.ch
Dep. 3578				Fax:	0041 32 624 31 56
Ziegelmattstr. 1
CH-4503 Solothurn
Switzerland
-----------------------------------------------------------------------




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

Date: Thu, 4 Dec 1997 23:02:22 -0800
From: "Mikel Cook" <mikel@ap.net>
Subject: Mailing binary file
Message-Id: <6688oo$n7$1@news.ap.net>

I am developing a site that will send an image form to a third party.  I
have a script that sends out an email item, but the image doesn't make it.

The host is UNIX, the email server is sendmail (Linux flavor, I believe).

I open the handle MAIL for output, create and print a message header, open
the binary file for input, use binmode, then I am using

while (!eof <handle>) {
    print MAIL;
}

I was thinking I might need to get the file size from -s and get Perl to
read just the right number of bites with a read command.

The open for mail looks like this:

open (MAIL, "|/usr/bin/sendmail -B 8BITMIME");

I am not getting an error on the open statement even with the -w parameter,
so it seems that flag is OK.  I read in the sendmail man page that the -B
flag is for a binary message body.

None of the books I have consulted say much about sending email attachments.

Anyone?

TIA

Mikel Cook
System Administrator





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

Date: Fri, 5 Dec 1997 09:58:14 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Matching lowercase letter in regexp
Message-Id: <adelton.881315894@aisa.fi.muni.cz>

Tom Phoenix <rootbeer@teleport.com> writes:

> On Thu, 4 Dec 1997, Honza Pazdziora wrote:
> 
> > how do I match lowercase letter (locale-smart, of course)?
> 
>     while (<>) {
>         while (/(\G.*?[^\W0-9_])/g) {
>             print "$1\n" if $1 eq lc $1;
>         }
>     }
> 
> Does that do what you want?

So, the only way to do it currently is to match something and then
check if after conversion to lowercase it's the same as before,
right?

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Fri, 05 Dec 1997 04:38:32 GMT
From: raymondc.---@microsoft.com (Raymond Chen)
Subject: Re: need the skinny on my() vs local()
Message-Id: <348784f8.1224794301@news.alt.net>

On Thu, 4 Dec 1997 13:45:06 -0500, "Dave Kaufman"
<davidk@nospam.cnct.com> wrote:
>I'm afeared.  What is the difference between my() and local() ?

Grossly oversimplified:

	local($var) = 2;

	...
	return;

is like

	my $savedvar = $var; # save old value of global $var
	$var = 2; # set new value of global $var

	...

	$var = $savedvar; # restore value of global $var
	return;

--
(My return address is intentionally invalid; delete ".---" to get my real address.
My responses are not to be considered official technical support or advice.)


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

Date: 05 Dec 1997 13:00:14 +0100
From: Marius Kjeldahl <marius@ace.funcom.com>
Subject: Re: Perl Overhead
Message-Id: <52iut4m241.fsf@ace.funcom.com>

>>>>> "Henry" == Henry Hartley <henry@DotRose.com> writes:

    Henry> Our company looks like they are moving towards using Cold
    Henry> Fusion for Intranet database applications.  I've just spent
    Henry> a fair amount of time learning Perl and expect (hope?) to
    Henry> be asked why we should not dump Perl completely and use CF.
    Henry> One of the arguments used to recomment CF is that there is
    Henry> one CF process running on the server that handles all the
    Henry> requests while Perl starts a new process for each script
    Henry> that runs.  (in case it matters, we are running both on NT
    Henry> servers).

FastCGI for perl is exactly this. It works. And you can have any
number of processes "ready and waiting" ("pre-spawned" or
dynamically). FastCGI is great for keeping state inbetween invocations
without pushing data to a file or database, chaining forms or using
cookies.

Marius




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

Date: Fri, 5 Dec 1997 01:52:24 -0700
From: "Madness" <nic@cyber-west.com>
Subject: Perl probs with files
Message-Id: <3487d920.0@news5.kcdata.com>

I have a mail server written in Perl to keep track of email messages sent
back and forth over a network.  This mail program resides on a virtual
server on a unix system(solaris).  People can also access their mail through
a browser from home with a password and box#.  I have had people complain on
a couple of occasions that they would receive an error message saying that
they couldn't send/recieve mail in their particular box.  Each time I have
checked this, the files had changed ownership from the set group name to
root and permissions had changed from read/write to read/execute.

When sending messages, each mail inbox has a separate file.  I open the
file, perform some formatting, and append the new message to the end of the
file.  Is there something I'm not aware of that could be causing the
ownership status?

Thanks

Nic Holbrook
nic@ns.cyber-west.com




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

Date: 5 Dec 1997 01:20:39 -0500
From: biell @ udel . edu (Bill Totten)
Subject: Re: Perl4 is not Y2K (was Re: Forced to use brain-dead perl 4 -- how do I accomplish task that is simple in perl 5 ?)
Message-Id: <6686fn$arc$1@mahler.udel.edu>

In article <34871c82.803003@news.tornado.be>,
Bart Lateur <bart.mediamind@tornado.be> wrote:
>mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:
 <...>
>Eventually, people will say: "Perl 4!?!?! Who the hell did design such
>crap!?!"
>
>Unfortunately it's the same people at the forefront of development of
>Perl 5. Unfortunate for THEM, I mean. Can you imagine, having to live
>with that reputation?
>
>	Bart.

  I disagree completely.  Perl4 is not crap; in fact, I would choose
perl4 over nothing every time, garunteed.  Heck, I would choose perl4
over just about anything besides perl5 (maybe python, too) in the areas
in which I use perl5 now.

  The perl4 developers did a great job.  Unfortunatly, there are only
a certain number of hours in each day and problems crept into the
interpreter.  Would you have preferred that we go from perl1 straight
to perl5 and have to use perl1 the whole time it took to develop perl5?

  I like perl4. I just happen to like perl5 better, because it is better.
Larry & co. should be proud of perl4 and prouder of perl5.

  I normally do not engage in this sort of banter; however, I found this
comment unnerving.
-- 
Totten, William David (Bill)         Computer and Information Science Major
totten @ pobox . com               University of Delaware (Newark, DE; USA)
http://pobox.com/~totten/               Friends don't let friends use emacs


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

Date: Fri, 05 Dec 1997 11:23:02 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Perl4 is not Y2K (was Re: Forced to use brain-dead perl 4 -- how do I accomplish task that is simple in perl 5 ?)
Message-Id: <3490e30e.11270280@news.tornado.be>

biell @ udel . edu (Bill Totten) wrote:

>  I like perl4. I just happen to like perl5 better, because it is better.
>Larry & co. should be proud of perl4 and prouder of perl5.
>
>  I normally do not engage in this sort of banter; however, I found this
>comment unnerving.

Don't worry. It's all a bit of a joke.

Perl4 is as Y2K compliant as Perl5. It's a rumour sent into the world by
Randal to hasten people into transiting to Perl 5.

But what if these rumours get out of hand? That was what the joke was
all about.

Come to that, would you use Perl2 now Perl5 is the current version? I
wouldn't, and I have never seen a copy of Perl2. 

So what will people think of Perl4 once we get to, say, Perl9?

	Bart.


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

Date: Fri, 05 Dec 1997 07:24:31 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Perl4 is not Y2K (was Re: Forced to use brain-dead perl 4 -- how do I accomplish task that is simple in perl 5 ?)
Message-Id: <pudge-0512970724320001@ppp-5.ts-1.kin.idt.net>

In article <3490e30e.11270280@news.tornado.be>, bart.mediamind@tornado.be
(Bart Lateur) wrote:

# So what will people think of Perl4 once we get to, say, Perl9?

I don't think we will ever get that far.

--
Chris Nandor               pudge@pobox.com           http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==                    MacPerl: Power and Ease                     ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: Fri, 05 Dec 1997 05:58:06 GMT
From: mfahy@bitterpills.com (Mike)
Subject: Re: printing and screen output
Message-Id: <348b97e2.133597842@news.coastalnet.com>


You can force perl to flush the currently selected output channel by
setting the special variable, $|,  to any nonzero value. (In other
words, put

$|=1;

near the top of the code. Now perl doesn't wait for the newline before
it prints each character to output.

Good luck.

Mike Fahy
m f a h y @ c a r t e r e t . c o /\/\

>
>Hi,
>
>I didn't find the answer to this question in the FAQ. 
>
>How do you force print output without a linefeed ("\n")? I would like to
>have a program continue to print to the same line to indicate status, e.g.
 .
 .
 .
>Nothing shows up on my xterm until the \n line. Any suggestions?
>



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

Date: Fri, 05 Dec 1997 11:56:33 +0100
From: Ernst <e.christensen@netjob.dk>
Subject: problem with unlink
Message-Id: <3487DDE1.2447@netjob.dk>

Hi

I am trying to delete a file form a directory, using unlink like this:

unlink ("/Master/docs/upload/HejKurt.doc");

but i won't work.
Any ideas??

mvh
Ernst
e.christensen@netjob.dk


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

Date: Fri, 05 Dec 1997 13:02:42 +0100
From: warkalla@ecrc.de (Fabian Warkalla)
Subject: Problems with .db files
Message-Id: <warkalla-0512971302420001@fatmac.ecrc.de>

Hi !
I want to save a hash in a db file and define and undefine elements in
this has (which normally works, when the hash is not connected to a file
!).
Why does the undef function not work with this context ???
Why is the variable $ALIAS{xxx} not undefined (only the content is
undefined !) ?

Please reply via email to "warkalla@ecrc.de", thanks in advance !


#!/opt/local/bin/perl
print "\n\n\n";


# open the file, add a variable
# print the variable, close the file


dbmopen %ALIASES, "test", 0777;
$ALIASES{xxx}="yyy";
print "defined : ";
print $ALIASES{xxx} . "\n";
dbmclose %ALIASES;

# open, undefine, close

dbmopen %ALIASES, "test", 0777;
undef $ALIASES{xxx};
print "undefined !\n";
dbmclose %ALIASES;

# check if still defined....YES !

dbmopen %ALIASES, "test", 0777;
if (defined $ALIASES{xxx}) {
   print "Still defined !\n";
   print "with empty content, look here: " . $ALIASES{xxx} . "\n";
}
dbmclose %ALIASES;


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

Date: Thu, 4 Dec 1997 21:19:06 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Question about the =~ operator
Message-Id: <6682qd$ap3@mtinsc02.worldnet.att.net>

What??????

I just tried the following:

perl -e"$something='foo';if ($something =~ /f/) {print $something};"

and it returned "foo," not "f." So Perl is matching the string without
altering it.

But on the off chance your version of Perl has gone berserk and is assigning
"f" to $something in the above statement, you could do this:

$_ = $something;
if (/f) { something something something }

It's sort of like what you were doing just now except that $_ already exists
so you're not really using up extra memory.

--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
Richard C. Herselman wrote in message <34876c32.0@hawk.pix.za>...
    Hey y'all

    I was wondering if it's possible to match one string with another
without using the match operator (=~), because when I use the match
operator, like this:

    if ($somestring =~ /abc/) {  # or whatever
            something;
            something;
            something;
    }

    ... the value of $something gets changed to whatever was matched, and I
don't wanna do that, I just wanna evaluate whether /abc/ is in $something,
and if it is, then I want the stuff in the if block (something, something
and something) to be executed. I don't want to change the $something
variable.

    I know I can have something like this:

    $oldsomething = $something; # copy the variable into another one for
later use
    if ($something == /abc/) {  # or whatever
          something;
          something;
          something;
    }
    #use $oldsomething somewhere down here, when and if needed

    ....but I was thinking something more in the general direction of:

    if ($something == /abc/) {  # or eq instead of ==, maybe?
          something;
          something;
          something;
    }

    Is this possible?

    I hope you understand the question...

    Thank you for your time.

    >> When replying by email, please remove the trailing ".com". <<




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

Date: 6 Dec 1997 01:37:45 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Question about the =~ operator
Message-Id: <66aa99$jsu@news.orst.edu>

In article <34876c32.0@hawk.pix.za>,
Richard C. Herselman <herselman@pixie.co.za.com> wrote:

Interesting. The message id says one domain, the From: address says a
different one. Something is broken. Do the people who own the domain
za.com know you are creating addresses within their domain for them?

><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
><HTML>
><HEAD>
>
><META content=3Dtext/html;charset=3Diso-8859-1 =
>http-equiv=3DContent-Type>
><META content=3D'"MSHTML 4.71.2016.0"' name=3DGENERATOR>
></HEAD>
><BODY bgColor=3D#ffffff>
><DIV><FONT color=3D#000000 face=3DArial size=3D2>Hey y'all</FONT></DIV>
><DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT>&nbsp;</DIV>
><DIV><FONT color=3D#000000 face=3DArial size=3D2>I was wondering if it's =
>possible to=20
[lots more garbage deleted]

Huh?



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

Date: Fri, 05 Dec 1997 10:23:19 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: Recommended PERL-book?
Message-Id: <3487C807.5345@hotlava.com>

Tom Christiansen wrote:
> 
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, Gary Howland <ghowland@hotlava.com> writes:
> :>         I want to find a book that describes the basics of PERL,
>                                                     ^^^^^^
> 
> :"Advanced Perl Programming" is the best perl book by a long shot.
>   ^^^^^^^^
> 
> Huh?

In addition to describing advanced perl, this book also covers the perl
basics, except for the *very* basic stuff, like describing scalars and
arrays, how to declare and call subroutines, etc.  When it comes to
describing basic stuff like nested data structures, the difference
between lexical and dynamic scoping, references, typeglobs, filehandles,
eval and die, and modules, this book is the best I've come across.

Gary
-- 
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: 5 Dec 1997 07:34:39 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Resource Kit Anomaly
Message-Id: <668vtf$ei4@tekka.wwa.com>

comdog@computerdog.com writes:
>>>The java stuff is, to be honest, piss poor.  I was hoping for a perl ->
>>>java bytecode compiler -
>>
>>That's the impression I got. This is pretty disappointing.
>
>i suppose that no one has considered this is the first release of a 
>perl->java thingy, and that things will get better?  certainly the
>author has a pretty good track record for that sort of thing :)

I was talking only about the impression O'Reilly gave in the email
they sent me. It sounded awfully like: a compiler to java bytecode
will be IN the resource kit.



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

Date: Thu, 4 Dec 1997 11:45:28 -0600
From: smith@twsuvm.uc.twsu.edu (Kitty Smith)
Subject: searching indexed file
Message-Id: <19971204.114529.083871.NETNEWS@TWSUVM.UC.TWSU.EDU>

I am looking for a more efficient way of searching an indexed file
than using regular expressions.  I am using Perl for Win32.  Any help
would be much appreciated.

Kitty Smith
Wichita State University



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

Date: 5 Dec 1997 04:17:23 GMT
From: sova@kpbank.ru (Vladimir Sovetov)
Subject: Re: Seems to be just another  5.004_* bug:-(
Message-Id: <667v8j$6dc$1@home.kpbank.ru>

Ilya Zakharevich (ilya@math.ohio-state.edu) wrote:
: In article <665c3i$kg4$2@home.kpbank.ru>,
: Vladimir Sovetov <sova@kpbank.ru> wrote:
: >      Well, anyway I don't like that this little thing
: > 
: > 	 s/<([^>]+)*>//;
: > 
: >    could hang-up your script now under 5.004_04.

: Do you try to infer that the older versions would not do it?!  This is
       I'm sure, absolutely, this is passed fine under 5.001
    Here is a proof

% cat tt.html|./test2.pl
Before: <A HREF="../index.html">

After: 

Before: <IMG SRC="../Pict/arf-logo.gif" HEIGHT=75 WIDTH=65 ALIGN=RIGHT ALT="ARF Home"

After: <IMG SRC="../Pict/arf-logo.gif" HEIGHT=75 WIDTH=65 ALIGN=RIGHT ALT="ARF Home"

% cat tt.html
<A HREF="../index.html">
<IMG SRC="../Pict/arf-logo.gif" HEIGHT=75 WIDTH=65 ALIGN=RIGHT ALT="ARF Home"

%cat test2.pl
#!/usr/bin/perl5 -w 

    while (<>)
     {
        print "Before: $_\n";
                   s/<([^>]+)+>//;
        print "After: $_\n";
      }

% cat tt.html
<A HREF="../index.html">
<IMG SRC="../Pict/arf-logo.gif" HEIGHT=75 WIDTH=65 ALIGN=RIGHT ALT="ARF Home"

%/usr/bin/perl5 -v

This is perl, version 5.001

        Unofficial patchlevel 1m.

   And started to hang-up from (for what versions are available to me for
 checking it) from 5.003

: a well-known limitation of NFA engines.  As far as Perl remains 100%
: NFA (hopefully, not so long now), this will remain as always was.
    You see it isn't correct always-wise. Do you:-)))


: And this is not a hang-up.  It is no more than

: 	1 while $i++ < 1e9;
    Seems to be a little more complicated:-)))
---
Vladimir Sovetov | Kuzbassprombank


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

Date: 5 Dec 1997 06:44:04 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Seems to be just another  5.004_* bug:-(
Message-Id: <6687rk$8i9$1@agate.berkeley.edu>

In article <667v8j$6dc$1@home.kpbank.ru>,
Vladimir Sovetov <sova@kpbank.ru> wrote:
> Ilya Zakharevich (ilya@math.ohio-state.edu) wrote:
> : In article <665c3i$kg4$2@home.kpbank.ru>,
> : Vladimir Sovetov <sova@kpbank.ru> wrote:
> : >      Well, anyway I don't like that this little thing
> : > 
> : > 	 s/<([^>]+)*>//;
> : > 
> : >    could hang-up your script now under 5.004_04.
> 
> : Do you try to infer that the older versions would not do it?!  This is
>        I'm sure, absolutely, this is passed fine under 5.001
>     Here is a proof

Yes, the moment I pressed 's' key, I realized how this may have
happened.  And that it works better in 5.004_55.

The differences you see are just different behaviour of optimizer.  It
could have picked up either "<" or ">" as a constant substring to
check for before engaging the actual RE engine.  Looks like the
different versions prefer different substrings.

The behaviour of optimizer is debatable, since with different choices
you optimize for different situations.  Note that starting from
5.004_55 the optimizer will check *both* for the "fixed" and
"floating" substrings before firing the RE engine.

However, a slightly more complicated example will kneel down 5.004_55
as well:

  timeit perl -e "'<1111111111111111111111111>' =~ /<([^>]+)*>./"

Oups, no, the optimizer in _55 is even smarter than this!  To trick it
you need at least

  G:\>timeit perl -e "'<11111111111111111111>b' =~ /<([^>]+)*>[a]/"
  Timer 1 on: 22:40:25
  Timer 1 off: 22:40:31  Elapsed: 0:00:06.06

  G:\>timeit perl -e "'<111111111111111111111>b' =~ /<([^>]+)*>[a]/"
  Timer 1 on: 22:40:36
  Timer 1 off: 22:40:48  Elapsed: 0:00:12.13

So you can see how quick is the number of variants to check for growing!

Ilya


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

Date: Fri, 05 Dec 1997 08:25:33 -0500
From: Jim Michael <jim.michael@gecm.com>
To: charlot@cam.org
Subject: Re: Setting default printer under Windows NT
Message-Id: <348800CD.44D7@gecm.com>

charlot@SPAM-FREE.org wrote:
> Thanks for the tip, but this doesn't seem to work.  Netscape prints to the
> current Windows default printer, not LPT1.  Which brings me back to my
> original query: is there a way to change the default printer from Perl under
> Windows NT ?  Or to change the page layout of a printer ?

Netscape? Hmm. Well, here is the API call from an article in the KB.
Good luck.

Cheers,

Jim
   -----

   // To set the default printer for Windows NT use:
   /* Note printer driver is usually WINSPOOL under Windows NT */
   WriteProfileString("windows", "device", "My Printer,WINSPOOL,lpt1:");
   SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0L, 0L);

There are two circumstances where the code won't work: 

1.If the customer leaves out the SendMessage, no other application will
recognize the change in the .INI settings. 

2.If a different 32-bit application does not handle the WIN.INI change
message, then it will appear to that application as if the default
printer has not been changed. The user will need to exit and re-enter
Windows 95 to have the other application recognize the printer change. 

This is the preferred method of changing the printer if the code is to
be platform independent; this method will work on Windows 3.1, Windows
95 and Windows NT. 

For additional information, please see the following article(s) in the
Microsoft Knowledge Base: 

   ARTICLE-ID: Q140560
   TITLE     : How to Set the Default Printer Programmatically in
Windows
               95


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

Date: Fri, 5 Dec 1997 08:16:53 +0100
From: "Hans Van Lint" <hvanlint@lodestar.be>
Subject: validation problem
Message-Id: <6689h9$bgh$1@news2.xs4all.nl>

Can someone explain me why this doesn't work?

Someone fills in a form and the following data is beeing sent,
15
100
LDSFK,

# checken of integer
$i = 0;
$geenint = 0;

foreach $veld (%input){
     if (($i+2) % 2 != 0){
          $response = ($veld =~ /^[+-]?\d+$/) ? "OK" : "NO";
          if ($response eq "NO"){ $geenint = 1;}
 $i++;
}}

if ($geenint == 1){
 print "Please fill in numbers only. Go back and correct your data.<P>";
}
else
{
       #continue with program
}




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

Date: Fri, 05 Dec 1997 01:20:06 -0500
From: Kazutaka Abe <kabe01@idt.net>
Subject: Win32::EventLog
Message-Id: <34879D16.CB0@idt.net>

I'm trying to write the Perl program to check the Windows NT's event log
periodically. Win32::Packages with Perl5 gives us Win32::EventLog to
make an access to the NT Event Log.

However, it doesn't seem to be good.
I tried the sample program: Open and Read the Event Log.

use Win32::EventLog;

my $EventLog;
my %event=( 
        'Length',NULL, 
        'RecordNumber',NULL, 
        'TimeGenerated',NULL, 
        'TimeWritten',NULL, 
        'EventID',NULL,
        'EventType',NULL,  
        'Category',NULL, 
        'ClosingRecordNumber',NULL, 
        'Source',NULL, 
        'Computer',NULL, 
        'Strings',NULL,
        'Data',NULL, 
); 

#Opening the log file on my computer, looking for system's events       
Open Win32::EventLog($EventLog,'System','') || die $!

#Reading the first event
$EventLog->Read((EVENTLOG_SEEK_READ|EVENTLOG_FORWARDS_READ),1,$event);

#Conversion of the date
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
                = localtime($event->{'TimeGenerated'});

#printing the event
print "date : $mon/$mday/$year\n";

#to get a readable EventId
$event->{'EventID'} = $event->{'EventID'} & 0xffff;

#Print the Event
foreach $i (keys %event)
{
print "$i : $event->{$i}\n";
}


If we select "System" in the Open statement, it works.  But when putting
"Application", "Security", it won't work.

Is there anybody who's using this package?
Please advise.

Jack Abe
Nikko Securities
kabe01@idt.net


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

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

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