[18338] in Perl-Users-Digest
Perl-Users Digest, Issue: 506 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 16 14:16:00 2001
Date: Fri, 16 Mar 2001 11:15:34 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984770133-v10-i506@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 16 Mar 2001 Volume: 10 Number: 506
Today's topics:
Re: Spaces in path to perl script (NT) <paul@indigoproductions.be>
Re: Spaces in path to perl script (NT) (Glyndwr)
Re: Spaces in path to perl script (NT) <lmoran@wtsg.com>
Re: Spaces in path to perl script (NT) (Miguel Cruz)
Re: Spaces in path to perl script (NT) <Steve_Alpert@idx.com>
Re: Straight array output (Craig Berry)
Re: Unix trap command in Perl on Win? gunter_steinbach@agilent.com
Re: Unix trap command in Perl on Win? <bsugars@canoe.ca>
Re: Unix trap command in Perl on Win? (Anno Siegel)
Re: Unix trap command in Perl on Win? <dlheim@collins.rockwell.com>
Re: Unix trap command in Perl on Win? nobull@mail.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 Mar 2001 16:50:57 GMT
From: Paul Goris <paul@indigoproductions.be>
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <B6D80302.AD2B%paul@indigoproductions.be>
in article slrn9b4e0e.170.glynFOOdwr@glyndwr.dyndns.org, Glyndwr at
glynFOOdwr@FSCKdeleteEmeD.co.uk wrote on 16/3/01 16:57:
> On Fri, 16 Mar 2001 14:51:33 GMT, Paul Goris scribbled:
>> Well, maybe I'm missing the very obvious here... Thanks for any ideas about
>> what's going on here, that would really help us out!
>
> This is webserver issue; IIS is choking on the spaces, not Perl. My only
> experience of IIS resulting in a half-day of premature hair-loss
> followed by and install of Apache for NT, so I can't help you, I'm
> afraid.
Sure, the problem apparently lies with NT/IIS I suppose, but it's also true
that directory names with spaces are no problem when calling regular html of
image files, whereas they are when you try to access a Perl script.
So I suppose my question isn't really off topic and I'm still hoping other
posters here would be aware of this issue and be able to give a clue about
what to do...
Hope your hair has started growing back...
cheers,
Paul Goris
------------------------------
Date: Fri, 16 Mar 2001 17:06:41 GMT
From: glynFOOdwr@FSCKdeleteEmeD.co.uk (Glyndwr)
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <slrn9b4i1h.170.glynFOOdwr@glyndwr.dyndns.org>
On Fri, 16 Mar 2001 16:50:57 GMT, Paul Goris scribbled:
>in article slrn9b4e0e.170.glynFOOdwr@glyndwr.dyndns.org, Glyndwr at
>glynFOOdwr@FSCKdeleteEmeD.co.uk wrote on 16/3/01 16:57:
>> This is webserver issue; IIS is choking on the spaces, not Perl. My only
>> experience of IIS resulting in a half-day of premature hair-loss
>> followed by and install of Apache for NT, so I can't help you, I'm
>> afraid.
>
>Sure, the problem apparently lies with NT/IIS I suppose, but it's also true
>that directory names with spaces are no problem when calling regular html of
>image files, whereas they are when you try to access a Perl script.
From what little experience of IIS I had - and that was IIS 5 - it has
seperate settings for CGI and normal directories, as you'd expect
really. Go back and check the CGI part of them, as I suspect that might
be the problem. In particular, check that the CGI directory is defined
as
"c:\foo bar\"
and not
c:\foo bar
>So I suppose my question isn't really off topic and I'm still hoping other
>posters here would be aware of this issue and be able to give a clue about
>what to do...
You might be lucky there... good luck anyway.
>Hope your hair has started growing back...
I lose another few threads everytime I touch something with "MS" on the
box :o(
--
-=G=-
Web: http://www.fscked.co.uk ICQ: 66545073
------------------------------
Date: Fri, 16 Mar 2001 12:12:57 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <lrh4btgn24uchsakc24bhml327knn95o45@4ax.com>
On Fri, 16 Mar 2001 13:30:45 GMT, Paul Goris
<paul@indigoproductions.be> wrote wonderful things about sparkplugs:
>The obvious solution would be to eliminate the spaces from the directory
>names, but unfortunately that is not possible.
This isn't exactly a Perl question but since I know the answer...
Use the 8.3 name.
For instance
C:\Program Files 8.3s to C:\Progra~1
If you don't know what the 8.3 (Short) name is and can't cigure it out
do DIR /x and it will show you SHORTNAME (8.3) then LONGNAME.
With this info adjust your Perl script accordingly.
Again, this has practically nothing to do with Perl.
>
>All my thanks for any help on this!
>
>Paul Goris
>
--
Member of the Nondeterministic Football League
------------------------------
Date: Fri, 16 Mar 2001 17:56:03 GMT
From: mnc@admin.u.nu (Miguel Cruz)
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <Tsss6.1$Fb.92@typhoon2.ba-dsg.net>
Paul Goris <paul@indigoproductions.be> wrote:
> Sure, the problem apparently lies with NT/IIS I suppose, but it's also true
> that directory names with spaces are no problem when calling regular html of
> image files, whereas they are when you try to access a Perl script.
> So I suppose my question isn't really off topic and I'm still hoping other
> posters here would be aware of this issue and be able to give a clue about
> what to do...
I've had to deal with this back in my very unhappy IIS days. It occurred
with any application set up as a server-side handler for a particular file type.
The only solution at the time seemed to be to make sure the path contained
no spaces.
With a static HTML page or image, it locates the file using its normal
mechanism and handles it appropriately. With a file that's being handled
externally, it has to take the file name and provide it as input to the
handler (in your case, the Perl interpreter). And this is where it fails -
it does not package the spaces properly. I would suggest using symlinks but
I guess Windows still doesn't have those (does it?). IIS does not seem to
follow shortcuts so that won't work.
miguel
------------------------------
Date: Fri, 16 Mar 2001 12:23:36 -0500
From: Steve Alpert <Steve_Alpert@idx.com>
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <bvi4btk96l1ch8lpd223175hvht0t3qp28@4ax.com>
Paul Goris <paul@indigoproductions.be> wrote:
>We have to run a Perl script from within a directory that contains spaces in
>the path to it. Everytime we try to acces the script, an error occurs saying
>the script can't be found.
>
>We run MIIS 4.0 on an NT machine.
>
>The path to the script is someting like:
>
>D:\Web\Directory with Spaces\Folder\thescript.cgi
>
...[stuff deleted]...
How 'bout finding out what its simple name is:
C:\>dir/x p*
Volume in drive C is WINNT
Directory of C:\
11/14/97 01:20p <DIR> PROGRA~1 Program Files
11/17/97 08:48a <DIR> POWERTOY PowerToy
So I'd use PROGRA~1 in place of "Program Files"
/sra
Steve Alpert (Steve_Alpert @ i d x . c o m)
IDX Systems Corp. Boston, Massachusetts
------------------------------
Date: Fri, 16 Mar 2001 18:32:09 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Straight array output
Message-Id: <tb4n195hq9te58@corp.supernews.com>
George Kluver (GKluver@deja.com) wrote:
: How might one print to screen twenty arrays in straight, vertical columns?
: Each column is the contents of one of them.
The answer has two components: (1) How to iterate over a bunch of arrays
one element at a time, and (2) how to format columns neatly. The latter
is a bigger can of worms, since the options are so varied -- formats,
tabs, hand-padding, and so on and on. So we'll leave that for you to deal
with, and concentrate on (1).
Here's how I'd do it. For simplicity and neatness, I'm using four arrays
rather than 20, but that's not important to the technique. Note that it's
important that each array have the same number of elements, and my code
does *not* check for this.
#!/usr/bin/perl -w
# ascols - function and demo code which prints multiple arrays in columns
# Craig Berry (20010316)
use strict;
sub ascols {
for (my $i = 0; $i < @{$_[0]}; $i++) {
print join("\t", map { $_->[$i] } @_), "\n";
}
}
ascols( [ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 9, 9 ],
[ 10, 11, 12 ] );
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Fri, 16 Mar 2001 14:55:05 +0000 (UTC)
From: gunter_steinbach@agilent.com
Subject: Re: Unix trap command in Perl on Win?
Message-Id: <984763505.681885@emperor.labs.agilent.com>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to David L. Heim <dlheim@collins.rockwell.com>:
>> Is there a way to mimic the behavior of the Unix "trap" command in
>> Perl on a windows platform?
>
> See what the %SIG array does.
Here is a similar question but in a simpler context:
I'd like to remove a tempfile anytime my perl script exits, whether by
exit or by die. In the shell I can use 'trap "rm $tempfile" 0' to do
that, but Perl's %SIG does not cover normal exit - or does it? I read the
perlipc man page but cannot find the solution.
Thanks.
--
Gunter Steinbach gunter_steinbach@agilent.com
------------------------------
Date: Fri, 16 Mar 2001 18:03:13 GMT
From: Benjamin Sugars <bsugars@canoe.ca>
Subject: Re: Unix trap command in Perl on Win?
Message-Id: <Pine.LNX.4.21.0103161243020.865-100000@marmot.rim.canoe.ca>
On Fri, 16 Mar 2001 gunter_steinbach@agilent.com wrote:
> Here is a similar question but in a simpler context:
You really should change the Subject when you change the subject.
> I'd like to remove a tempfile anytime my perl script exits, whether by
> exit or by die. In the shell I can use 'trap "rm $tempfile" 0' to do
> that, but Perl's %SIG does not cover normal exit - or does it? I read the
> perlipc man page but cannot find the solution.
Take a look at section 5 of the FAQ. If you don't want to use IO::File,
open a file and immediately unlink it.
Note that the END routine in the FAQ won't get called if you're exiting
because of an uncaught signal and the temp file will be left behind. The
IO::File/unlink() methods are immune to that (unless the signal arrives
between the open() and the unlink()).
Cheers,
-Ben
--
signer: can't create ~/.sig: Socket operation on non-socket
------------------------------
Date: 16 Mar 2001 18:13:26 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Unix trap command in Perl on Win?
Message-Id: <98tl46$g66$2@mamenchi.zrz.TU-Berlin.DE>
According to <gunter_steinbach@agilent.com>:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > According to David L. Heim <dlheim@collins.rockwell.com>:
> >> Is there a way to mimic the behavior of the Unix "trap" command in
> >> Perl on a windows platform?
> >
> > See what the %SIG array does.
>
> Here is a similar question but in a simpler context:
> I'd like to remove a tempfile anytime my perl script exits, whether by
> exit or by die. In the shell I can use 'trap "rm $tempfile" 0' to do
> that, but Perl's %SIG does not cover normal exit - or does it? I read the
> perlipc man page but cannot find the solution.
You, too, should have looked up what the %SIG array (well hash) does.
This is not exactly IPC, is it? You would have found __DIE__
(and __WARING__). Then there are END {} blocks.
Finally, if you live in a Unix world, you can even unlink the temp
file after creation (for read/write, usually). As long as you keep
the file open, the file exists as an anonymous file and goes away on
close. As far as other processes are concerned, it's gone already.
Anno
------------------------------
Date: Fri, 16 Mar 2001 11:56:33 -0600
From: "David L. Heim" <dlheim@collins.rockwell.com>
Subject: Re: Unix trap command in Perl on Win?
Message-Id: <3AB253D1.9A167583@collins.rockwell.com>
You may be correct.
I could not get Perl's %SIG to perform my designated sub when a user
logged out or closed Perls window on NT.
The subroutine does work when called at the end of the program -
normal exit.
I put all the following in place:
my $subdir;
my $temproot;
.
.
.
sub remove_temp {
#IF program interrupted
opendir(THISDIR,".");
@allfiles = grep(!/^\.\.?$/, readdir(THISDIR));
unlink @allfiles;
chdir ("$temproot");
rmdir ("$subdir");
exit(0);
}
$SIG{'INT'} = 'remove_temp';
$SIG{'QUIT'} = 'remove_temp';
$SIG{'KILL'} = 'remove_temp';
$SIG{__DIE__} = 'remove_temp';
Dave
=======================================================================
David L. Heim phone: (319)295-8616
Mechanical Design Support page: (319)490-0933
Rockwell Collins, Inc. fax: (319)295-4182 (Include M/S 106-186)
400 Collins Road NE email: dlheim@collins.rockwell.com
Cedar Rapids, IA 52498
M/S 106-186
=======================================================================
gunter_steinbach@agilent.com wrote:
>
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > According to David L. Heim <dlheim@collins.rockwell.com>:
> >> Is there a way to mimic the behavior of the Unix "trap" command in
> >> Perl on a windows platform?
> >
> > See what the %SIG array does.
>
> Here is a similar question but in a simpler context:
> I'd like to remove a tempfile anytime my perl script exits, whether by
> exit or by die. In the shell I can use 'trap "rm $tempfile" 0' to do
> that, but Perl's %SIG does not cover normal exit - or does it? I read the
> perlipc man page but cannot find the solution.
>
> Thanks.
> --
> Gunter Steinbach gunter_steinbach@agilent.com
--
------------------------------
Date: 16 Mar 2001 18:28:27 +0000
From: nobull@mail.com
Subject: Re: Unix trap command in Perl on Win?
Message-Id: <u9n1ald0vo.fsf@wcl-l.bham.ac.uk>
gunter_steinbach@agilent.com writes:
> Here is a similar question but in a simpler context:
> I'd like to remove a tempfile anytime my perl script exits, whether by
> exit or by die. In the shell I can use 'trap "rm $tempfile" 0' to do
> that, but Perl's %SIG does not cover normal exit - or does it?
FAQ: "How can I do an atexit()..."
> I read the perlipc man page but cannot find the solution.
The fact that program termination in shell is treated like a signal is
an artifact of shell.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V10 Issue 506
**************************************