[8214] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1832 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 8 13:14:11 1998

Date: Sun, 8 Feb 98 10:00:27 -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, 8 Feb 1998     Volume: 8 Number: 1832

Today's topics:
    Re: Error with analysis of system () return value on Pe <c.evans@clear.net.nz>
        GD.pm:  Problem with outputted .gif file <cgonderz@alpha1.csd.uwm.edu>
    Re: GD.pm: Problem with outputted .gif file (Honza Pazdziora)
    Re: GD.pm: Problem with outputted .gif file <cgonderz@alpha1.csd.uwm.edu>
    Re: Help - Programming Perl <rjk@coos.dartmouth.edu>
        how can I split using / as the delimeter? <gedavis3@vt.edu>
    Re: how can I split using / as the delimeter? (Craig Berry)
    Re: how can I split using / as the delimeter? (Abigail)
        How do you call an .HTM from a Perl script? <thehelm@ibm.net>
    Re: How do you call an .HTM from a Perl script? (Abigail)
    Re: How do you call an .HTM from a Perl script? <rjk@coos.dartmouth.edu>
        HREF tag parsing <dgoyette@NoMoreSPAMpcisys.net>
    Re: HREF tag parsing (Abigail)
        INC list on IIS3 <tola@hehe.com>
    Re: INC list on IIS3 <rjk@coos.dartmouth.edu>
    Re: killing a child process after a timeout (Chip Salzenberg)
    Re: killing a child process after a timeout (Chip Salzenberg)
    Re: killing a child process after a timeout <dhoover@textwise.com>
    Re: killing a child process after a timeout (Chip Salzenberg)
        making $( $) $< $> work for perl Win32 (binkley)
        making $( $) $< $> work for perl Win32 (binkley)
        making $( $) $< $> work for perl Win32 (binkley)
    Re: Newbie about plunge into Perl asks... (Robbie Baldock (real email address at foot of message))
        Pertl NT4 IIS file upload <myleslawrence@email.msn.com>
    Re: quick .signature  hack (Sitaram Chamarty)
    Re: quick .signature  hack (Sitaram Chamarty)
        save, etc. using FileHandle instead of open <dhoover@textwise.com>
    Re: Sending EOF to an opened pty (Sitaram Chamarty)
    Re: Socket Connections (Sitaram Chamarty)
    Re: This group active? (I R A Aggie)
        Webmasters????? rbhattac@jetson.uh.edu
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 8 Feb 1998 22:58:43 +1300
From: Carey Evans <c.evans@clear.net.nz>
Subject: Re: Error with analysis of system () return value on Perl book page 230
Message-Id: <874t2ato32.fsf@psyche.evansnet>

jdf@pobox.com (Jonathan Feinberg) writes:

> (Concerning the difficulty in handling the return value of system())
> 
> Isn't this ripe for a module?  Unix::System or some such?  Or would
> it be too hairy, too system-dependent?

use POSIX qw(:sys_wait_h);

$stat = system('/bin/false');
printf "0x%04x %d %d\n", $stat, WIFEXITED($stat), WEXITSTATUS($stat);
$stat = system('sh', '-c', 'kill -SEGV $$');
printf "0x%04x %d %d %d\n", $stat, WIFEXITED($stat), WIFSIGNALED($stat),
       WTERMSIG($stat);

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	  GNU GPL: "The Source will be with you... always."


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

Date: 8 Feb 1998 05:35:01 GMT
From: Christopher Gonderzik <cgonderz@alpha1.csd.uwm.edu>
Subject: GD.pm:  Problem with outputted .gif file
Message-Id: <6bjg65$366$1@uwm.edu>

Hello all,

Just started playing with Perl 5.004_02 on Win95 and was messing with the
very cool perl port of GD (GD.pm).  I tried out a sample program found in
the documentation and modified it so that instead of outputting to STDOUT,
it wrote the .gif to a file.

