[7812] in Perl-Users-Digest
Perl-Users Digest, Issue: 1437 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 8 20:07:17 1997
Date: Mon, 8 Dec 97 17:00:23 -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 Mon, 8 Dec 1997 Volume: 8 Number: 1437
Today's topics:
Re: 5.004_04 Out of Memory bug <zenin@best.com>
AIX, perl and the Performance Toolkit <kperrier@Starbase.NeoSoft.COM>
Re: Bitwise operations on strings and diff strings/numb <rootbeer@teleport.com>
CGI.pm Usage Questions <bugaj@bell-labs.com>
Re: CGI.pm Usage Questions (Tanju Cataltepe)
Re: Communication through pipes with su (Jeff Yoak)
Re: download file name solution <zenin@best.com>
Re: download file name solution (brian d foy)
getting list of directories, returned as an array (Joshua J. Kugler)
Re: How do I run script as ROOT? <carse@ibm.net>
Re: MS IE 3.03 File Uploading <perlguy@inlink.com>
Re: pattern matching <rhodri@wildebst.demon.co.uk>
Re: Perl for Solaris x86? twod@not.valid
Re: Perl script = zombie :( <rootbeer@teleport.com>
Re: Perl: Future directions? <rootbeer@teleport.com>
Re: Perl: Future directions? <blakem@seas.upenn.edu>
Re: Perl: Future directions? <rootbeer@teleport.com>
Re: perlsec setuid and my confusion and security issues <jaydee@worsdall.demon.co.uk>
Re: perlsec setuid and my confusion and security issues <rootbeer@teleport.com>
Re: problems in running Perl scripts (Martin Vorlaender)
Re: problems in running Perl scripts (Jonathan Stowe)
Re: replacement for fork() on NT? <billc@tibinc.com>
Re: searching for value in array (Mike Stok)
Re: Simple/small socket script doesn't work <zenin@best.com>
Telnetting with Perl <e.phillips@mindspring.com>
Re: the skinny on my() vs local() - thanks to all <kperrier@Starbase.NeoSoft.COM>
Using pipes with /dev/tty. (Jason A. Smith)
Re: Wildcards <rootbeer@teleport.com>
Re: Wildcards <stuartc@ind.tansu.com.au>
Re: Write to a text file (Paul Heindselman)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Dec 1997 21:17:30 GMT
From: Zenin <zenin@best.com>
Subject: Re: 5.004_04 Out of Memory bug
Message-Id: <881616053.588751@thrush.omix.com>
lighta@gcm.com wrote:
: I am having an "Out of Memory" problem with certain Perl 5.004.04 scripts.
: It seems that certain scripts will consume HUGE amounts of memory
: (50-200MB).
Hmm, and I thought it was only me. 5.00404 under FreeBSD 2.2.5 using
the system malloc(). -I'd give a perl -V output, but I've already
recompiled using perl's malloc() w/$^M enabled to try and catch the
error placement.
: The problem is very strange in that often adding or removing a comment
: line from the script will "fix" it.
Hmm, thanks I'll try that.
: It does not seem to be a problem with Perl's internal malloc, since malloc
: is being requested to allocate the multi-megabyte memory buffer.
Cool, maybe my recompile will work then. :-)
--
-Zenin (zenin@best.com)
The Bawdy Caste (San Jose, CA) http://www.netmagic.net/~dmcgrath/bawdy/
Barely Legal (Berzerkly, CA) http://www.barelylegal.org/
Zenin's Rocky Horror Archive (I MOVED!) http://www.archive.rhps.org/rhps/
------------------------------
Date: 08 Dec 1997 15:18:56 -0600
From: Kent Perrier <kperrier@Starbase.NeoSoft.COM>
Subject: AIX, perl and the Performance Toolkit
Message-Id: <csk9dfr0sf.fsf@Starbase.NeoSoft.COM>
Has anyone developed a perl module to access the Performance Toolbox
API so gathering performance data on remote can be a bit easier?
Thanks,
Kent
--
Kent Perrier kperrier@neosoft.com
Corporations don't have opinions, people do. These are mine.
------------------------------
Date: Mon, 8 Dec 1997 12:03:00 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Vincent Lefevre <vlefevre@ens-lyon.fr>
Subject: Re: Bitwise operations on strings and diff strings/numbers
Message-Id: <Pine.GSO.3.96.971208114858.9753R-100000@user2.teleport.com>
On 8 Dec 1997, Vincent Lefevre wrote:
> After wondering why "0" ^ "1" doesn't return 1, I looked at the
> manpages, then at the FAQ, but didn't find anything.
I recently sent in a doc patch about this.
> Is it a bug? (as this seems to contradict the manpages)
A bug in the manpages, perhaps. :-)
Here's a portion of the doc patch. Things that look like X<...> are POD
markup, which is left to puzzle the reader. :-)
+=head2 Bitwise String Operators
+
+Bitstrings of any size may be manipulated by the bitwise operators
+(C<~ | & ^>).
+
+If the operands to a binary bitwise op are strings of different sizes,
+B<or> and B<xor> ops will act as if the shorter operand had additional
+zero bits on the right, while the B<and> op will act as if the longer
+operand were truncated to the length of the shorter.
+
+ # ASCII-based examples
+ print "j p \n" ^ " a h"; # prints "JAPH\n"
+ print "JA" | " ph\n"; # prints "japh\n"
+ print "japh\nJunk" & '_____'; # prints "JAPH\n";
+ print 'p N$' ^ " E<H\n"; # prints "Perl\n";
+
+If you are intending to manipulate bitstrings, you should be certain that
+you're supplying bitstrings: If an operand is a number, that will imply
+a B<numeric> bitwise operation. You may explicitly show which type of
+operation you intend by using C<""> or C<0+>, as in the examples below.
+
+ $foo = 150 | 105 ; # yields 255 (0x96 | 0x69 is 0xFF)
+ $foo = '150' | 105 ; # yields 255
+ $foo = 150 | '105'; # yields 255
+ $foo = '150' | '105'; # yields string '155' (under ASCII)
+
+ $baz = 0+$foo & 0+$bar; # both ops explicitly numeric
+ $biz = "$foo" ^ "$bar"; # both ops explicitly stringy
> Are there other operations that differently operate on strings and
> on integers?
Yes. If you're passing arguments to syscall(), you must pass either
numbers or strings for certain parameters. I don't believe that there are
other cases, but somebody will surely tell me if there are any. :-)
> Are there differences between integers and floating-point numbers
> that don't have a fractional part?
Yes, but there's no difference for ordinary Perl code. So far as I know,
the differences may appear only in XSUB code.
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: Mon, 08 Dec 1997 15:18:44 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: CGI.pm Usage Questions
Message-Id: <348C5624.41C6@bell-labs.com>
I've got a CGI program which should set a hidden variable called
last_pass to remind itself what stage it was in last call, like
such:
print ...
$query->hidden(-name=>'last_pass',
-default=>['load_config']),...
However, when I try to use this I get results for the previous stage
(the login stage in this case) and the HTML that is output is this:
<INPUT TYPE="hidden" NAME="last_pass" VALUE="login">
And if I submit the form I do get the result from processing a value
of "login" for this variable.
What am I screwing up here?
I'm also using hidden variables to pass arrays of numbers and strings
and would like to be able to manipulate those arrays with Javascript
and on the next submit get those new values back to the CGI. I tried
playing with things like document.framename.hiddenvariablename.value
but got various errors from Javascript. I deleted most of my little
hackish attempts at this, they were pretty perfunctory, so does someone
have a quick little example of how to make this work properly I could
look at to save some dorking around with Javascript time?
Thanks.
LL+P,
Stephan
P.S. Please cc me in email with any replies, I only check news every
1-3 days.
--
"Do computers think?"
-------------------------------------------------------------------
Stephan Vladimir Bugaj bugaj@bell-labs.com
Member of Technical Staff (908) 949-3875
Multimedia Communication Research Dept. Rm. 4F-601, Holmdel
Bell Labs of Lucent Technologies www.multimedia.bell-labs.com
PGPkey from http://www.pgp.net/wwwkeys.html or your local keyserver
Non-Lucent personal website http://www.cthulhu-dynamics.com/stephan
-------------------------------------------------------------------
STANDARD DISCLAIMER:My opinions are NOT necessarily those of LUCENT
-------------------------------------------------------------------
"Do submarines swim?" - E.W. Dijkstra
------------------------------
Date: Mon, 08 Dec 1997 16:55:52 -0500
From: tanju@wakeup.org (Tanju Cataltepe)
Subject: Re: CGI.pm Usage Questions
Message-Id: <tanju-ya02408000R0812971655520001@news.turktel.net>
In article <348C5624.41C6@bell-labs.com>, Stephan Vladimir Bugaj
<bugaj@bell-labs.com> wrote:
>print ...
> $query->hidden(-name=>'last_pass',
>-default=>['load_config']),...
Use -value=>[..] instead of -default
-Tanju
______________________________________________________________________
tanju@wakeup.org http://www.wakeup.org/tanju/
"Wake up now from your heedlessness before the day
comes when you are awakened without your will" Abdul-Qadir Gilani
------------------------------
Date: Mon, 08 Dec 1997 23:37:15 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: Communication through pipes with su
Message-Id: <66i067$cfr@dfw-ixnews12.ix.netcom.com>
bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to
"kf8nh") wrote:
>In <66d4p1$d88@dfw-ixnews10.ix.netcom.com>, on 12/07/97 at 03:24 AM,
> jeff@yoak.com (Jeff Yoak) said:
>+-----
>> ( in re code sequence )
>| > open(COMMAND, "|su $username -c '$command 2>&1' |");
>| > print COMMAND "$password\n";
>| > $output = <COMMAND>;
>+--->8
>Your problem is that you can't open a command pipe for both input and output
>like that. Take a look at the IO::Open2 and IO::Open3 modules to create
>bidirectional pipes to commands.
Hmmm. Couldn't find these, but I'm guessing it was supposed to be
IPC::Open2 and Open3. Those descriptions sound like just what I need
but I still had a hard time making it work. I finally threw up my
hands in disgust and implements a solution that involved temporary
files and doesn't require getting the output directly from the
command.
Thanks for the pointer, though.
Cheers,
Jeff
Jeff Yoak jeff@yoak.com http://yoak.com/
------------------------------
Date: 8 Dec 1997 20:29:34 GMT
From: Zenin <zenin@best.com>
Subject: Re: download file name solution
Message-Id: <881613177.570844@thrush.omix.com>
john.ferguson@cyberlife.co.uk wrote:
: This is a botch but it seems to work okay. Even on MS Internet Explorer.
: Call the Perl Script with: http://...mygame.pl[?data]/dummy.exe
>snip<
You meen basic MIME headers don't work?
print qq(Content-Type: application/x-videogame\n);
print qq(Content-Disposition: attachment; filename="dummy.exe"\n\n);
print while (<GAME_FILE>);
--
-Zenin
zenin@best.com
------------------------------
Date: Mon, 08 Dec 1997 17:20:12 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: download file name solution
Message-Id: <comdog-ya02408000R0812971720120001@news.panix.com>
In article <881613177.570844@thrush.omix.com>, Zenin <zenin@best.com> wrote:
>john.ferguson@cyberlife.co.uk wrote:
>: This is a botch but it seems to work okay. Even on MS Internet Explorer.
>: Call the Perl Script with: http://...mygame.pl[?data]/dummy.exe
> >snip<
>
> You meen basic MIME headers don't work?
not with all browsers...
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Mon, 08 Dec 1997 23:54:59 GMT
From: FIGHT-SPAMjkugler@inreach.com (Joshua J. Kugler)
Subject: getting list of directories, returned as an array
Message-Id: <348c87cf.506463@news.inreach.com>
Hello, I have searched Dejanews, scanned through the FAQ, and looked
through CPAN.html, but have not found what I am looking for. I would
like (or maybe just would like help writing) a subroutine to return a
list of directories to an array starting with the current directory.
And maybe an option to dictate whether to return the list as a set of
relative paths or absolute paths. I know *nix has some tools that
could be manipulated and piped into Perl, but I am trying to write my
script to be system independent.
Any help or pointers would be great. Code samples are great, as are
pointers to web pages.
Thanks!
j----- k-----
Please reply via e-mail as well.
Joshua J. Kugler
Computer Consultant--Web Developer
Real e-mail address spelled out to prevent spam. jkugler at inreach dot com
http://www.cwebpages.com/jkugler
Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!
- - - - -
To reply via e-mail, please remove 'FIGHT-SPAM' from my e-mail address. Thanks.
------------------------------
Date: Mon, 8 Dec 1997 17:22:16 -0700
From: "John Carse" <carse@ibm.net>
Subject: Re: How do I run script as ROOT?
Message-Id: <348c8ff5.0@news1.ibm.net>
Howdy Clive,
Clive McAdam wrote in message <01bcf9e0$073f22e0$bfda22c4@clive>...
>I have a perl script that allows users to create directories and files.
>
>My problem is that the script is owned by root and the webserver is set
>up as nobody (not even a user on the system, don't want to set it up as
>root)
> so when each user comes in and creates his directory, the owner
> is "nobody".
First thing I would do is stop using nobody as the user of the webserver.
Create a new user called wwwuser or something, unless you have some
overwhelming need to run the webserver under nobody (using nobody could
reveal some security holes). Set up the wwwuser with a corresponding group,
say www. Make the script executable by the www group. Make all your
privileged users member of the www group. You should then be able to run the
script and change the owners of the directories to that of the users.
>How do I force the script to run as root so that the chown command inside
>my script will work correctly?
>I've tried setuid, but then the script doesn't work at all!
C'ya -- John Carse
------------------------------
Date: Mon, 8 Dec 1997 13:44:33 GMT
From: Brent Michalski <perlguy@inlink.com>
To: "Jeremy D. Zawodny" <jzawodn@wcnet.org>
Subject: Re: MS IE 3.03 File Uploading
Message-Id: <348BF9C1.6FD9B675@inlink.com>
Ok, I checked the log file(s) that I could find. I am running this on
Windows NT and an IIS server and am still learning this NT thing, I
could not find an error log or any reference to one in the
documentation. (I sure miss UNIX)
I did check the standard logfile that IIS generates. I tried the upload
feature with ie 3.03 and Netscape. Both entries in the logfile looked
identical and both returned that it worked. The ie 3.03 browser still
hung at a gray screen where the Netscape browser gave me the expected
return values. Also, the file was physically uploaded by the Netscape
server and WAS NOT by ie 3.03.
ie 3.03 entry:
xxx.xxx.xxx.xxx, loginname, 12/8/97, 7:14:38, W3SVC, XXXX-NT1,
204.17.203.18, 1022, 3874, 108, 200, 0, POST, /odbc/upload.cgi, -,
Netscape entry:
xxx.xxx.xxx.xxx, loginname, 12/8/97, 7:19:33, W3SVC, XXXX-NT1,
204.17.203.18, 1392, 7134, 1955, 200, 0, POST, /odbc/upload.cgi, -,
I modified the file to take out referneces to our network for security
reasons. The logfile entries are otherwise intact.
Does this shed any more light on the subject?
Brent
------------------------------
Date: Mon, 08 Dec 1997 00:09:41 +0000 (GMT)
From: Rhodri James <rhodri@wildebst.demon.co.uk>
Subject: Re: pattern matching
Message-Id: <47f4fc5f08rhodri@wildebst.demon.co.uk>
In article <348B0F02.5C60@aol.com>,
<snailgem@aol.com> wrote:
> s. morgan friedman wrote:
[snip]
> > i constructed the following:
> > if ($big_string =~ /[.*]\@[.*]/) {
> > &do_something;
> > }
> Try:
> if ($big_string =~ /\@/) {
> &do_something;
> }
Or even:
if ($big_string =~ /@/)
{
&do_something;
}
--
Rhodri James *-* Wildebeeste herder to the masses
If you don't know who I work for, you can't misattribute my words to them
... I have too much time on my hands. Let's run another convention.
------------------------------
Date: 8 Dec 1997 21:23:06 GMT
From: twod@not.valid
Subject: Re: Perl for Solaris x86?
Message-Id: <66hofq$dkm$1@vnetnews.value.net>
Scott Kahn (scott@pop.netobjects.com) wrote:
: Where can I get already-compiled Perl 5.x for the Solaris x86/Intel
: Edition?
In all honesty I recommend that you get a C compiler and compile it yourself
from the sources. However, http://www.eis.com/html/solarislinks.html has
some links to archives of x86 binaries/pacakages, one of which may include a
PERL distribution.
IAP
--
I am using anti-spam measures, please replace 'not.valid' with 'value.net'
------------------------------
Date: Mon, 8 Dec 1997 12:08:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: TechMaster Pinyan <jefpin@bergen.org>
Subject: Re: Perl script = zombie :(
Message-Id: <Pine.GSO.3.96.971208120801.9753S-100000@user2.teleport.com>
On Mon, 8 Dec 1997, TechMaster Pinyan wrote:
> The problem is, that if you go to it, and press the stop button, it
> keeps a zombie process running on my server.
You could try this. Hope this helps!
BEGIN { alarm 15 }
--
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: Mon, 8 Dec 1997 12:12:23 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Kevin White <kwhite@apache.tsc.ohio-state.edu>
Subject: Re: Perl: Future directions?
Message-Id: <Pine.GSO.3.96.971208121029.9753T-100000@user2.teleport.com>
On 8 Dec 1997, Kevin White wrote:
> What are perl's future directions?
There are any number of things on the wish list. For example, Unicode
support, threading, regexes as first class objects, fully-reliable
signals, and so on. And those are just for the core; there are many (many)
modules waiting for an author. Are you volunteering? :-)
--
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 Dec 1997 20:50:27 GMT
From: "Blake D. Mills IV" <blakem@seas.upenn.edu>
Subject: Re: Perl: Future directions?
Message-Id: <66hmij$idd$1@netnews.upenn.edu>
Tom Phoenix <rootbeer@teleport.com> wrote:
: There are any number of things on the wish list. For example, Unicode
: support, threading, regexes as first class objects, fully-reliable
: signals, and so on. And those are just for the core; there are many (many)
: modules waiting for an author. Are you volunteering? :-)
I'd consider tackling a module... Is there a list of "would-be-nice-to-have"
modules, anywhere?
-Blake
------------------------------
Date: Mon, 8 Dec 1997 13:27:02 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Blake D. Mills IV" <blakem@seas.upenn.edu>
Subject: Re: Perl: Future directions?
Message-Id: <Pine.GSO.3.96.971208132009.9753e-100000@user2.teleport.com>
On 8 Dec 1997, Blake D. Mills IV wrote:
> I'd consider tackling a module... Is there a list of
> "would-be-nice-to-have" modules, anywhere?
The Modules list from CPAN is a good place to start.
http://www.perl.com/CPAN/modules/00modlist.long.html
Check the section on "Ideas for Adoption". But it's even better if you've
already written something and you need merely to break it out into a
module. Look at your code for any routines which might be usable in more
generalized applications. Or look through the various solutions that
you've seen in this newsgroup, and turn some of that code into a module.
Or take something out of an existing script - say, the paging code from
perldoc. That probably should be a module, so you could simply invoke the
module in any script and have all output go to the user's choice of pager,
such as /bin/more, in a system-independent way.
Have fun with it!
--
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: Mon, 8 Dec 1997 20:31:36 +0000
From: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: Re: perlsec setuid and my confusion and security issues please
Message-Id: <sT+WUzDokFj0Ewl2@worsdall.demon.co.uk>
Hi,
> It's even slightly more efficient. )
>
>>sub track_client {
>> $ENV{'PATH'} = '/usr/www/foobar/barfoo/ipdns';
>> open(DAT,">>$ip_directory$surfer") or die "Error opening
>>$ip_directory$surfer: $!";
>
>And so the arg to open will be tainted.
and so how to make $surfer untainted?
--
Mark Worsdall - Oh no, I've run out of underpants :(
Home:- jaydeeATworsdall.demon.co.uk WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmasterATshadow.org.uk WEB site:- http://www.shadow.org.uk
------------------------------
Date: Mon, 8 Dec 1997 13:13:19 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: Re: perlsec setuid and my confusion and security issues please
Message-Id: <Pine.GSO.3.96.971208131303.9753c-100000@user2.teleport.com>
On Mon, 8 Dec 1997, Mark Worsdall wrote:
> and so how to make $surfer untainted?
Use the methods from perlsec(1).
--
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: Mon, 08 Dec 1997 21:49:38 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: problems in running Perl scripts
Message-Id: <348c5d62.524144494f47414741@radiogaga.harz.de>
veroncx@hotmail.com wrote:
: I am presently doing aproject on online student registration and will
: be using CGI scipts for the processing of the registration forms...I am
: using Windows NT4 Web server and have done some configuration to the
: server to run the scripts...however whenever I type in
: "http://myserver.com/cgi-bin/hello.pl", it automatically prompts me to
: save the file as....instead of showing a HTML output...why is that
: so??Any suggestions on what is wrong?
The NT4 Web Server must be instructed to recognize .pl as the extension
of an executable image, and to start PERL.EXE in that case.
This is covered in the chapter about registry entries and adding script
languages in the IIS Installation And Maintainance Manual, which gets
installed with IIS.
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: 8 Dec 1997 23:07:33 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: problems in running Perl scripts
Message-Id: <66hujl$p87@neon.btinternet.com>
In article <881574110.21216@dejanews.com>, veroncx@hotmail.com says...
>
>Hi all,
>
..however whenever I type in
>"http://myserver.com/cgi-bin/hello.pl", it automatically prompts me to
>save the file as....instead of showing a HTML output...why is that
>so??Any suggestions on what is wrong?
>
script mapping registry black art see
comp.infosystems.www.servers.ms-windows
Have fun.
Jonathan.
(Hey WinVN didnt crash this time)
------------------------------
Date: Mon, 08 Dec 1997 19:38:53 -0500
From: Bill Cowan <billc@tibinc.com>
To: Jeff Kehoe <kehoe@fc.hp.com>
Subject: Re: replacement for fork() on NT?
Message-Id: <348C931D.D4A810F4@tibinc.com>
Jeff Kehoe wrote:
>
> Has anybody found a good 0 for fork() on NT? I realize that
> it isn't supported on NT, but wondered what people are doing in its
> place on NT.
>
> Thanks in advance for the help,
> Jeff Kehoe
>From Win32 Perl at www.ActiveState.om, check out NT-specifc ways for
possible solutions:
Win32::Spawn
Win32::Process
See Win32 specific HTML file on NT modules.
-- Bill
------------------------------
Date: 8 Dec 1997 19:55:36 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: searching for value in array
Message-Id: <66hjbo$jgi@news-central.tiac.net>
In article <348C45F1.7A30@hackberry.chem.niu.edu>,
Darin Burleigh <burleigh@hackberry.chem.niu.edu> wrote:
>Kjetil Skotheim wrote:
>>
>> In article <01bd03e7$eb7e65e0$c82da8c0@akilles.ittek.org>,
>> robert.friberg@your_clothes.eductus-vast.com says...
>> >
>> >I've heard that grep is inefficient when searching for
>> >a certain value in an array, like:
>> > print "$_ found!\n" if scalar( grep /$_/, @list);
grep will apply the /$_/ to every member of the list regardles of whether
there are any matching elements, so if you have a million element list and
the thing you're looking for is the first element it may be considered
inefficient. Be aware that /$pattern/ can be blown up by metacharacters
and matches substrings but a comparison of $_ eq $match will not. Also
the example above is "tricky" -
#!/usr/local/bin/perl -w
@list = qw/foo bar baz/;
$_ = 'a';
print "$_ found!\n" if scalar( grep /$_/, @list);
$_ = 'c';
print "$_ found!\n" if scalar( grep /$_/, @list);
produces
a found!
c found!
An innocent reader might expect the a, but the c... :-)
>> >Why?
>> >
>> >I use the following:
>> > print "found!\n" if &ismember('bart', @simpsons);
>> > sub ismember{
>> > $_ = shift;
>> > foreach $v (@_) {
>> > return 1 if $_ eq $v
>> > }
>> > return 0
>> > }
This is a linear search of the array, so you get a subroutine call and, on
average half the length of the list of eq comparisons.
>> If you instead can store the simpsons in an assosiative array,
>> you can search faster:
>>
>> for(@simpsons){$ismember{$_}=1} #do this initiation once
>>
>> print "found!\n" if $ismember{bart}; #search fast with a.array
>> #many times
>>
>> The more simpsons there are, the more time you will save by
>> searching with assosiative arrays.
Hashes can be quite efficient for this as you end up doing linear searches
down relatively short lists inside the perl interpreter.
>I often use something like:
>$match = join( '|', @simpsons); # -- do this once
>
>then
>
>print "found " if ( $thing =~ /^($match)$/ );
>
>is that grossly less efficient?
>is there any significant difference in creating the
>associative array vs. the match string?
Here you may have to be careful as $match might contain metacharacters or
a stinng like bart\|lisa which can give false matches, or you can match
falsely if $match is a substring of an element (e.g. searching for 'art'
will match on 'bart')
In general I like using eq on hash keys as perl's hashing is pretty good
and using eq helps me avoid accidental metacharacter issues (even if *you*
are careful sometimes maintainers might slip.) Both the string and the
array need to be kept in step with the list if the list is modified.
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: 8 Dec 1997 20:20:07 GMT
From: Zenin <zenin@best.com>
Subject: Re: Simple/small socket script doesn't work
Message-Id: <881612609.685881@thrush.omix.com>
[ posted & mailed ]
Zenin <zenin@best.com> wrote:
Duh... As Tom C just pointed out to me, I forgot to mention the
other problem of a missing newline on your original message. It
shoule be:
print $remote "hello world\n"; # Note trailing newline
-Zenin
zenin@best.com
------------------------------
Date: Sun, 7 Dec 1997 19:45:21 -0800
From: "Eric Phillips" <e.phillips@mindspring.com>
Subject: Telnetting with Perl
Message-Id: <66i4a6$593@camel12.mindspring.com>
Is it possible to use the Telnet prog on my Linux server so that I can read
the query of a "whois" search? If so, please let me know how. Thanks!
--
Eric Phillips
TigerWeb - http://twb.starhosting.com
info@twb.starhosting.com
------------------------------
Date: 08 Dec 1997 14:38:12 -0600
From: Kent Perrier <kperrier@Starbase.NeoSoft.COM>
Subject: Re: the skinny on my() vs local() - thanks to all
Message-Id: <csn2ibr2ob.fsf@Starbase.NeoSoft.COM>
Randal Schwartz <merlyn@stonehenge.com> writes:
>
> And yes, it was a paid "celebrity endorsement". From the reaction
> y'all are giving me, I'll try not to do that again. Sorry.
>
> print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
> ## legal fund: $20,990.69 collected, $186,159.85 spent; just 267 more days
> ## before I go to *prison* for 90 days; email fund@stonehenge.com for details
>
Well considering these two lines together, I would say "Go for all of the
paid celebrity endorsements you can get." I don't know about everyone else
but, in light of these circumstances, I can forgive you for making this
kind of endorsement.
Kent
--
Kent Perrier kperrier@neosoft.com
Corporations don't have opinions, people do. These are mine.
------------------------------
Date: 8 Dec 1997 18:23:14 -0500
From: smithj4@rpi.edu (Jason A. Smith)
Subject: Using pipes with /dev/tty.
Message-Id: <66hvh2$1j06@hadron4.phys.rpi.edu>
I have a program that I would like to run in a pipe in my script,
but the program uses /dev/tty for both reading input and writing output.
Is there a way I can run this program, possibly using IPC:Open2 but have
the input and output file handles connected to /dev/tty so I can interact
with this program in the pipe? Do I have to create a new tty device to
have this process attach to? I know this is possible, at least in C++
(ddd does it when it invokes gdb), but I don't have any idea how to do
it in a perl script. Does anyone have any suggestions? Is it even
possible to do?
--
Jason Smith E-mail: smithj4@rpi.edu
Physics Department Phone: (518)276-2050
Rensselaer Polytechnic Institute FAX: (518)276-6680
Troy, NY 12180-3590 WWW: http://www.rpi.edu/~smithj4/
------------------------------
Date: Mon, 8 Dec 1997 12:44:36 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Scott DiNitto <sdinitto@kronos.com>
Subject: Re: Wildcards
Message-Id: <Pine.GSO.3.96.971208124327.9753Y-100000@user2.teleport.com>
On Mon, 8 Dec 1997, Scott DiNitto wrote:
> >This is normal on any shell I have ever seen. Perl doesn't do wild
> >cards in the sense you are thinking -- I don't know what you are
> >after here.
>
> I am not debating that... I am just looking for a workaround. A way to
> tell perl that a wildcard is being used, even if it means perl not
> seeing the wildcard itself!
It's not Perl. It's the shell. If you don't want your shell to glob
arguments, check its docs or use a different one. 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: 09 Dec 1997 11:27:49 +1100
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: Wildcards
Message-Id: <yeok9dfs6m2.fsf@kudu.ind.tansu.com.au>
sdinitto@kronos.com (Scott DiNitto) writes:
> It's funny because I originally needed this for a
> program that removes new line characters. Someone had transferred a
> bunch of ascii files using binary transfer and that left a bunch of
> newline characters in the file. After unsuccessfuly finding a utility
> that could remove these easily, I decided to write a small perl
> program to do the trick. Now, I could have coded this easily to
> process all *.txt files without using the wildcard convention. But I
> was going to pass this program along to anyone else who would have a
> need for it... and that would mean more flexibility. So, although not
> a pressing problem, I have run into another "impossible to do in perl"
> challenge and now want to overcome it. But if it truly IS impossible,
> then I guess I can let it go. It's funny, because I originally coded
> this on win32 (that is where the files I needed to convert were held)
> and the wildcard convention works just great. It's just while testing
> on the unix end I have encountered this reaction.
How people would have this program behave in a Unix environment is this:
Let's call the program proctext (for "process text file").
The syntax should be
$ proctext file1 [files...]
ie proctext followed by 1 or more filename arguments
For each file named; that file is processed and the de-newlined version
written back in place.
So I can simply say:
$ proctext stuart.txt
and stuart.txt is processed for me and OK on my system again.
I can also say
$ proctext *
for all files in the current directory,
$ proctext *.txt
for all files in the current directory ending in '.txt'
$ proctext stu.txt stu2.txt
for those 2 files
and so on.
I think you've coded your program in the hope you'll just have to deal with
the one argument and handle it yourself; eg
$ proctext '*.txt'
but why not let the shell handle the * expansion for you? Otherwise I hope
your program can handle $ proctext chap[123].txt, $ proctext cha.[123].txt etc.
By giving proctext the syntax I've suggested; Unix users will be able to
run the program on any files they like in a sensible way. The usual Unix
syntax for programs is
$ progname [options] [filename(s)]
eg ls -l file1 file2
The Unix shell 'wildcard convention' is to do all the expansion itself before
giving it to the program. In this way; every Unix program written doesn't have
to handle expansion unless it specifically wants to. It's all done by the shell
and isn't a worry for the programmer. Unix programs should never have to ask
"did the shell do wildcard expansion on what the user originally typed?"-
you should just work on the arguments you get and say "yeah; this is what
the user wants".
So code your program to take any number of filename arguments and you'll be
fine under Unix. Consider:
foreach $filename (@ARGV) {
process_file($filename);
}
Hope this helps,
Stuart Cooper
stuartc@ind.tansu.com.au
------------------------------
Date: Mon, 08 Dec 1997 19:58:10 GMT
From: webmaster@radcliffe-waye.com (Paul Heindselman)
Subject: Re: Write to a text file
Message-Id: <348d4fe9.198284337@news.dx.net>
On 8 Dec 1997 14:27:07 GMT, scsyr01@aol.com (SCSYR01) wrote:
>I have a text file that I would like to append some text to when the user does
>an action and call it from Javascript (I am assuming Javascript doesn't allow
>the writing of files to the server because of security).
>
>Can someone point me in the write direction.
>
>Also, please email me and information,Thanks.
>
>scsyr01@aol.com
Ok...lets say you wanted to append the word "useraction" to your
textfile (myfile.txt) when the user clicks on a button.
Here is the JavaScript:
<INPUT TYPE=button VALUE=UserAction onClick="/cgi-bin/action.pl">
Then the Perl script:
#!/usr/bin/perl -w
open (MYFILE,">>myfile.txt");
print MYFILE "useraction\n";
close (MYFILE);
I haven't tested this but it should work.
Paul Heindselman
Webmaster - RealVision Inc.
webmaster@realvision-inc.com
------------------------------
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 1437
**************************************