[9250] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2845 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 11 17:08:01 1998

Date: Thu, 11 Jun 98 14:00:28 -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           Thu, 11 Jun 1998     Volume: 8 Number: 2845

Today's topics:
    Re: [META] hypersensitivity (Greg Bacon)
    Re: [META] hypersensitivity (Greg Bacon)
    Re: access to a hash of lists <gabriele@kollwitz.doit.wisc.edu>
    Re: access to a hash of lists (Sean McAfee)
    Re: accessing a:\ <jsd@hudsucker.gamespot.com>
    Re: Adding ~/directory to lib path (Jonathan Stowe)
    Re: ceil or trunc (Mike Stok)
    Re: CFV: comp.lang.perl.moderated moderated (John Stanley)
    Re: CFV: comp.lang.perl.moderated moderated (John Stanley)
    Re: Command line substitution thru subdirectories <david.x.corcoran@boeing.com>
    Re: Document contains no data? <gabriele@kollwitz.doit.wisc.edu>
    Re: flock on Win32 <gabriele@kollwitz.doit.wisc.edu>
    Re: Help with Perl CGI script <upsetter@ziplink.net>
    Re: Help with Perl CGI script (Jonathan Stowe)
    Re: How do I read a file from someone's web site? (Jonathan Stowe)
    Re: I want threads, threads and more threads! <jdporter@min.net>
        Is XS to "C" faster and less resource intensive? mserafino@my-dejanews.com
    Re: McCabe complexity analysis (Paul David Fardy)
    Re: More Perlish file size (bytes, KB, MB) <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: network monitoring (perl daemon), should dump data  (Jonathan Stowe)
    Re: Opening Files <jdporter@min.net>
    Re: Perl Books? lisam@oreilly.com
        Perl5.004_04 Win32 build problems <smithr@lexma.meitech.com>
    Re: question on a process mgmt (how to kill a child pro <gabriele@kollwitz.doit.wisc.edu>
    Re: question on a process mgmt (how to kill a child pro <gabriele@kollwitz.doit.wisc.edu>
    Re: Redirecting STDOUT/STDERR to a file (Jonathan Stowe)
    Re: Why it's stupid to `use a variable as a variable na (Sean McAfee)
    Re: Win32::GetShortPathName bug? (Jan Dubois)
    Re: Win32::GetShortPathName bug? (Jonathan Stowe)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 11 Jun 1998 20:47:19 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: [META] hypersensitivity
Message-Id: <6lpfon$iju$2@info.uah.edu>

In article <35802C15.3D11@min.net>,
	John Porter <jdporter@min.net> writes:
: There is a man, whose initials are rms -- a brilliant, pioneering, and
: widely respected computer scientist; he would disagree with you on this
: point.  He attempted to learn Perl from the provided documentation, and 
: gave up in utter frustration.  So how good can the be really?

Hmm.. man emacs.. with apologies to seebs, I eventually got bored and
went back to vi.

Hmm.. man sendmail.. no joy.

Hmm.. man unix.. :-(

man win95..

man gcc..

Wow.. what's going on here?  I don't feel any enlightenment.

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 11 Jun 1998 20:40:51 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: [META] hypersensitivity
Message-Id: <6lpfcj$iju$1@info.uah.edu>

jimbo@soundimages.co.uk writes:
: gbacon@cs.uah.edu (Greg Bacon) writes:
: > Have you stopped beating your wife?
: 
: The observation stands. Why all the anguish?

I got tired of the same old boring ``ad hominem attacks add nothing to
your position''.  Ad hominem looked really fun, and I wanted to give it
a whirl.

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Thu, 11 Jun 1998 14:43:50 -0500
From: "Gabriele R. Fariello" <gabriele@kollwitz.doit.wisc.edu>
To: John Cartwright <jcartwright@wans.net>
Subject: Re: access to a hash of lists
Message-Id: <Pine.LNX.3.96.980611144125.1263E-100000@kollwitz.doit.wisc.edu>

On Thu, 11 Jun 1998, John Cartwright wrote:

> Hello All,
> 
> I am trying to get a list representing the first list element in every
> hash element.  For example, if
> 
> %HoL = (
>        "flintstones"        => [ "fred", "barney" ],
>        "jetsons"            => [ "george", "jane", "elroy" ],
>        "simpsons"           => [ "homer", "marge", "bart" ],
>      );
> 
> what I would like is a list with ("fred","george","homer")
> 
> I have been trying variations on the following statement but without
> success.
> 
> @a = @{values %HoL}[0];
> 

Well there's always:

my @a;
foreach (keys %HoL)
  {
  push @a, ${$HoL{$_}}[0];
  }

but us you are looking for a 1 lines instead of a 4 liner, I donno.

-Gabriele



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

Date: Thu, 11 Jun 1998 20:40:24 GMT
From: mcafee@choplifter.rs.itd.umich.edu (Sean McAfee)
Subject: Re: access to a hash of lists
Message-Id: <YgXf1.545$Y3.2918735@news.itd.umich.edu>

In article <3580249C.FDE503EF@wans.net>,
John Cartwright  <jcartwright@wans.net> wrote:
>I am trying to get a list representing the first list element in every
>hash element.  For example, if

>%HoL = (
>       "flintstones"        => [ "fred", "barney" ],
>       "jetsons"            => [ "george", "jane", "elroy" ],
>       "simpsons"           => [ "homer", "marge", "bart" ],
>     );

>what I would like is a list with ("fred","george","homer")

>I have been trying variations on the following statement but without
>success.

>@a = @{values %HoL}[0];

What about:

@a = map { $$_[0] } values %HoL;

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: 11 Jun 1998 19:51:41 GMT
From: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: accessing a:\
Message-Id: <6lpcgd$pfp$1@its.hooked.net>

Nathan Torkington <gnat@frii.com> wrote:
> 	open(A, "|2another program")			|| die;
> 	$contents = suck_the_file(A)			|| die;
> 	close(A)					|| die;
> 	$tree = parse($contents)			|| die;
> 	ringbark($tree)					|| die;
> 	pulp($tree)					|| die;

i wish perl had a way to automatically raise exceptions.  one of my
favorite things about the DBI module is you can set RaiseError to 1
and never have to worry about checking returns.  wrap a bunch of
statements in a block eval and you're good to go.

-- 
Jon Drukman                                            jsd@gamespot.com
-----------------------------------------------------------------------
Plan: Eat right, exercise regularly, die anyway.


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

Date: Thu, 11 Jun 1998 20:59:28 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Adding ~/directory to lib path
Message-Id: <35803c68.11794100@news.btinternet.com>

On Thu, 11 Jun 1998 15:25:23 -0400, Rich Bowen wrote :

>I am looking for a way to add a user directory, like ~/modules, to the
>Perl lib path, so that users can put their own modules in their own
>/home/user/modules directory and have those modules available to Perl
>without having to push @INC, '/home/user/modules/' in every script. 

<snip>

check what it has to say about the PERL5LIB environment variable in
the perlrun manpage.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 11 Jun 1998 20:53:44 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: ceil or trunc
Message-Id: <6lpg4o$26q@news-central.tiac.net>

In article <35802E04.993E17A4@cisco.com>,
Gopinath Venkataramanan  <vgopinat@cisco.com> wrote:

>Is there a ceil or trunc function in perl (to round off numbers)

the int function (documented in perlfunc man page) will truncate a number
to an integer, your options for rounding are discussed in the list of
frequently asked questions (FAQ) - in section 4 under Data: Numbers.

In recent perl distributions

  perldoc -f int

should get you the documentation on the int function and

  perldoc perlfaq4

should get section 4 of the FAQ for you.

If these fail then you can visit http://www.perl.com and follow the
Documentation of FAQs links.

Hope this helps,

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 11 Jun 1998 20:21:22 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: CFV: comp.lang.perl.moderated moderated
Message-Id: <6lpe82$34p$1@news.NERO.NET>

In article <6lpco2$5u0@bolt.sonic.net>, Eric Eisenhart <eric@sonic.net> wrote:

Oops, moderator shows lack of knowledge of netiquette. It is considered
rude to redirect followups without saying so in your message.

>In article <6lp45m$sm1$1@news.NERO.NET>,
>John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
>>Yes, and when you are in DejaNews, you might wander through the
>>perl.porters-gw archive. That is where the request for volunteers was
>>made. If you weren't on that mailing list/newsgroup, you didn't know
>>there was a chance to volunteer, until the RFD with the list of proposed
>>moderators was posted.
>
>I'm very passively on perl5-porters.  I never saw/noticed a message
>requesting volunteers.  Yet, somehow, I managed to volunteer after seeing
>the first RFD.

I am not on perl5-porters at all, and I saw the message. If you want to
find it, DejaNews is your friend. 



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

Date: 11 Jun 1998 20:24:54 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: CFV: comp.lang.perl.moderated moderated
Message-Id: <6lpeem$35j$1@news.NERO.NET>

In article <6lpa8b$qos$1@aurwww.aur.alcatel.com>,
John Klassa <klassa@aur.alcatel.com> wrote:
>On 11 Jun 1998 17:36:21 GMT, John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
>->In article <6lop9h$ajj$5@info.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>->>In article <6loasp$3ol$2@bsdti6.sdm.de>,
>->>	Steffen Beyer <sb@sdm.de> writes:
>->>: In other words, the people frequenting this newsgroup will have *NO*
>->>: democratic means of controlling the moderation panel.
>->>
>->>There will be a public mailing list for people interested in the group's
>->>policies.  Moderators are appointed and removed by a two-thirds majority
>->>vote.  
>->
>->Of the moderation panel. Not the readership.
>
>Personally, I don't see the problem...  

I don't see one either. I just wanted to make sure that nobody inferred
that the vote mentioned in the second sentence referred to the "people
interested in the group's policies" mentioned in the first. 

>I trust the people who will be on
>the moderation panel, and expect the new group to be vastly more useful
>than this one (due, largely, to the change in the S/N ratio).  

Vastly more useful for some. More readable for many. But if you can't
afford to post then it is worth less than the current group when it
comes to answering your questions.



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

Date: Thu, 11 Jun 1998 19:30:49 GMT
From: David Corcoran <david.x.corcoran@boeing.com>
Subject: Re: Command line substitution thru subdirectories
Message-Id: <35803069.2195@boeing.com>

Jason Turner wrote:
> 
> On Tue, 09 Jun 1998 17:11:05 -0400, Bob Roklan posted
> <357DA4E9.DA495FD6@code80.npt.nuwc.navy.mil>:
> 
> > I am running Perl 5.003 on Windows 95.
> <...>
> >    perl -i.old -p -e "s/foo/bar/g" *.htm
> >
> >but how can I tell perl to do the same for a specified directory and
> >down?
> 
I'd do this (though I recollect the -i not working under windoze95)

-----------
dir /s/b *.htm >enmase.bat
vi enmase.bat
1,$s!^!perl -i.old -p -e "s/foo/bar/g" !
:wq
enmase
-----------

I have found it much easier overall under windoze to do things like
this in steps as opposed to an elegant solution (more easily achvievable
with a real shell).


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

Date: Thu, 11 Jun 1998 15:05:16 -0500
From: "Gabriele R. Fariello" <gabriele@kollwitz.doit.wisc.edu>
Subject: Re: Document contains no data?
Message-Id: <Pine.LNX.3.96.980611150154.1263G-100000@kollwitz.doit.wisc.edu>

On 11 Jun 1998, Scratchie wrote:

> Dave Barnett <barnett@houston.Geco-Prakla.slb.com> wrote:
> :> I recently downloaded and installed the Omnihttpd server on my
> :> computer.  When I try to run simple Perl scripts locally I get the
> :> message "Document contains no data."  What does this mean?
> :> Thanks
> I've seen two people post this in this thread. If you leave the
> Content-type header off, you'll get a server error message, not a blank
> document. "Document Contains No Data" usually means that the script made
> it through the interpreter, emitted the content-type header, and *then*
> died before it printed anything else.

Very true. Missing the content-type (which is the minimum required header
by a script) will give you an 500 error (usually internal server error, at
least on Apache and IIS). You shoul dbe able to look at the error_log file
for run-time error output. It is usually found in /var/log/httpd/error_log
or somewheres thereabout on UNIX systems.

-Gabriele



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

Date: Thu, 11 Jun 1998 14:50:05 -0500
From: "Gabriele R. Fariello" <gabriele@kollwitz.doit.wisc.edu>
To: Jouke Visser <jouke@com-bat.nl>
Subject: Re: flock on Win32
Message-Id: <Pine.LNX.3.96.980611144537.1263F-100000@kollwitz.doit.wisc.edu>


flock() is not supported under FAT16 WinNT, but should work under NTFS.
flock() requires system file security support which is not available under
Win95, Win98 or FAT16 under WinNT (you'll notice that if you have a NTFS
and a FAT16 partition  available under WinNT that your security options
are very different for files on the two volumes). This is a OS specific
issue. MacOS also does not have flock() although Rhapsody Does! (but it's
really UNIX).

-Gabriele



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

Date: 11 Jun 1998 19:45:31 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Help with Perl CGI script
Message-Id: <6lpc4r$k9g@fridge.shore.net>

Jason Bodine <jbodine@internetpro.net> wrote:
: Hi Tom:

: Guess I should be a little more specific. LOL.  I have no problem making
: my script send mail using the good old-fashioned To: and From: headers.
: What I *do* have a problem with is writing a program that can utilize
: the Cc: and Bcc: headers as well.

???

Why can't you simply print those headers to the mail program when you're
printing your To: and From: headers?? Am I missing something here?

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


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

Date: Thu, 11 Jun 1998 20:59:33 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Help with Perl CGI script
Message-Id: <35804326.13454482@news.btinternet.com>

On Thu, 11 Jun 1998 17:05:08 GMT, Jason Bodine wrote :

>Hi Tom:
>
>Guess I should be a little more specific. LOL.  I have no problem making
>my script send mail using the good old-fashioned To: and From: headers.
>What I *do* have a problem with is writing a program that can utilize
>the Cc: and Bcc: headers as well.
>
Eh,Oh

The example in perlfaq9 examples the use of Mail::Header module.  It
is possible to infer from this how to add the extra headers you
require. 

If you have a piece of code that you find is not working then it might
help if post it here.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 11 Jun 1998 20:59:31 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: How do I read a file from someone's web site?
Message-Id: <35804177.13089011@news.btinternet.com>

On 11 Jun 1998 14:23:26 GMT, scott@softbase.com wrote :

<snip>

>  my ($remote, # the name of the SMTP server
>      $port,   # the mail port

<snip>

You can confuse us that easily you know.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 11 Jun 1998 20:40:22 GMT
From: John Porter <jdporter@min.net>
Subject: Re: I want threads, threads and more threads!
Message-Id: <3580422B.6CA7@min.net>

Gabriele R. Fariello wrote:
> 
> 4) Something else, better, mo better than what I have been able to come up
> with.

Umm, have you considered the SysV IPC routines?  msg*, shm*, sem* ???

John Porter


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

Date: Thu, 11 Jun 1998 20:45:19 GMT
From: mserafino@my-dejanews.com
Subject: Is XS to "C" faster and less resource intensive?
Message-Id: <6lpfkv$est$1@nnrp1.dejanews.com>

I have a project heavily dependent on many concurrently forking perl
processes. I must also issue a few different non-perl library calls many
times from these processes. I thought XS implemented with SWIG would result
in less CPU and memory usage than forking executables from perl to run the
library routines in separate processes. Preliminary testing seems to indicate
that running the routines in separate processes and capturing the output is
actually faster and less resource intensive. This even seemed to be the case
even when i created my own perl executable with statically built in
extensions. Does anyone know which of the two would typically be less
expensive?

thanx in advance - mike s.


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


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

Date: 11 Jun 1998 15:40:55 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: McCabe complexity analysis
Message-Id: <6lotq7$c3e$1@coranto.ucs.mun.ca>

Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels) writes:
> Why do even respected authors (and many more programming
> standards documents) state that you should write (in 'C'):
> 
> 	handle = fopen(file_name, mode);
> 	if (handle == NULL) return -1;
> 
> instead of the much more elegant:
> 
> 	if ((handle = fopen(file_name, mode)) == NULL)
> 		return -1;

Elegance is in the eye of the beholder.

I think that one of the great boons of object-oriented programming is
the try-throw-catch mechanism.  The primary flow of control should be

	action1();
	action2();
	action3();

and any form of error handling code tends to detract from that flow.
It's harder to read the actions in code like:

	if (action1() == -1) {
		handle_error1();
	}
	if (!action2()) {
		handle_error2();
	}
	if (action3() == NULL) {
		handle_error3();
	}

I find that the following structure accentuates the positive as
much as one can without a try-throw-catch mechanism.

	action1()
		|| handle_error1()
	action2()
		|| handle_error2()
	action3()
		|| handle_error3()

but this also requires one standardize the value of failure.

It's simply easier to scan the actions which I think are, to varying
degrees, obscured by the conditional syntax and by the conditional
expression itself where there isn't a standard expression for
failure or success:

	if ((fp = stdio_func()) == NULL)
	if ((rval = system_call()) == -1)

And one also has to consider the other common idioms:

	if (!isdigit(ch))
	if (strcmp(s1, s2) != 0)

Of course, in these cases, no "action" is performed in the conditional
expressions.  But that presents another point: there's a little extra
processing just to determine "IS there any work being done here?"

[ Maybe there's something to be said for never doing work within a
  conditional.  I've never carried the argument that far before.
  It's certainly extreme, though. :-)

  "It's more of a guideline than a rule."
      -- Peter Venkman, Ghostbusters ]

Somewhere in the Unix culture, we're taught to put everything into
the conditional; "it's the elegant way" as you say.  But I don't
think it's true.  If the flow is

    action1();
    action2();
    action3();

and the handling of errors is secondary (though still crucial), then
we shouldn't place the actions within the error handling code.
Thus, the real work

    fp = fopen(file, mode);

is augmented by error handling code:

    fp = fopen(file, mode);
    if (fp == NULL)
        return -1;

But the try-throw-catch mechanism is so much nicer: concise code,
no repeated error handling code, and no requirement that a function
be able to return some sort of out-of-range value.

Then again, Tom C. probably showed a better argument by making a
mistake that is more often made when one overworks the conditional
expression. :-)

Paul Fardy
-- 
Paul David Fardy                      |  pdf@morgan.ucs.mun.ca
Computing and Communications          |  pdf@InfoNET.st-johns.nf.ca
Memorial University of Newfoundland   |
St. John's, NF  A1C 5S7               |


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

Date: Thu, 11 Jun 1998 21:53:23 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: More Perlish file size (bytes, KB, MB)
Message-Id: <3580B443.499D@comenius.ms.mff.cuni.cz>

Joe McMahon wrote:
> 
> In article <6kv4q7$qup@newshub.atmnet.net>, "C.W.Holeman II"
> <choleman@simpact.com> wrote:
> 
> >This works but how about something more Perlish?
> 
> Okay, how about a tied scalar that automagically prints out reformatted?
> Very Perlish, but kinda silly...
> 
>  --- Joe M.
> 
> use KFormatter;
> tie $memsize,"KFormatter";
> $memsize = 20_345_645;
> print $memsize; # 319.40M2
> 
<code snipped>

You may want to look at Interpolation.pm 
( http://www.plover.com/~mjd/perl/Interpolation/ )


use Interpolation kilo => sub {do something with $_[0] ...};

print "The file is $kilo{-s $filename}\n";

Hi, Jenda
-------------------------------------------------------------------
use Interpolation "'" => sub{$_=$_[0];s/'/''/g;"'".$_};
$db->Sql(qq{SELECT * FROM Table WHERE Name = $'{"d'Artagnan"}'});


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

Date: Thu, 11 Jun 1998 20:59:27 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: network monitoring (perl daemon), should dump data to snmpd?
Message-Id: <35803ad8.11446754@news.btinternet.com>

On Thu, 11 Jun 1998 19:04:02 GMT, John Ruckstuhl wrote :

<snip>

>If not, how does one typically make their sw friendly to remote
>monitoring by network management software -- providing performance and
>other statistics on demand via a remote procedure call.
>
<snip>

You might check out:

/CPAN//modules/by-category/05_Networking_Devices_IPC/SNMP/

At your favourite sunsite or www.perl.com.  I cant vouch for its
utility but it might be worth a try.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 11 Jun 1998 20:30:40 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Opening Files
Message-Id: <35803FE7.6949@min.net>

F.Quednau wrote:
> It took me 1 minute to answer your question, but almost 30 minutes to get the
> conditional right. I know, this is not a Perl question, but why are the
> following two conditionals not equivalent? Let me answer this myself...
> 
> if ($file ne "." || $file ne "..")

unless ( $file =~ /^\.{1,2}$/ )

John Porter


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

Date: Thu, 11 Jun 1998 11:35:09 -0700
From: lisam@oreilly.com
Subject: Re: Perl Books?
Message-Id: <3580235D.4BDC@oreilly.com>

John Bokma wrote:
> 
> Gary M. Greenberg <garyg@gator.net> wrote in article
> <MPG.fe8f0beda6f2e06989682@news.gator.net>...
> > In article <6lk5qf$kdu$1@nnrp1.dejanews.com>, ptimmins@netserv.unmc.edu
> > says...
> > [snip]
> > > Try O'Reilly and Assoc at www.oreilly.com
> > >
> > > Learning Perl, 2nd Edition (Schwartz, Christiansen, and Wall)
> > > Programming Perl, 2nd Edition (Wall, Christiansen, and Schwartz)
> > >
> > > "Learning ..." is intro, 302 pp, $29.95 American
> > And, let's not forget that all O'Reilly later editions are 25% off to you when you tear out the title page from your old edition and mail it in with your order for the new one ;-p
> 
> What!? That's torture of animals. Ripping the skin of a Lama or Camel.
>

I prefer to think of it as something more benign...maybe camel or llama
shedding? 

Lisa 
http://conference.perl.com


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

Date: Thu, 11 Jun 1998 16:10:37 -0400
From: "Ray Smith" <smithr@lexma.meitech.com>
Subject: Perl5.004_04 Win32 build problems
Message-Id: <6lpdf7$5t0$1@client2.news.psi.net>

As a first time builder from the Perl distribution I encountered a few
problems.  I don't know if they are all my doing or the result of incomplete
testing of Win32 instalation procedures.  We are running under Windows
NT4.0, using Microsoft Visual C++ compiler version 5.0.
I made the following modifications below to  ..\Win32|Makefile to attempt to
make the build work:
I was only partially successful.  The primary executables perl.exe,
perl95.exe, etc. seem to build.  However, the extensions such as Socket
failed because the Makefile produced in ../ext/Socket does not contain the
path to my compiler's include directory!  I have been unable to figure how
to pass this information from its setting in the top level Makefile.

A further problem: config_sh.pl expects args of the form name=value, where
as Microsoft linker expects the library path to be specified as
/LIBPATH:path.


Any help would be greatly appreciated.

Regards,
Ray Smith, smithr@lexma.meitech.com

Output from most recent running of make:
D:/crs/perl/perl5.004_04/win32[296] nmake
Microsoft (R) Program Maintenance Utility   Version 1.62.7022
Copyright (C) Microsoft Corp 1988-1997. All rights reserved.
        cd ..\ext\Socket
        ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
Writing Makefile for Socket
        nmake -nologo


    cl.exe -c  -MD -DWIN32 -O     -DVERSION=\"1.6\"  -DXS_VERSION=\"1.6\"  -
I..\..\lib\CORE  Socket.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 11.00.7022 for 80x86
Copyright (C) Microsoft Corp 1984-1997. All rights reserved.
Socket.c
 ..\..\lib\CORE\win32.h(13) : fatal error C1083: Cannot open include file:
'windo
ws.h': No such file or directory
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'c:\progra~1\devstu~1\vc\bin\nmake.exe' : return
code
 '0x2'
Stop.

Difference output, showing my changes:
< : changes to  Makefile to get past errors
>:  Original Makefile contents (just minimal modifications per readme
instructions)
??? (to right) my comments / questions

D:/crs/perl/perl5.004_04/win32[295] diff Makefile Makefile.or
1c1
< # makefile            10-Jun-98  crs, Modify -> d:\perl5404
---
> # makefile            10-Jun-98  crs, Create
14,17c14,15
< ###INST_DRV=c:
< ###INST_TOP=$(INST_DRV)\perl
< INST_DRV=d:
< INST_TOP=$(INST_DRV)\perl5044
---
> INST_DRV=c:
> INST_TOP=$(INST_DRV)\perl
30,31c28
< ###CCHOME = $(MSVCDIR)
< CCHOME = c:\progra~1\DEVSTU~1\vc
---
> CCHOME = $(MSVCDIR)
39d35
< EMAIL = smithr@lexma.meitech.com
56,58c52
< # Why no "-I$(CCINCDIR) ???"
< ###INCLUDES = -I.\include -I. -I..
< INCLUDES = -I.\include -I. -I.. -I$(CCINCDIR)                    ??? Why
didn't original ref the include compiler's include dir ???
---
> INCLUDES = -I.\include -I. -I..
94,96c88
< # Need link lib path
??? Same for linker's path for libraries
< ##LINK_FLAGS  = -nologo $(LIBFILES) $(LINK_DBG) -machine:I386
< LINK_FLAGS  = -nologo $(LINK_DBG) -libpath:$(CCLIBDIR) -machine:I386
$(LIBFILE
S)
---
> LINK_FLAGS  = -nologo $(LIBFILES) $(LINK_DBG) -machine:I386
311c303
<           "INST_TOP=$(INST_TOP)" "cc=$(CC)" "cflags=$(CFLAGS)
$(RUNTIME) -DWIN
32" \
---
>           "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(RUNTIME) -DWIN32" \
313c305
<           "libpath=$(CCLIBDIR)" "libc=$(LIBC)" \
---
>           "libpth=$(CCLIBDIR)" "libc=$(LIBC)" \
326,327c318,319
<       $(LINK32) $(LINK_FLAGS) -subsystem:console -out:$@ @<<
<               ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
---
>       $(LINK32) -subsystem:console -out:$@ @<<
>               $(LINK_FLAGS) ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
D:/crs/perl/perl5.004_04/win32[296]




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

Date: Thu, 11 Jun 1998 15:11:23 -0500
From: "Gabriele R. Fariello" <gabriele@kollwitz.doit.wisc.edu>
To: Greg Hersh <ghersh@bbnplanet.com>
Subject: Re: question on a process mgmt (how to kill a child process without creating zombie)
Message-Id: <Pine.LNX.3.96.980611150803.1263H-100000@kollwitz.doit.wisc.edu>

On Thu, 11 Jun 1998, Greg Hersh wrote:

> I have a situation where I have to fork multiple child processes but
> if any of those haven't finished in say 10 minutes, kill them.
> Then start the whole thing again, and again, and again ...
> 
> A script (Perl 5.004) forks the processes, saves pid of each, 
> goes to sleep for 10 minutes, wakes up, then waitpid with WNOHANG
> option and issues kill 9 $pid if return status = 0.
>  Unfortunately if child does get killed, this creates a zombie
> processes. After a while I got quite a few of them. Is there any
> way to terminate the child without creating a zombie?
> 
> (a child is written in C which I would rather not change)
> 
> (a script runs on Solaris 2.5)
> 
> Thanks,
> 

I am far from an expert in child processes, as I am learning about them
right now myself, but do you have a wait() or waitpid() statement after
you send a kill -9 to the procesess?

Also of note: if you do not have an HUP sighandler in your child code,
sending an HUP signle might be a better idea as it gives perl a chance to
clean up, but will stop running the script right away (just like control-c
at the console).

-Gabriele

P.S. Inform me if I have misspoken.




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

Date: Thu, 11 Jun 1998 15:13:13 -0500
From: "Gabriele R. Fariello" <gabriele@kollwitz.doit.wisc.edu>
To: Greg Hersh <ghersh@bbnplanet.com>
Subject: Re: question on a process mgmt (how to kill a child process without creating zombie)
Message-Id: <Pine.LNX.3.96.980611151155.1263I-100000@kollwitz.doit.wisc.edu>

Oops, forgot that your child was in C. You might still want to use HUP
instead, but the scenario changes quite a bit and my comment's don't hold
true.

-Gabriele



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

Date: Thu, 11 Jun 1998 19:56:59 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Redirecting STDOUT/STDERR to a file
Message-Id: <35803409.9746276@news.btinternet.com>

On Thu, 11 Jun 1998 13:42:15 -0400, Tony Roeder wrote :

>This is a multi-part message in MIME format.
>--------------3ACBB46E77B0092ED0FADA49
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>

You now know how bad this stuff looks to us.  It is only of any use to
a small number of widely despised newsreaders and for the rest it
merely serves to obscure the content of your post.  If you cant stop
your software from inserting the vcard stuff then I would suggest a
change in software.

>Using Perl under Windows NT - could someone clarify exactly (a code
>example) how to redirect STDOUT and STDERR to a file. Thanks in advance.
>

You can simply re-open the STDOUT or STDERR filehandles to the
required file - how to do so is described in the documentation.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 11 Jun 1998 20:36:34 GMT
From: mcafee@choplifter.rs.itd.umich.edu (Sean McAfee)
Subject: Re: Why it's stupid to `use a variable as a variable name'
Message-Id: <mdXf1.544$Y3.2916615@news.itd.umich.edu>

In article <1daflxm.nmi5dosz59f0N@slip166-72-108-44.ny.us.ibm.net>,
Kevin Reid <kpreid@ibm.net> wrote:
>Zenin <zenin@bawdycaste.org> wrote:
>>       Always, always use strict.  If you have a small piece that needs
>>       soft refs, subs, etc then mark it as such:

>>       use strict;
>>       {
>>           no strict 'refs';  # eg, warning: we are doing funky things here
>>           ...magic only goes here...
>>       }

>TMTOWTDI. If you want obfuscation, you can also get around "use strict
>'refs'" by accessing the symbol table:

>$var = "Yup!\n";

>print ${$::{'var'}{SCALAR}};

ITYM:

print ${*{$::{'var'}}{SCALAR}};

Or, more succinctly,

print ${$::{'var'}};

<blink> <blink>  Wow, I hadn't realized how easy it was to get around 'use
strict'.  Only five additional characters, if the variable is in package
'main'.

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Thu, 11 Jun 1998 21:59:45 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Win32::GetShortPathName bug?
Message-Id: <358734c8.10446631@news2.ibm.net>

[mailed & posted]

radke@dsdl.ee.iastate.edu (Kevin Radke) wrote:

>As the following code shows, it appears
>Win32::GetShortPathName is returning a string
>that is too long.  This is running under Windows NT v4 SP3.
>A quick look at the output of this test file shows an embedded
>null character in the returned string.  My guess is it is
>returning a buffer the length of the input string.  Or am
>I doing something incorrectly?  This is the 5.004_02 perl
>binary distribution from CPAN...

This bug has been fixed in Perl 5.004_04.

-Jan


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

Date: Thu, 11 Jun 1998 20:59:30 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Win32::GetShortPathName bug?
Message-Id: <35803d5a.12036209@news.btinternet.com>

On 11 Jun 1998 18:22:05 GMT, Kevin Radke wrote :

>As the following code shows, it appears
>Win32::GetShortPathName is returning a string
>that is too long.  This is running under Windows NT v4 SP3.
>A quick look at the output of this test file shows an embedded
>null character in the returned string.  My guess is it is
>returning a buffer the length of the input string.  Or am
>I doing something incorrectly?  This is the 5.004_02 perl
>binary distribution from CPAN...
>
<snip>
>
>U:\perl>type shortname.pl
>use Win32;
>
>my ($long_name) = "C:\\Program Files\\";
>my ($short_name) = Win32::GetShortPathName ($long_name);
>print ("Short name is '$short_name'\n");
>
>U:\perl>perl shortname.pl
>Short name is 'C:\PROGRA~1\ les\'
>

For myself I would accept this as a <ahem> feature of working with
Win32 rather than a bug and work around it. But your point of view may
differ of course.

if the extraneous stuff is actually delimited by a space then you
could do something like:

$short_name =~ s/ .*$//;

or if indeed a null:

$short_name =~ s/\0.*$//;

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

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

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