Well, the file was written to disk successfully, but the .gif did not look
OK at all when viewed with an image viewer (ACDSee).  The circle sort of
appeared, but there were all these red 'scanlines' throughout the image.
Very strange.

I figure there is something I'm doing wrong when I write the image to
disk.  Perhaps I'm assuming incorrectly that the GD::Image->gif method
output can be written to a file handle.  I have searched the FAQ's and
this newsgroup to no avail.

In addition, when viewing the outputted .gif in ACDSee, the viewer reports
that the image is 'truncated'.

Any ideas?
TIA,
Chris Gonderzik
cgonderz@csd.uwm.edu

Here is the code in question:   

---------------------------
#!/usr/local/bin/perl -w

use GD;
use diagnostics;
        
# create a new image
$im = new GD::Image(100,100);

# allocate some colors
$white = $im->colorAllocate(255,255,255);
$black = $im->colorAllocate(0,0,0);       
$red = $im->colorAllocate(255,0,0);      
$blue = $im->colorAllocate(0,0,255);

# make the background transparent and interlaced
$im->transparent($white);
$im->interlaced('true');

# Put a black frame around the picture
$im->rectangle(0,0,99,99,$black);

# Draw a blue oval
$im->arc(50,50,95,75,0,360,$blue);

# And fill it with red
$im->fill(50,50,$red);

# Convert the image to GIF and write it to a file
open( FILE, ">foo.gif" ) || die "Error: $!";
print FILE $im->gif;
close( FILE );


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

Date: Sun, 8 Feb 1998 14:28:58 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: GD.pm: Problem with outputted .gif file
Message-Id: <adelton.886948138@aisa.fi.muni.cz>

Christopher Gonderzik <cgonderz@alpha1.csd.uwm.edu> writes:

> Well, the file was written to disk successfully, but the .gif did not look
> OK at all when viewed with an image viewer (ACDSee).  The circle sort of
> appeared, but there were all these red 'scanlines' throughout the image.
> Very strange.
> 
> I figure there is something I'm doing wrong when I write the image to
> disk.  Perhaps I'm assuming incorrectly that the GD::Image->gif method
> output can be written to a file handle.  I have searched the FAQ's and
> this newsgroup to no avail.
> 
> In addition, when viewing the outputted .gif in ACDSee, the viewer reports
> that the image is 'truncated'.
> 
> Any ideas?

[...]

> # Convert the image to GIF and write it to a file
> open( FILE, ">foo.gif" ) || die "Error: $!";
> print FILE $im->gif;
> close( FILE );

Can't it be because you are not using binmode on that file? I have
reports that XBase files written on Windoze are corrupt because that
OS writes something else to the disk than you tell it. You'll probably
want to add binmode somewhere are that open, or persuate Perl 5
Porters that that files should be binmode by default.

Hope this helps,

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


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

Date: 8 Feb 1998 16:13:34 GMT
From: Christopher Gonderzik <cgonderz@alpha1.csd.uwm.edu>
Subject: Re: GD.pm: Problem with outputted .gif file
Message-Id: <6bklje$loc$2@uwm.edu>


YES!!  That was exactly the problem.  Once I did a 'binmode FILE;' the
file was written correctly.  Arghh Windoze!!  So used to UNIX, I make
assumptions that all OS'es are as good...

Thank you!
-Chris.
cgonderz@csd.uwm.edu


 Honza Pazdziora <adelton@fi.muni.cz> wrote:

: Can't it be because you are not using binmode on that file? I have
: reports that XBase files written on Windoze are corrupt because that
: OS writes something else to the disk than you tell it. You'll probably
: want to add binmode somewhere are that open, or persuate Perl 5
: Porters that that files should be binmode by default.

: Hope this helps,


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

Date: Sun, 08 Feb 1998 11:51:42 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: cowboy@cnnw.net
Subject: Re: Help - Programming Perl
Message-Id: <34DDE2A1.465B1BDC@coos.dartmouth.edu>

[posted and mailed]

cowboy@cnnw.net wrote:
>
> Can someone help me here...I'm reading the book Programming Perl and
> I'm at the beggining and i'm working on the excercise Grades....

