[8104] in Perl-Users-Digest
Perl-Users Digest, Issue: 1723 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 25 02:07:33 1998
Date: Sat, 24 Jan 98 23:00:24 -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 Sat, 24 Jan 1998 Volume: 8 Number: 1723
Today's topics:
Accpeting command line input such as ".- .." <jsjacks@primenet.com>
Re: Accpeting command line input such as ".- .." (Tad McClellan)
Re: Are there windows HELP files for Perl? - perlhlp.zi (MJ Lee)
Re: Calling CGI script from other CGI script (brian d foy)
Re: CGI.pm and server errors <rootbeer@teleport.com>
Re: chown -h <rootbeer@teleport.com>
Re: Compilation error <rootbeer@teleport.com>
Re: Copying files for WIN32 <rootbeer@teleport.com>
Re: Exporter/package question <rootbeer@teleport.com>
Re: extraction out of variable lenght records <rootbeer@teleport.com>
Re: Finding the missing bracket? <rootbeer@teleport.com>
HELP!!! - How do you add #'s within an array webmaster@pclightning.com
Re: HELP!!! - How do you add #'s within an array <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Re: Help! <rootbeer@teleport.com>
Re: Help: file locking for writing into a file using fl <rootbeer@teleport.com>
Learning perl online (Lynchqvctc)
Re: Looking for licensing software for perl scripts? <rootbeer@teleport.com>
Re: matrices... <rootbeer@teleport.com>
Re: multithread perl <rootbeer@teleport.com>
Re: POSIX (?) under perl for Win95 (Gurusamy Sarathy)
POSIX workaround for Win32? (Lynchqvctc)
Re: POSIX workaround for Win32? (Mike Heins)
Re: Problem in deleteing temp files in Windows NT <rootbeer@teleport.com>
Problems with IIS 4.0 and Perl 5 - Invalid argument <mikko@relatech.fi>
Re: simple perl question, regx, please help. (brian d foy)
Re: small question about substitution. (Mark-Jason Dominus)
Re: socket problems using Solaris telnet <rootbeer@teleport.com>
Re: typeglob? <rootbeer@teleport.com>
Using a variable in a pattern match (malgosia askanas)
Re: Using a variable in a pattern match (brian d foy)
Re: White Hats and Black <moises@texas.net>
why will this not work? (blacktape)
Re: why will this not work? (brian d foy)
Re: why will this not work? (Matthew Cravit)
Re: Win32 Perl 5 Bld 307 problem with system `commands` <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Jan 1998 21:45:02 -0700
From: Jerald Jackson <jsjacks@primenet.com>
Subject: Accpeting command line input such as ".- .."
Message-Id: <6aeg0e$36u@nntp02.primenet.com>
I am trying to write a basic morse translation script. It works
jsut fine when I read input from a file, but when I attempt to
pass it code from the command line, I get errors that it cannot find
a file ".-" or whatever character I passed it. The strange thing
was that the letter e "." works from the command line but ".." will
print "e e e".
I have tried iterating over STDIN by setting $/ to " " and "\s". This
has not met with anymore success than reading STDIN into an array and
iterating over that.
Ideas?
Regards,
Jerald Jackson
--
-------------------------------------------------------------------------------
jsjacks __ __ ____ ___ ___
jsjacks@primenet.com /__)/__) / / / / /_ /\ / /_
/ / \ / / / / /__ / \/ /___ /
-------------------------------------------------------------------------------
------------------------------
Date: Sun, 25 Jan 1998 00:16:44 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Accpeting command line input such as ".- .."
Message-Id: <cclea6.4h4.ln@localhost>
Jerald Jackson (jsjacks@primenet.com) wrote:
: I am trying to write a basic morse translation script. It works
: jsut fine when I read input from a file, but when I attempt to
: pass it code from the command line,
I'm not sure what you mean by "from the command line" there.
One interpretation might be like this (though this is more correctly
called invoking with "arguments" or some such):
decoder.pl . .. .-
Another might be that you first invoke the decoder with no arguments,
and then type input on the decoder's STDIN, and terminate with ^D
or ^Z or something.
If you mean the second alternative, then I don't know what might
be causing your problem.
: I get errors that it cannot find
: a file ".-" or whatever character I passed it. The strange thing
: was that the letter e "." works from the command line but ".." will
: print "e e e".
If you are on a Unix system, then the file named '.' (dot) is the
current directory and the file named '..' is the parent directory.
It looks like perl is expecting your '.-' to be a filename, rather
than a piece of data. See below.
: I have tried iterating over STDIN by setting $/ to " " and "\s". This
: has not met with anymore success than reading STDIN into an array and
: iterating over that.
: Ideas?
If you are passing the Morse as arguments, then using the <>
construct will do what you are describing.
Post your code and describe how you invoke it.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 25 Jan 1998 05:37:38 GMT
From: mjlee@amherst.edu (MJ Lee)
Subject: Re: Are there windows HELP files for Perl? - perlhlp.zip (0/1)
Message-Id: <34cacea3.1683353@news.nyu.edu>
On Fri, 23 Jan 1998 15:03:33 +0100, Craig <craig@skybound.demon.nl>
wrote:
>Hi,
>
>I'm looking for a help file Windows or a HTML quick reference for Perl5.
>Does anybody know of any that can be downloaded somewhere?
>
>Greetings,
>Craig Manley
You can search through the Internet for "perl.hlp". I have a copy of
it in my HD but I forgot where I got from. Just go to any ol'the
internet search engines and look for "perl.hlp". Just in case, I have
posted perlhlp.zip.
MJ Lee
------------------------------
Date: Sun, 25 Jan 1998 01:25:47 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Calling CGI script from other CGI script
Message-Id: <comdog-ya02408000R2501980125470001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34CAB23C.14713E65@broken-heart.com>, Default <danielle@broken-heart.com> posted:
>I would like to call a CGI Random ad generator script from
>the HTML output of the Web Board (or any other posting
>billboard CGI script for that matter).
i don't think the answer is different from the last time
i answered this question. see DejaNews for threads with
remarkably similiar subject lines.
CGI and server side include issues are best discussed somewhere
else.
good luck :)
[1] <URL:http://www.dejanews.com/>
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Sat, 24 Jan 1998 21:46:19 -0800
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: CGI.pm and server errors
Message-Id: <Pine.GSO.3.96.980124214151.27755O-100000@user2.teleport.com>
On Fri, 23 Jan 1998, Sanjay Vohra wrote:
> Reply-To: IICF
You should fix that if you want replies.
> i'm just running a simple script that does nothing but put something in
> HTML with CGI.pm however i get this problem when i run the script as
> such and the following if i check for errors on the server (nes)
> -------------------------------------------
> (offline mode: enter name=value pairs on standard input)
> Content-type: text/html
>
> Undefined subroutine CGI::isa
> --------------------------------------------
>
> (some IP stuff)... trying to GET /~cue/ue-cgi-bin/ugly.cgi,
> handle-processed reports: no way to service request for
> /~cue/ue-cgi-bin/ugly.cgi
>
> --------------------------------------------
>
> any comments ?
Yes: It's very helpful to us if you tell us what you expected your script
to do differently than it did. Most of us aren't as good at mind reading
as we are at Perl. :-)
> use UNIVERSAL;
What are you trying to do here? Have you seen the docs for UNIVERSAL.pm? I
don't think this is recommended (or needed, or useful). Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 21:16:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Moe <mark.moe@medtronic.com>
Subject: Re: chown -h
Message-Id: <Pine.GSO.3.96.980124211008.27755K-100000@user2.teleport.com>
On 23 Jan 1998, Mark Moe wrote:
> Hi, I'm using perl's chown on a symlink, but it follows the link.
> Is there a way to make it change the owner and/or group of the
> link itself? (like the -h option to the unix chown)
As others have pointed out, this doesn't usually make any difference in
the real world. But (on my system, at least) it's done by means of the
lchown(2) call, which you can call from Perl with syscall(), perhaps like
this (untested) code. (Untested because I don't have a machine handy which
lets me give away files! :-)
sub lchown {
# Works like Perl's chown(), but uses lchown internally
my($uid, $gid, @files) = @_;
my($file, $result, $count);
$count = 0;
require 'syscall.ph'; # may need to run h2ph first
die "Must use numeric uid, not '$uid'"
unless $uid =~ /^\d+$/;
die "Must use numeric gid, not '$gid'"
unless $gid =~ /^\d+$/;
for $file (@files) {
$result = syscall(
&SYS_lchown, # the call number
$file, # the file (symlink)
0+$uid, 0+$gid # ensure numeric
);
# $result from lchown is zero (success) or -1 (failure)
$count += 1 if $result == 0;
}
$count; # Return value
}
The only trick to using this is that you'll need the file syscall.ph
somewhere where your script can find it along your @INC. If you don't have
that file already, you can generate the file with a command like this.
h2ph </usr/include/sys/syscall.h >syscall.ph
Please let me know if this works or doesn't work for you. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 22:16:51 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Robert Raszuk <raszuk@cisco.com>
Subject: Re: Compilation error
Message-Id: <Pine.GSO.3.96.980124221547.27755X-100000@user2.teleport.com>
On Fri, 23 Jan 1998, Robert Raszuk wrote:
> I have a problem. When trying to compile perl I am getting no matter
> what compiler I use this error:
> LD_RUN_PATH="" gcc -o ../../lib/auto/Fcntl/Fcntl.so none
> -L/usr/local/lib Fcntl.o
> gcc: none: No such file or directory
It looks to me as if some configuration parameter was set to "none"
instead of "". Check config.sh for the word "none". Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 22:18:45 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Brandon <ordway@iwshost.net>
Subject: Re: Copying files for WIN32
Message-Id: <Pine.GSO.3.96.980124221726.27755Y-100000@user2.teleport.com>
On Sat, 24 Jan 1998, Brandon wrote:
> Lets say that I have a file- c:/myfile.txt
>
> With perl for win32, how can I copy it to this dir- c:/mydir/ ??
Use File::Copy, just as you would on any other platform. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 21:22:43 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: dmouse <gt1535b@acmez.gatech.edu>
Subject: Re: Exporter/package question
Message-Id: <Pine.GSO.3.96.980124211811.27755L-100000@user2.teleport.com>
On 23 Jan 1998, dmouse wrote:
> What I wanted to know is if, when I import variables from One in Two,
> are those the same variables that weren't imported from One in Top,
> or does Perl create a whole other instance of the the package One?
Importing doesn't normally create new variables; it gives new names (in
the current package) for existing ones (from another package). Is that
what you needed to know? Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 21:48:02 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Philip Rene Denis Vermeulen <philipv@leland.Stanford.EDU>
Subject: Re: extraction out of variable lenght records
Message-Id: <Pine.GSO.3.96.980124214726.27755P-100000@user2.teleport.com>
On Fri, 23 Jan 1998, Philip Rene Denis Vermeulen wrote:
> Each record has a fixed lenght beginning (144 positions) and then a
> variable lenght which looks like this (code (4 positions) value (6
> positions) code (4 positions) value (6 positions) code value code
> value, and so on).
Sounds like a job for unpack. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 22:14:50 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Budash <mbudash@sonic.net>
Subject: Re: Finding the missing bracket?
Message-Id: <Pine.GSO.3.96.980124221410.27755W-100000@user2.teleport.com>
On Sat, 24 Jan 1998, Michael Budash wrote:
> Could you (and/or the others 'round here) be so kind as to recommend such
> an editor, i.e., one that is perl-savvy?
No editor is (IMHO) truly Perl-savvy, but many programmers use vi and
emacs with varying degrees of success. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 22:21:35 -0600
From: webmaster@pclightning.com
Subject: HELP!!! - How do you add #'s within an array
Message-Id: <885701196.712769541@dejanews.com>
I have an array called @file
It contains the values of 8 7 6 4 9 3 and so.
I want to add these numbers together to get 37.
I know that I could add $file[0] + $file[1] + and so on after doing a
split command, but this will become a constantly updated program ---
meaning that there is now 6 numbers, but it will grow to over a hundred
within a month.
So, is there a way to give the sum of an array???
Please, I need an answer. I having only been learning PERL for a few
months.
Thank you in advance,
David
webmaster@pclightning.com
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sat, 24 Jan 1998 20:49:52 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: HELP!!! - How do you add #'s within an array
Message-Id: <6aeg74$6gb@bgtnsc02.worldnet.att.net>
Try this and see if it does what you want:
$sum = 0;
foreach $element (@myArray) {
$sum += $element
}
print $sum;
--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
webmaster@pclightning.com wrote in message
<885701196.712769541@dejanews.com>...
>I have an array called @file
>It contains the values of 8 7 6 4 9 3 and so.
>I want to add these numbers together to get 37.
>
>I know that I could add $file[0] + $file[1] + and so on after doing a
>split command, but this will become a constantly updated program ---
>meaning that there is now 6 numbers, but it will grow to over a hundred
>within a month.
>
>So, is there a way to give the sum of an array???
>
>Please, I need an answer. I having only been learning PERL for a few
>months.
>
>Thank you in advance,
>
>David
>webmaster@pclightning.com
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sat, 24 Jan 1998 22:06:36 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Sherrie <sh@rdwa.com>
Subject: Re: Help!
Message-Id: <Pine.GSO.3.96.980124220459.27755T-100000@user2.teleport.com>
On Fri, 23 Jan 1998, Sherrie wrote:
> Subject: Help!
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> I know nothing...yes, nothing about Perl. My company is signing up with
> a stock market data service that will upload, every 15 minutes, a fixed
> with, pipe-delimited text file with one company or quote information per
> line.
>
> We have roughly 30 or so previously designed 'holdings' pages...a
> different company on each page. My job is to figure out how to take a
> single quote from the uploaded text file and display it within a
> particular area of each page.
>
> If anyone can help me...please...
I teach Perl classes. If you'd like to sign up for one, please contact me
by private email. If you're interested in learning on your own, there are
some good books described in the perlbook manpage. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 21:57:16 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tommy <tkho@technologist.com>
Subject: Re: Help: file locking for writing into a file using flock() and seek().
Message-Id: <Pine.GSO.3.96.980124215455.27755R-100000@user2.teleport.com>
On Fri, 23 Jan 1998, Tommy wrote:
> Does anyone know how to lock a file while a script is writing a file.
I think you could use the methods in Randal's fourth Web Techniques
column, which explains how to use flock() to avoid problems when multiple
processes need to modify one file.
http://www.stonehenge.com/merlyn/WebTechniques/
> What I need is to have a subroutine that:
> 1. check if the file is locked
> 2. lock a file from the next user when the file is not locked
> 3. wait for 5 retries, each 2 sec apart when the file is locked
> 4. prompt user if the waiting is timeout.
> 5. write data to a file
If you really need all that (do you?) you can check the return value from
(non-blocking) flock(). But that's probably much more work than you need,
unless you expect the file to be kept locked for long periods of time.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 25 Jan 1998 04:03:01 GMT
From: lynchqvctc@aol.com (Lynchqvctc)
Subject: Learning perl online
Message-Id: <19980125040300.XAA13605@ladder01.news.aol.com>
Anyone out here interested in offering a basic "Learning Perl Online" course--
maybe by a web bbs interface etc. (maybe even for pay?) I teach at a local
community-technical college in CT, and it is something that I see could be
valuable on a number of levels. (I could use it, as well!) As I try to learn
perl on my own, this idea keeps recurring to me. I seen a real value as well
in such a setup for learning perl/db stuff as well. I'd love to "talk" with
anyone who might be interested (it might even be something that could be
engineered "for credit"... or at least as a "continuing ed." offering.
Please contact me if you have an interest.
Brian Donohue-Lynch (cultural anthropologist)
------------------------------
Date: Sat, 24 Jan 1998 22:40:25 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: mahesh@mahesh.com
Subject: Re: Looking for licensing software for perl scripts?
Message-Id: <Pine.GSO.3.96.980124223711.27755a-100000@user2.teleport.com>
On Sat, 24 Jan 1998 mahesh@mahesh.com wrote:
> I am looking for some solution to prevent the piracy of our
> perl scripts :-)
That's why god (or someone) invented lawyers. But see what section 3 of
the FAQ has to say about this before you try any other methods. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 22:13:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Pallotta Marco <marcop@unipg.it>
Subject: Re: matrices...
Message-Id: <Pine.GSO.3.96.980124221235.27755V-100000@user2.teleport.com>
On Sat, 24 Jan 1998, Pallotta Marco wrote:
> How can I do if I want to use matrices in Perl ????????
Do the manpages perldsc, perllol, and perlref tell you what you need?
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 21:39:13 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chuck Chiang <ctc@cisco.com>
Subject: Re: multithread perl
Message-Id: <Pine.GSO.3.96.980124213639.27755N-100000@user2.teleport.com>
On Fri, 23 Jan 1998, Chuck Chiang wrote:
> I heard that there has been some work done to make Perl multithreaded.
> Could anyone tell me where to find information about this?
You can keep listening to c.l.p.announce until 5.005 is announced. If
you're wanting to work with the work-in-progress on this version, you can
download the developers' most recent experimental release from CPAN. Hope
this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 25 Jan 1998 06:46:36 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: POSIX (?) under perl for Win95
Message-Id: <6aen4c$joh@srvr1.engin.umich.edu>
[ mailed and posted ]
In article <885623049.153157643@dejanews.com>, <rodney@bond.net> wrote:
>In article <6aajka$pfs@srvr1.engin.umich.edu>,
> gsar@engin.umich.edu (Gurusamy Sarathy) wrote:
>> Unfortunately, no. Win32 is not POSIX compliant and that perl is a
>> *Win32* port. MS claims Windows NT is POSIX capable, but the POSIX
>> subsystem can't access the Win32 subsystem and vice versa, so it is
>> not much good.
>
>The MS Posix subsystem is Posix.1. But it is hard to use. If you replace
>the MS Posix subsystem with the OpenNT subsystem (read Unix) the above
>problems largely go away.
Yeah. If you replace WindowsNT with Linux, the above problems completely
go away, too. ;-)
> The Unix version of Perl runs on OpenNT with
>no functionality loss (you can fork, exec, access sockets).
Is it possible to access the Win32 subsystem from the OpenNT subsystem?
> OpenNT has
>had this for months now (www.opennt.com). Why bother with the Win32 "port"
>when it's missing so much??
[Well, I claim it's not missing much of significance besides fork(), but
that's not the point.]
OpenNT is not free. Perl wants to be, for most values of "free".
Requiring some third-party commercial add-on does not help that
ideal.
- Sarathy.
gsar@umich.edu
------------------------------
Date: 25 Jan 1998 03:53:54 GMT
From: lynchqvctc@aol.com (Lynchqvctc)
Subject: POSIX workaround for Win32?
Message-Id: <19980125035300.WAA13422@ladder02.news.aol.com>
Am trying to get a database script going on Win95 system (Hey! I have to use
what I got... and am amazed I've gotten this far with it. Please humor me!)
The program does this in its first few lines...
# import permissions if necessary
use AnyDBM_File;
use POSIX(O_CREAT,O_RDWR,O_RDONLY);
Now the version of perl (5.003 build315) doesn't have the POSIX module, and
apparently it is not available in any of the Win32 versions. My question for
anyone who knows such things... is this a fatal problem-- or is it moot, under
Win32-- should this script be able to run anyway, if it can't use POSIX etc.?
And finally, is there an do-able way to achieve the same work without the POSIX
use? (I know perl folks say there are many ways to do the same work, with
perl)...
I would appreciate any considerate (constructive) responses... I am learning as
I go along (enjoying perl greatly!) and find the spirit of folks in this
context to be quite encouraging, (even when folks like me show up with very
green questions).
Best wishes
Brian
------------------------------
Date: 25 Jan 1998 05:50:20 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: POSIX workaround for Win32?
Message-Id: <6aejqs$200$1@vixen.cso.uiuc.edu>
Lynchqvctc (lynchqvctc@aol.com) wrote:
: Am trying to get a database script going on Win95 system (Hey! I have to use
: what I got... and am amazed I've gotten this far with it. Please humor me!)
: The program does this in its first few lines...
:
: # import permissions if necessary
: use AnyDBM_File;
: use POSIX(O_CREAT,O_RDWR,O_RDONLY);
:
: Now the version of perl (5.003 build315) doesn't have the POSIX module, and
: apparently it is not available in any of the Win32 versions. My question for
: anyone who knows such things... is this a fatal problem-- or is it moot, under
: Win32-- should this script be able to run anyway, if it can't use POSIX etc.?
: And finally, is there an do-able way to achieve the same work without the POSIX
: use? (I know perl folks say there are many ways to do the same work, with
: perl)...
Try "use Fcntl;" -- I think it has those "defines" as
well.
bill:~% perl
use Fcntl;
use POSIX;
use DB_File;
use SDBM_File;
foreach $pkg ( qw/Fcntl POSIX DB_File SDBM_File/ ) {
foreach $routine (qw/O_CREAT O_RDWR O_RDONLY/) {
print "${pkg}::$routine: ";
eval {
print &{"${pkg}::$routine"};
};
print "\n";
}
}
^D
Fcntl::O_CREAT: 64
Fcntl::O_RDWR: 2
Fcntl::O_RDONLY: 0
POSIX::O_CREAT: 64
POSIX::O_RDWR: 2
POSIX::O_RDONLY: 0
DB_File::O_CREAT: 64
DB_File::O_RDWR: 2
DB_File::O_RDONLY: 0
SDBM_File::O_CREAT:
SDBM_File::O_RDWR:
SDBM_File::O_RDONLY:
Yup. I suspect that all of those just "use Fcntl;". Works
the same on Windows, with this as the output:
Fcntl::O_CREAT: 256
Fcntl::O_RDWR: 2
Fcntl::O_RDONLY: 0
POSIX::O_CREAT:
POSIX::O_RDWR:
POSIX::O_RDONLY:
DB_File::O_CREAT: 256
DB_File::O_RDWR: 2
DB_File::O_RDONLY: 0
SDBM_File::O_CREAT:
SDBM_File::O_RDWR:
SDBM_File::O_RDONLY:
(I have a dummy POSIX module on my machine for strftime().)
--
Regards,
Mike Heins
This post reflects the
opinion of my employer.
------------------------------
Date: Sat, 24 Jan 1998 22:03:03 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: bidyut@yahoo.com
Subject: Re: Problem in deleteing temp files in Windows NT
Message-Id: <Pine.GSO.3.96.980124215836.27755S-100000@user2.teleport.com>
On Fri, 23 Jan 1998 bidyut@yahoo.com wrote:
> When the CGI uploads a file, it creates a temp file in the temp
> directory. When there is an user exit from the CGI due to some invalid
> form entry, the temp file hangs around in the temp directory and dows not
> allow the file to get uploaded next time. The CGI gives the following
> error-
>
> can't open \tmp\CGITemp00234, File exists
>
> Any solution for this.
Typically, one uses a new, unique, name for each temp file. (Also, the
superuser runs a periodic cleanup of old files in the temp directory.)
This technique also prevents some concurrency problems.
I use something like this under Unix; no doubt you'll need to adapt it for
your machine.
my $temp_prefix = "/tmp/$0.temp.$$.$^T"; # Probably unique :-)
my $first_temp_file = "$temp_prefix.A";
my $second_temp_file = "$temp_prefix.B";
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 21 Jan 1998 13:52:02 +0200
From: "Mikko Salmensaari" <mikko@relatech.fi>
Subject: Problems with IIS 4.0 and Perl 5 - Invalid argument
Message-Id: <6a4nhg$4o6$1@hiisi.inet.fi>
I'm testing Microsoft Internet Information Server (IIS) 4.0 and Perl 5.003.
Everything is working correctly on the other server, but another one returns
following error message when I'm try to run simple perl script on the
virtual directory. Any ideas?
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Can't open perl script "??????????????????????fm??l????????????": Invalid
argument
Mikko Salmensaari
mikko@relatech.fi
------------------------------
Date: Sun, 25 Jan 1998 01:38:27 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: simple perl question, regx, please help.
Message-Id: <comdog-ya02408000R2501980138270001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6adshm$6rv@drn.zippo.com>, chad posted:
>what is the code for this:
>
>$string should contain only a-z A-Z 0-9 if it contains anything else fail.
use subs qw(fail);
fail unless
$string =~ m/ ^ #anchor at start of string
[A-Za-z0-9]+ # any of those characters, any amount
$ # anchor at end of string
/x; #eXtended format
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: 24 Jan 1998 23:39:05 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: small question about substitution.
Message-Id: <6aefl9$ipb$1@monet.op.net>
Keywords: Abram discreet rude version
In article <34C8DC8A.127D@cse.bridgeport.edu>,
Seong Y. Kim <seong@cse.bridgeport.edu> wrote:
>$tmp = ~ s/^\/opt\/guide\/acumedia/http:\/\/www\.seong\.com/;
The match operator is =~, not = ~. When you write `= ~', per sees the
= as an assignment operator (like the one in `$x = 3') and the ~ as a
`bit-not' operator.
To fix, use =~ instead of = ~.
To fix it better, use
$tmp =~ s{/opt/guide/acumedia}{http://www.seong.com};
It's easier to read that way.
------------------------------
Date: Sat, 24 Jan 1998 21:03:46 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "ERIC K. CHEU" <ekcheu@fiona.uncg.edu>
Subject: Re: socket problems using Solaris telnet
Message-Id: <Pine.GSO.3.96.980124210249.27755I-100000@user2.teleport.com>
On 23 Jan 1998, ERIC K. CHEU wrote:
> Subject: socket problems using Solaris telnet
Have you seen what section 8 of the FAQ has to say about this? Hope this
helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 24 Jan 1998 22:31:21 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: George Cyriac <gcyriac@internetmci.com>
Subject: Re: typeglob?
Message-Id: <Pine.GSO.3.96.980124221955.27755Z-100000@user2.teleport.com>
On Sat, 24 Jan 1998, George Cyriac wrote:
> Can anyone explain to me what a typeglob does(*)?
Mostly, it confuses people. :-)
But if you're really interested in learning, I'd recommend Item 57 in the
new book "Effective Perl Programming" by my fellow Perl instructors Joseph
Hall and Randal Schwartz.
http://www.effectiveperl.com/
> What is the difference between:
> &search(@words);
> and
> &search(*words);
> ?
The first passes each element of @words separately. (Also, @words may or
may not be a my() variable.) The second passes a single parameter, which
is the entry for *words in the current package's symbol table. The sub can
then access the elements in @words (which can't be a my() variable)
without knowing the name of that array. But any sub which does that should
really be re-written to use references instead; it's a technique left over
from the days of version 4.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 25 Jan 1998 00:21:05 -0500
From: ma@panix.com (malgosia askanas)
Subject: Using a variable in a pattern match
Message-Id: <6aei41$ndc@panix2.panix.com>
I am searching through a file to find a match with the value of
a string variable, $user. The string might contain special characters,
most notably "+" -- it is an e-mail address. So when I use straight
$user in the pattern, the addresses containing "+" don't match (everything
else does OK). When I write the pattern using \Q$user\E, nothing matches
at all. I tried to say $user = quotemeta($user) before doing anything,
but this gives me a syntax error. I realize this question is probably
utterly stupid, but I am nevertheless going nuts. How do I make this work?
Many thanks in advance.
-malgosia (ma@panix.com)
------------------------------
Date: Sun, 25 Jan 1998 01:35:29 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Using a variable in a pattern match
Message-Id: <comdog-ya02408000R2501980135290001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6aei41$ndc@panix2.panix.com>, ma@panix.com (malgosia askanas) posted:
>I am searching through a file to find a match with the value of
>a string variable, $user. The string might contain special characters,
>most notably "+" -- it is an e-mail address. So when I use straight
>$user in the pattern, the addresses containing "+" don't match (everything
>else does OK). When I write the pattern using \Q$user\E, nothing matches
>at all. I tried to say $user = quotemeta($user) before doing anything,
>but this gives me a syntax error. I realize this question is probably
>utterly stupid, but I am nevertheless going nuts. How do I make this work?
the \Q\E and quotemeta() are ways to accomplish this, but perhaps
you have something else going wrong. a snippet of code would be
helpful in diagnosing the problem...
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Sat, 24 Jan 1998 22:20:01 -0600
From: Stacey Tanamachi <moises@texas.net>
Subject: Re: White Hats and Black
Message-Id: <34CABD70.E781DBBA@texas.net>
Amen.
------------------------------
Date: Sun, 25 Jan 1998 04:24:07 GMT
From: mocat@NOSPAM.best.com (blacktape)
Subject: why will this not work?
Message-Id: <34cabdf6.65732@nntp.best.com>
I can't get pipes to work. I've read all the (not even remotely
understandable) documentation on pipes, and have come up with
virtually nothing, and I don't have any other resources as of yet.
If anyone can direct me to a good tutorial on pipes, or fix this code,
it'd be much appreciated. Thx
#!/usr/bin/perl
open(PASSWD, "|passwd") || die "cannot open passwd: $!\n";
@passwd = <PASSWD>;
srand; $stat = 0;
@caplet = ('A'..'Z');
@lowlet = ('a'..'z');
@numbers = ('0'..'9');
@arrays = qw(caplet lowlet numbers);
while ($stat < 8) {
$nextarr = $arrays[rand(@arrays)];
$nextchar = $$nextarr[rand(@$nextarr)];
$password = $password.$nextchar;
$stat++;
}
print "new password: $password\n";
#while(@passwd) {
# if (@passwd =~ /word\:/i) {
print PASSWD "$password\n";
# }
#}
close(PASSWD);
-j
the dumber a person is, the longer it will take for them to find out that you're killing them
------------------------------
Date: Sun, 25 Jan 1998 01:33:58 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: why will this not work?
Message-Id: <comdog-ya02408000R2501980133580001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34cabdf6.65732@nntp.best.com>, mocat@NOSPAM.best.com (blacktape) posted:
Please read this information on how to choose a good subject for a post:
<URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>
>#!/usr/bin/perl
>open(PASSWD, "|passwd") || die "cannot open passwd: $!\n";
does your passwd take data from pipes? try it on the command
line.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: 24 Jan 1998 22:30:00 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: why will this not work?
Message-Id: <6aem58$hjt$1@shell3.ba.best.com>
In article <34cabdf6.65732@nntp.best.com>,
blacktape <mocat@NOSPAM.best.com> wrote:
>open(PASSWD, "|passwd") || die "cannot open passwd: $!\n";
The reason this won't work is that the passwd command expects to be reading
from a tty, so you can't just open a pipe to it like that. You could try doing
this with the Comm.pl or chat2.pl modules, though.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Sat, 24 Jan 1998 22:11:37 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Clint Grimes <cgrimes72@earthlink.net>
Subject: Re: Win32 Perl 5 Bld 307 problem with system `commands`
Message-Id: <Pine.GSO.3.96.980124220959.27755U-100000@user2.teleport.com>
On Sat, 24 Jan 1998, Clint Grimes wrote:
> 1) Everytime I call an external command (i.e. `nbtstat -A $ip`) the A:
> drive spins up (it's not in my system path) which slows down execution
> considerably. Why? How can I stop it?
As I said the last time this one came up:
I'm told that this happens when some (non-Perl) program has foolishly
installed itself in the registry as being on a floppy drive. You should
run the registry editor (regedit.exe) and remove any unnecessary
occurences of 'A:', which is usually all of them. (I believe that Russell
Odom was the person who told me of this fix. But let me know if I've
botched the description.)
Since Perl can work with the registry directly, it would be nice if
somebody could make a utility which would do this for users. Such a
utility should ship with Win32 Perl, IMHO. I'd write it myself, but I
don't have any Win32 machines handy. :-)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
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 1723
**************************************