[which starts on page 9]

> when I try to run it I get this message...
> 
> Illegal division by zero at document.pl line 17, <GRADES> chunk 10.
> 
> then if I take this section....
> 
> foreach $student (sort keys %grades) {
>     $scores = 0;
>     $total = 0;
> 
>  and change it to this...
> 
> foreach $student (sort keys %grades) {
>     $scores = 1;
>     $total = 1;
> 
> It works, except it doesnt average the grades it gives each student an
> average of one....do they explain any of this later on? or is
> something wrong...I have been thru the script several times to make
> sure that I wrote it out right....if they do explain this please dont
> give me the answer....if they dont can someone help?? Thanx :)

Either your input file is formatted incorrectly, or you mistyped the code.


Let's take a look at the code:
[Programming Perl 2nd Ed, pg 10]

#!/usr/local/bin/perl

open(GRADES, "grades") or die "Can't open grades: $!\n";
while ($line = <GRADES>) {
    ($student, $grade) = split(" ", $line);
    $grades{$student} .= $grade . " ";
}

foreach $student (sort keys %grades) {
    $scores = 0;
    $total = 0;
    @grades = split(" ", $grades{$student});
    foreach $grade (@grades) {
        $total += $grade;
        $scores++;
    }
    $average = $total / $scores;   # line 17
    print "$student: $grades{$student}\tAverage: $average\n";
}
__END__

Note that each time through the inner loop, $scores is incremented.
The only way you will get a divide by zero error is if the inner loop
is never entered on some iteration of the outer loop.
If you set $scores to 1 and $total to 1, you get an average of 1,
one again indicating that the inner loop is not being entered.
This will only happen if your input file is formatted incorrectly.

Take a look at your "grades" file and make sure every line is formatted
like this:
Bob 72

There should be no blank lines, no comment lines, no lines except Name Grade.

Keep in mind that this program is meant to demonstrate what has been covered
in the book up to that point.  If it were for actual use, it would be more
robust, ensuring the divide by zero doesn't happen and so on.

Hope that helps!

Chipmunk


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

Date: Sun, 8 Feb 1998 03:24:23 -0500
From: "Jerry Davis" <gedavis3@vt.edu>
Subject: how can I split using / as the delimeter?
Message-Id: <6bjq5p$21u$1@solaris.cc.vt.edu>

I would like to use the split command  @array =(/ +/,$string);
the above command would split $string by any number of spaces.

How would you split any number of / charecters.

I tried
split(//+/, $string)
split(///+/, $string)
to no effect.

The only book on perl I has says simply to use / as a charecter, just
precede it with a / (i.e //)

Jerry




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

Date: 8 Feb 1998 08:54:31 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how can I split using / as the delimeter?
Message-Id: <6bjrs7$8vk$1@marina.cinenet.net>

Jerry Davis (gedavis3@vt.edu) wrote:
: I would like to use the split command  @array =(/ +/,$string);
: the above command would split $string by any number of spaces.
: 
: How would you split any number of / charecters.

  split m!/+!, $string;

If you use explicit 'm' matching, you're free to pick any delimiter.

Or, escape the /, like this.

  split /\/+/, $string;

 ...though that version suffers from Leaning Toothpick Syndrome.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 8 Feb 1998 09:26:08 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: how can I split using / as the delimeter?
Message-Id: <6bjtng$pqt$2@client3.news.psi.net>

Jerry Davis (gedavis3@vt.edu) wrote on 1622 September 1993 in
<URL: news:6bjq5p$21u$1@solaris.cc.vt.edu>:
++ I would like to use the split command  @array =(/ +/,$string);
++ the above command would split $string by any number of spaces.
++ 
++ How would you split any number of / charecters.

As perlop could have told you, any of the following would work:

          split m,/,, $string;
          split /\//, $string;

++ The only book on perl I has says simply to use / as a charecter, just
++ precede it with a / (i.e //)

You need a better book.


Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


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

Date: 8 Feb 98 08:40:48 GMT
From: "Charles Wilkins" <thehelm@ibm.net>
Subject: How do you call an .HTM from a Perl script?
Message-Id: <01bd346d$14948800$86d548a6@slip166-72-213-134.ut.us.ibm.net>

I am trying to call up HTM documents form my Perl scripts without using an
anchor tag (hyperlink). Can anybody tell me how to do it?

Thanks in advance!

Charles Wilkins
thehelm@ibm.net


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

Date: 8 Feb 1998 09:28:52 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How do you call an .HTM from a Perl script?
Message-Id: <6bjtsk$pqt$3@client3.news.psi.net>

Charles Wilkins (thehelm@ibm.net) wrote on 1622 September 1993 in
<URL: news:01bd346d$14948800$86d548a6@slip166-72-213-134.ut.us.ibm.net>:
++ I am trying to call up HTM documents form my Perl scripts without using an
++ anchor tag (hyperlink). Can anybody tell me how to do it?

Your question has nothing to do with modules; your posting in
comp.lang.perl.modules was uncalled for.

Furthermore, your question is formulated very poorly. I don't know
what you exactly want, but odds are that your question isn't a
perl question at all. Try comp.infosystems.www.authoring.cgi.


Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

Date: Sun, 08 Feb 1998 12:02:07 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: thehelm@ibm.net, comp.lang.perl.modules@coos.dartmouth.edu
Subject: Re: How do you call an .HTM from a Perl script?
Message-Id: <34DDE512.1FAA3CA2@coos.dartmouth.edu>

[posted and mailed to Charles Wilkins]

Abigail wrote:
> 
> Charles Wilkins (thehelm@ibm.net) wrote:
> ++ I am trying to call up HTM documents form my Perl scripts without using an
> ++ anchor tag (hyperlink). Can anybody tell me how to do it?
> 
> Your question has nothing to do with modules; your posting in
> comp.lang.perl.modules was uncalled for.

I'd say it has everything to do with modules!
Specifically, LWP and HTML::Parse.

Chipmunk


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

Date: 8 Feb 1998 08:31:46 GMT
From: "Don" <dgoyette@NoMoreSPAMpcisys.net>
Subject: HREF tag parsing
Message-Id: <01bd346b$abfef600$61664ccf@586win95>

Hello,

I am in need of a CGI script that reads a file that contains URL's, and for
each URL in the file, does the following...

1. Make sure the URL is an HTML document.

2. Within this document, locate all HREF links to files of one or more file
extensions (for example: ".mid" and ".kar").  The exact list of extensions
can be hard-coded.

3. Obtain the following information for each HREF link (file):
   A. complete URL, including filename (ie.
"http://domain/page.html/file.mid")
   B. Text embeded in the HREF tag
   C. File size (in bytes)
   D. File date

4. Write this data to an output file, each record contains A|B|C|D (from
above with |=separator) and ends with a C/R + L/F.

This script needs to be in PERL since we have access to run PERL programs. 
Can anyone point me to any example code anywhere that does this kind of
thing?  If not, what would it cost to have something like this small script
written?

Thank you!

-Don Goyette
(dgoyette"at-sign"pcisys.net)



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

Date: 8 Feb 1998 09:34:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: HREF tag parsing
Message-Id: <6bju6b$pqt$4@client3.news.psi.net>

Don (dgoyette@NoMoreSPAMpcisys.net) wrote on 1622 September 1993 in
<URL: news:01bd346b$abfef600$61664ccf@586win95>:
++ Hello,
++ 
++ I am in need of a CGI script that reads a file that contains URL's, and for
++ each URL in the file, does the following...
++ 
++ 1. Make sure the URL is an HTML document.

Eh? URLs are URLs. HTML documents are HTML documents. An URL might
reference an object of type text/html, it will never *be* an HTML
document.

++ 
++ 2. Within this document, locate all HREF links to files of one or more file
++ extensions (for example: ".mid" and ".kar").  The exact list of extensions
++ can be hard-coded.
++ 
++ 3. Obtain the following information for each HREF link (file):
++    A. complete URL, including filename (ie.
++ "http://domain/page.html/file.mid")
++    B. Text embeded in the HREF tag

HREF tag? Uhm, which variant of HTML is that?
Netscape-begining-of-februari-1998?

++    C. File size (in bytes)
++    D. File date
++ 
++ 4. Write this data to an output file, each record contains A|B|C|D (from
++ above with |=separator) and ends with a C/R + L/F.
++ 
++ This script needs to be in PERL since we have access to run PERL programs. 
++ Can anyone point me to any example code anywhere that does this kind of
++ thing?  If not, what would it cost to have something like this small script
++ written?


This smells like a homework problem to me....



Abigail
-- 
perl -we '%_ = map {local $_ = $_; y/a-z/n-za-m/; ($_, $_)} @_ = map {lc} <>;
          print grep {$_{$_}} @_' < /usr/dict/words


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

Date: Sat, 7 Feb 1998 20:41:08 +0100
From: "Tobias" <tola@hehe.com>
Subject: INC list on IIS3
Message-Id: <886947254.790574@nn1>

SGkNCkknbSBoYXZpbmcgcHJvYmxlbSBmaW5kaW5nIHJlcXVlc3QgLnBsIGZpbGVzIHRoYXQgYXJl
IHBsYWNlZCBpbiB0aGUgc2FtZSBkaXIgYXMgdGhlIGNhbGxpbmcgLnBsIG9uIG15IElJMyBzZXJ2
ZXIuIFRoZSBQZXJsLmV4ZSByZXNwb25kcyBpdCBjYW4ndCBmaW5kIHRoZSBmaWxlIHdpdGhpbiB0
aGUgc2VhcmNoIHBhdGggZGVmaW5kIGluIHRoZSBASU5DIGxpc3QuIA0KQW55b25lIGtub3dzIGhv
dyB0byBjaGFuZ2UgdGhlIGdsb2JhbCBASU5DIGxpc3Q/DQoNCi9Ub2JpYXMNCg0KDQo=



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

Date: Sun, 08 Feb 1998 11:57:17 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Tobias <tola@hehe.com>
Subject: Re: INC list on IIS3
Message-Id: <34DDE3EF.9A23600C@coos.dartmouth.edu>

[posted and mailed]

Tobias wrote:
> 
> Anyone knows how to change the global @INC list?

Preferred way:

use lib 'path/to/libdir';

Chipmunk


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

Date: Sun, 08 Feb 1998 07:12:17 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: killing a child process after a timeout
Message-Id: <6bjlvc$6mv$1@cyprus.atlantic.net>

According to tchrist@mox.perl.com (Tom Christiansen):
>In comp.lang.perl.misc, "Rajan Troostwyk [8000885]" 
>    <troostwyk_rajan@jpmorgan.com> writes:
>:This should rsh to "ahost" do a ls of /tmp/*.old and be killed after 60
>:seconds if the child has not exited.
>
>Chip says you can't use signals.  Well, I'd love to hear him tell me
>why the following approach isn't not just right, but in fact, provably
>correct.  I'll even take theorectical answers rather than practical ones.

Tom and I have corresponded privately on this.  My summary:

Yes, this approach is reasonably safe for the specific case of SIGCHLD.
However, it does require an extra fork and a guardian process that lives
as long as the child.  I hardly think that an approach that doubles the
number of running processes is anything but a curiousity.

And of course this trick does not address any other uses of signals,
particularly SIGALRM which is second (or maybe first?) most often caught
signal.

So, if this is an example of what it takes to make Perl's signals safe
and reliable in even a practical (if not theoretical) sense, then I'd
say it supports my position admirably.

Perl needs reliable signals.  It doesn't have them.  In the meantime,
I cannot condone the use of Perl signal handlers.

PS: XSUB code to (1) set a signal's handler to a tiny C function that
only sets a variable, and (2) access that variable, are so trivial as
not to be worth writing here.  Suffice it to say that my not having
produced such code on demand should not be taken as evidence that doing
so would be hard.

And a blast from the past in Tom's sig:

>There's some side effect based on the fact that SIGCHLD isn't sent by
>anyone, but is fabricated by the kernel when a child dies.  It's a huge
>kludge.  But then, it _is_ SysV. --Chip Salzenberg, aka <chs@nando.net>

Yeah, SysV signals are automatically reset to SIG_DFL before the signal
handler is called -- except for SIGCHLD.  Also SysV signals are sent by
kill() as discrete events -- except for SIGCHLD, which is more like a
"level" interrupt, being held long as a process has a dead child.  Bleh.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
        "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
           ->  Ask me about Perl training and consulting  <-
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Sun, 08 Feb 1998 07:13:57 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: killing a child process after a timeout
Message-Id: <6bjm33$6ng$1@cyprus.atlantic.net>

According to tchrist@mox.perl.com (Tom Christiansen):
>It's simply not acceptable to tell people "no" like this.

"Should we cross the street at this blind corner?"  "No."
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
        "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
           ->  Ask me about Perl training and consulting  <-
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Sun, 08 Feb 1998 11:45:04 -0500
From: Dean Hoover <dhoover@textwise.com>
Subject: Re: killing a child process after a timeout
Message-Id: <34DDE110.72FD@textwise.com>

Chip Salzenberg wrote:
> 
> According to "Rajan Troostwyk [8000885]" <troostwyk_rajan@jpmorgan.com>:
> >I found that the system calls would sometimes hang, so I added the
> >"manage_proc" and a "kill_child" functions included below. This seemed
> >to kill the child processes sometimes but other times I would get a
> >defunct child process and "manage_proc" function would hang at the
> >waitpid line ???.
> 
> You are using Perl signal handlers.
> 
> Don't.  They don't work reliably.
Why not? is it buggy? If so, any idea when a fix can be expected?
> 
> You must do what you want some other way.
Any suggestions? (I want to do the same thing).

Regards.

Dean Hoover


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

Date: Sun, 08 Feb 1998 17:44:18 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: killing a child process after a timeout
Message-Id: <6bkr11$c10$1@cyprus.atlantic.net>

According to Dean Hoover <dhoover@textwise.com>:
>Chip Salzenberg wrote:
>> You are using Perl signal handlers.
>> Don't.  They don't work reliably.
>
>Why not? is it buggy? If so, any idea when a fix can be expected?

Yes, it's buggy.  It has been ever since the feature was introduced.
And there are two basic ways to make it non-buggy.

The first is to delay signal handler execution until it can be done
safely.  I have a patch to do this, but it has not been accepted
because its performance hit, while modest, is unacceptable.  There is
work afoot to make this cost affect only programs that use signal
handlers, but that work has not produced anything yet.

The second way is to use threads and dedicate one thread to signal
handler execution.  That will become possible in 5.005, but it is
not what I recommend (unless absolutely necessary), because using
threads is likely to incur a much greater performance penalty than
my signal patch.

A third approach is to drop the whole mess and write a Perl extension
(.xs) that handles signals with signal handlers written in C that just
set a variable which your application can poll.

I wish you success in whichever path you choose.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
        "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
           ->  Ask me about Perl training and consulting  <-
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Sun, 8 Feb 1998 07:38:04 -0500
From: "B. K. Oxley (binkley)" <binkley@bigfoot.com>
Subject: making $( $) $< $> work for perl Win32
Message-Id: <6bk926$hdq$1@ndnws01.ne.highway1.com>

Is there any effort to make the user/group id variables work under Win32, if
only partially?  It may be problematic to make the fully equivalent to their
counterparts on UNIX, but it seems proper to at least support them as
read-only string variables, e.g., "$<" evaluating to "USER\DOMAIN".

Of course, the "effective" versions make no sense, and the numeric versions
would need to use GUIDs (128-bit numbers or equivalent structures) which is
probably infeasible for the immediate future.

--binkley





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

Date: Sun, 8 Feb 1998 07:38:04 -0500
From: "B. K. Oxley (binkley)" <binkley@bigfoot.com>
Subject: making $( $) $< $> work for perl Win32
Message-Id: <6bk8vg$hd2$1@ndnws01.ne.highway1.com>

Is there any effort to make the user/group id variables work under Win32, if
only partially?  It may be problematic to make the fully equivalent to their
counterparts on UNIX, but it seems proper to at least support them as
read-only string variables, e.g., "$<" evaluating to "USER\DOMAIN".

Of course, the "effective" versions make no sense, and the numeric versions
would need to use GUIDs (128-bit numbers or equivalent structures) which is
probably infeasible for the immediate future.

--binkley





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

Date: Sun, 8 Feb 1998 07:38:04 -0500
From: "B. K. Oxley (binkley)" <binkley@bigfoot.com>
Subject: making $( $) $< $> work for perl Win32
Message-Id: <6bkdam$k86$1@ndnws01.ne.highway1.com>

Is there any effort to make the user/group id variables work under Win32, if
only partially?  It may be problematic to make the fully equivalent to their
counterparts on UNIX, but it seems proper to at least support them as
read-only string variables, e.g., "$<" evaluating to "USER\DOMAIN".

Of course, the "effective" versions make no sense, and the numeric versions
would need to use GUIDs (128-bit numbers or equivalent structures) which is
probably infeasible for the immediate future.

--binkley





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

Date: Sun, 08 Feb 1998 15:56:20 GMT
From: postmaster@127.0.0.1 (Robbie Baldock (real email address at foot of message))
Subject: Re: Newbie about plunge into Perl asks...
Message-Id: <34ddd3f0.5908937@news.easynet.co.uk>

Thanks all for the earlier replies to my original query.  

I only just noticed anyone was replying as my provider's news server
is not exactly "news hungry"!  I did, however, manage to track down
the earlier replies through DejaNews...


Robbie


----------------------------------
Robbie Baldock
rcb@easynet.co.uk
http://easyweb.easynet.co.uk/~rcb/
----------------------------------


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

Date: Sun, 8 Feb 1998 07:10:46 -0800
From: "Myles Lawrence" <myleslawrence@email.msn.com>
Subject: Pertl NT4 IIS file upload
Message-Id: <eHUjFLKN9GA.54@upnetnews03>

Does anyone know where I can find a file upload module for Win32 perl that
handles more than a 130K file.
mylesl@zeno.com myleslawrence@msn.com




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

Date: 8 Feb 1998 14:33:41 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: quick .signature  hack
Message-Id: <slrn6dq89o.6ko.sitaram@ltusitaram.diac.com>

On Fri, 6 Feb 1998 17:49:29 -0500, Mark Crane <mecran01@homer.louisville.edu>
wrote:
>
>This is a pathetic attempt to get some perl wizard to write a
>simple script for me.  Please stop reading now if you find this
>annoying, etc.
[snip]

>2. select a quote at random.

Take a look at the "fortune" program sources.  IIRC it has a bunch of programs
that includes one called "randstr" which does precisely what you want.


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

Date: 8 Feb 1998 14:33:46 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: quick .signature  hack
Message-Id: <slrn6dq8q7.6ko.sitaram@ltusitaram.diac.com>

On Fri, 06 Feb 1998 18:04:03 -0800, Philip Mikal <philipm@nafohq.hp.com> wrote:
>Here... this might help you on your way. Then you can maybe have an

[snip]

># now we get them all
>open (SIGDATA, "$path_to_sig_data");

The next 3 lines may as well be:
    @the_sigs = <SIGDATA>;

>while (<SIGDATA>) {
>        push (@the_sigs, $_);
>        }

>close (SIGDATA);

But that's a long script to give someone who's "lazy" :-)

You may as well do the whole thing like this: (untested)

perl -e '@sigs=<>; srand; print $sigs[int(rand(@sigs))]' all.sigs > .sig

If your sigs are multiline, do man perlrun and figure out how to read in
"paragraph" mode...then separate sigs by one blank line.

HTH


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

Date: Sun, 08 Feb 1998 11:40:36 -0500
From: Dean Hoover <dhoover@textwise.com>
Subject: save, etc. using FileHandle instead of open
Message-Id: <34DDE004.3F13@textwise.com>

I want to do the kind of thing that is shown on page 193 of the
camel book whereby STDOUT is redirected to a file. I want to
use the FileHandle module to accomlish this (and also avoid
BAREWORD warnings) but am unclear on how to go about it. The
following is a distilled version of page 193:

#!/home/dhoover/bin/perl

open(SAVEOUT, ">&STDOUT");
open(STDOUT, ">foo.out");
select STDOUT; $| = 1;
print "hello, world\n";
close(STDOUT);
open(STDOUT, ">&SAVEOUT");

Any help will be appreciated.

Dean Hoover


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

Date: 8 Feb 1998 14:33:50 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Sending EOF to an opened pty
Message-Id: <slrn6dq9j6.6ko.sitaram@ltusitaram.diac.com>

On 6 Feb 1998 22:40:12 GMT, James F. Hranicky <jfh@tick.cise.ufl.edu> wrote:
>Hi there, 
>
>Anyone know how to send an EOF to program B (stdin, stdout, stderr are all
>dup(2)'ed to an open pty) from program A? I tried 

Wouldnt closing the file being written by A work?


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

Date: 8 Feb 1998 14:33:48 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Socket Connections
Message-Id: <slrn6dq95g.6ko.sitaram@ltusitaram.diac.com>

On Sat, 07 Feb 1998 01:51:39 GMT, David Efflandt <efflandt@xnet.com> wrote:
>Beverly Treadwell <beverlyt@datequest.com> wrote:
>
>>Hi,
>>I am trying to run the following code and am getting the error message
>>'Unsupported socket function "getprotobyname" called at prereg.pl line
>>29'.  What's wrong?  The socket.pm file is being found.  Any help would
>>be truly appreciated.  My code looks like this.

[snip]

>>$ipaddress = "207.165.90.100";
>
>Dots have special meaning in double quoted strings.  Either use single
>quotes or escape the dots. Examples:
>
>$ipaddress = '207.165.90.100';
>$ipaddress = "207\.165\.90\.100";

I have no clue what the real problem (Unsupported socket function, etc) is,
but the above is certainly not true.  Dots have special meanign inside a
double quoted string when used as a regex pattern, not as a simple literal.

Sitaram
-------
(And you can tell by this line that the original poster prolly knew this
anyway...)
>>@pieces = split(/\./, $ipaddress);


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

Date: Sun, 08 Feb 1998 11:09:42 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: This group active?
Message-Id: <fl_aggie-0802981109420001@aggie.coaps.fsu.edu>

In article <34dd3145.10796691@news.badger1.net>, admin@badger1.net (cdog) wrote:

[posted && cc'd]

+ Is this group active?

No, not at all...

James - maybe you need a better newsfeed?

-- 
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/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Sun, 08 Feb 1998 01:51:09 -0600
From: rbhattac@jetson.uh.edu
Subject: Webmasters?????
Message-Id: <886922392.1103495176@dejanews.com>

Hello,

I am currently starting a new project (www.webresource.net) and am
looking for an experienced cgi/perl programmer to head the CGI section of
the site.  The main responsibilites will be to write at least two to
three articles a month on a topic related to CGI/Perl.	The ideal
applicant will have at least one year of solid programming experience and
good writing skills.  We are already receiving offers for advertising on
the site.  As for revenues, everything will be split down the middle. 
Please feel free to check out the website.

If you are interested, please email your resume and a few urls where I
can find your work. Serious applicants only!

Rishi Bhattacharya
Electrical Engineer
NASA/McDonnell Douglas

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


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

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

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