[9118] in Perl-Users-Digest
Perl-Users Digest, Issue: 2736 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 27 13:08:02 1998
Date: Wed, 27 May 98 10:00:28 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 27 May 1998 Volume: 8 Number: 2736
Today's topics:
'insecure dependency in _____ when using setuid' in HP/ <sdh1@anchor.hotmail.com>
Call another perl script <ram@post4.tele.dk>
Re: Call another perl script (brian d foy)
Re: Clearly define "free software" <keithmur@mindspring.com>
Re: DBM and FreeBSD (Leslie Mikesell)
Re: HELP! - Perl Query String Encoding <jaeguy@hotmail.com>
Re: HELP! - Perl Query String Encoding <rootbeer@teleport.com>
Re: How can I get the system memory size of my system(L <khaines@oshconsulting.com>
Re: HOWTO : UDP ping ? <qdtcall@esb.ericsson.se>
Invoking the Perl interpreter from DOS shell <amandalay@str.com>
Re: list context: || vs or (Clinton Pierce)
Re: list context: || vs or (Charlie Stross)
Re: list context: || vs or <tchrist@mox.perl.com>
Re: Listening to a modem..... <rootbeer@teleport.com>
Re: Listening to a modem..... (Bbirthisel)
Modules in Perl <jaeguy@hotmail.com>
Re: Need a "word-count" <lr@hpl.hp.com>
Re: Need a "word-count" (Charlie Stross)
Re: Need a "word-count" <tchrist@mox.perl.com>
Re: Need a "word-count" <lr@hpl.hp.com>
Re: Need a "word-count" (Charlie Stross)
Re: Perl for WindowsNT? <lr@hpl.hp.com>
Re: Perl for WindowsNT? (Peter Gradwell)
Re: Perl for WindowsNT? <T.J.Arnesen@collector.org>
Re: Perl Memory profiling? (Tom Rokicki)
Please help with silly problem... tim@calabama.com
Re: Problem reading large files under Win95 (Mike Heins)
Re: sort array of hashes tarou@kormedia.com
system() in NT-Perl <jan.setnan@fm.sintef.no>
Re: Why does "each" not go thru entire hash?? <aqumsieh@matrox.com>
Re: Why does "each" not go thru entire hash?? (brian d foy)
Re: Xor computation (Tom Rokicki)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 May 1998 11:36:47 -0400
From: "Scott" <sdh1@anchor.hotmail.com>
Subject: 'insecure dependency in _____ when using setuid' in HP/UX 10.2
Message-Id: <6khc00$d8v$1@camel25.mindspring.com>
If I call a perl script from another program, if I try to use file
activities, I get this
message, it seems from the operating system, but I'm not sure. It works
with
file opens, `touch foo`, or anything trying to get at a file.
I'm using HP/UX 10.2 and Perl 5.004
I've talked to HP, and their solution was to write a C wrapper program for
the script:
main() {
setuid(geteuid());
system(scriptname);
}
and have the setuid bit on in the executable.
Another solution was to use something to the effect of:
su - bar -c script
when calling from the program.
Is there a "clean" way to get my script to work without wrapping it? I
can't
set the setuid bit on the script because it is not allowed in the kernel,
and
I don't feel like putting in a security hole.
Thanks,
scott...
sdh(number 1)(ampersand)mindspring(period)com
(sorry, but I'm spammed to death)
------------------------------
Date: Wed, 27 May 1998 18:34:21 +0200
From: Richard Amdi Madsen <ram@post4.tele.dk>
Subject: Call another perl script
Message-Id: <356C408D.5DC1@post4.tele.dk>
Hi,
I try to have one perl program call another, an redirect the output to
the browser. The secound program works, because I can call it directly,
but the first one gives "Document contains no data" in Netscape?
Thanks for your help,
Richard
1. program:
#!/bin/perl
print "Content-Type: text/html\n\n";
open FH, "my_perl_prog.cgi |" || die "Error $! on open of pipe\n";
while(<FH>) {
print "$_";
}
2. program: my_perl_prog
#!/bin/perl
print "Content-Type: text/html\n\n";
print "output from my_perl_prog";
------------------------------
Date: Wed, 27 May 1998 12:57:23 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Call another perl script
Message-Id: <comdog-ya02408000R2705981257230001@news.panix.com>
Keywords: from just another new york perl hacker
In article <356C408D.5DC1@post4.tele.dk>, Richard Amdi Madsen <ram@post4.tele.dk> posted:
>I try to have one perl program call another, an redirect the output to
>the browser. The secound program works, because I can call it directly,
>but the first one gives "Document contains no data" in Netscape?
>open FH, "my_perl_prog.cgi |" || die "Error $! on open of pipe\n";
is that script in the PATH? :)
--
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>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: Wed, 27 May 1998 11:01:24 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Clearly define "free software"
Message-Id: <356C38D4.C3FF6065@mindspring.com>
Klaus.Schilling@home.ivm.de wrote:
>
> >
> > Re: Clearly define "free software"
> >
> > From: les@MCS.COM (Leslie Mikesell)
> > References:
> > <3569ac1f.0@news.ivm.net>
> >In article <3569ac1f.0@news.ivm.net>, <Klaus.Schilling@home.ivm.de> wrote:
> >>>
> >>>>> >Proprietary software like oracle is immoral.
> >>>>>
> >>>>> Why do you think that? I can understand the concept that you do
> >>>>> not want to pay for software that someone else developed and therefore
> >>>>> owns. I don't understand the concept that the existence of
> >>>>> this work is immoral. Is someone harmed by the fact that this
> >>>>> work, which wouldn't otherwise exist, is available to people willing
> >>>>> to help recover the cost of it's development and encourage further
> >>>>> such work?
> >>
> >>Intellectual property is theft from the collective consciousness, thus evil.
> >
> >Does that mean you believe that all ideas are 'discovered', as opposed
> >to being created by individual effort?
> >
>
> Ideas are preexistant and rememorized.
>
What *have* we here, boys? One a them gawl-durn Platonists...
------------------------------
Date: 27 May 1998 10:08:21 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: DBM and FreeBSD
Message-Id: <6kha95$otc$1@Jupiter.Mcs.Net>
In article <Pine.GSO.3.95q.980526224514.7804A-100000@uhunix3>,
Ritchard Shadian <rshadian@hawaii.edu> wrote:
>I don't know a whole lot about the various types of DBM files. All I know
>is that when I used a dbmopen() call in my script, I was able to take the
>data in a hash and store it in two files with .pag/.dir extensions.
>
>That was on a Linux machine. When I use the exact same script on a
>FreeBSD machine, it creates one file with a .db extension and doesn't find
>the .dir/.pag files.
>
>I want to read from the same database files that I had on my Linux
>machine. How can I get Perl to use the .dir/.pag files instead of the .db
>file? I don't want to re-enter all the data again. I know there's
>different kinds of DBMs, like GDBM, DB, NDBM, and ODBM, but I don't know
>which one I was using. Also I tried all the use directives: GDBM_File,
>DB_File, NDBM_File, and AnyDBM_File, but I couldn't get it to produce the
>.pag/.dir files like before. Is there a way to use the old format on BSD?
>Or is there a simple way to convert the data between DBM types? Any help
>would be appreciated.
It's a long story... Once upon a time there was the ndbm interface
in one of the proprietary unix versions. Then both gdbm and DB
were developed as free alternatives with their own extended interfaces
plus backwards compatibility to the ndbm interface. Different
distributions of Linux use different default ndbm emulation - it
just depends on which library is used. RedHat uses DB. I think
most of the others use gdbm. If you have .dir/.pag files and
they are linked to each other it is actually a gdbm file, and the
main difference between using the ndbm emulation and native gdbm
is that it uses the .dir/.pag names. If you rename the file or
make another link without the extension you should be able to
use GDBM_File to access it. However it is always a good idea
to write import/export utilities for any type of database
before using it to store data that is hard to reproduce.
Les Mikesell
les@mcs.com
------------------------------
Date: Wed, 27 May 1998 15:12:13 GMT
From: "J" <jaeguy@hotmail.com>
Subject: Re: HELP! - Perl Query String Encoding
Message-Id: <01bd8981$cf724180$1000000a@iain>
how do I use uri::escape?
i'm a little new at perl.... VB is my lang.
J <jaeguy@hotmail.com> wrote in article
<01bd897c$730fb080$1000000a@iain>...
> This part of my script doesn't work because it isn't encoded:
> How would I get $newurl encoded for the web?...........
------------------------------
Date: Wed, 27 May 1998 15:28:42 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: HELP! - Perl Query String Encoding
Message-Id: <Pine.GSO.3.96.980527082715.13639Q-100000@user2.teleport.com>
On Wed, 27 May 1998, J wrote:
> how do I use uri::escape?
Every module has its own docs. See the perldoc command, if your system's
standard documentation system doesn't cover the module you need. Remember
that module names are (or should be) case sensitive. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 27 May 1998 09:57:14 -0600
From: "Kirk D. Haines" <khaines@oshconsulting.com>
To: mikpf@hotmail.com
Subject: Re: How can I get the system memory size of my system(Linux)
Message-Id: <6khd0g$dbg$1@gte2.gte.net>
mikpf@hotmail.com wrote:
>
> Thanks,
>
> Jong
>
> jong@salt2.med.harvard.edu
#!/usr/bin/perl
use strict;
open(MEM,"</proc/meminfo") || die "Something is very wrong\n";
my $line;
while ($line = <MEM>)
{
next unless ($line =~ /^Mem\w/);
print $line;
}
close(MEM);
gives on the system I am on now:
MemTotal: 64208 kB
MemFree: 1220 kB
MemShared: 36248 kB
i.e. this pretty much isn't a Perl issue. It's a Linux issue. Memory
information can be read from /proc/meminfo under Linux.
Kirk Haines
------------------------------
Date: 27 May 1998 16:56:04 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: HOWTO : UDP ping ?
Message-Id: <issolv7ofv.fsf@godzilla.kiere.ericsson.se>
"Jerome Gay" <gay@aspentech.com> writes:
> I need some kinda "UDP ping" and I'm pretty sure perl can do it... how ?
RTFM Net::Ping
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Wed, 27 May 1998 11:21:49 -0400
From: Ajit Mandalay <amandalay@str.com>
Subject: Invoking the Perl interpreter from DOS shell
Message-Id: <356C2F8C.9272884A@str.com>
Hi,
I am in the process of learning Perl, and would like to know how the
Perl interpreter can be invoked from a file containing Perl script and
have it interpret the script in the file in a DOS or Windows
environment. Does the file have to have a special extension? Any
suggestions would be highly appreciated.
Thanks
Ajit
------------------------------
Date: 27 May 1998 14:54:30 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
To: tchrist@mox.perl.com (Tom Christiansen)
Subject: Re: list context: || vs or
Message-Id: <6kh9f6$m0m4@eccws1.dearborn.ford.com>
[courtesy cc of this posting sent to cited author via email]
In article <6kfepa$c4h$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> writes:
>There isn't. But you're calling @whatever a list, and it's not.
>It's an array.
>
> (...)
>
>There's something about the entire contexture of the language
>that is unclear to the general public, and I'm not sure
>what to do to clear it up.
I see this a lot, and have given it some consideration, and have a
couple of ideas:
Some of the confusion seems to come from people exposed to perl starting
at version 4. Back then all of the functions required parens to contain
their arguments (at least the llama taught it that way). So after a while
of seeing things in the Perl 4 Llama as:
link("fred", "bigdumbguy") || die; # (p. 148)
$x=index($string, $substring); # (p. 165)
($val1, $val2)=unpack("ll", "ABCD");# (p. 181)
And after a cursory reading of Chapter 3 (Llama), newbies begin to think
of anything in parens is a list. And thus begins the road to Hell.
(Instead of thinking that ()'s contain lists, also they set precedence,
and sometimes they're just syntatic sugar.)
Then, cruising around in clpm and in the Camel, they get exposed to such
nonsense as:
@who=("fred", "barney", "betty", "wilma")[2,3];
And they REALLY get the idea that ()'s do nothing but denote lists.
("Whenever I wrap parens around something, I get a list"). Also, the Llama
does a good job of demonstrating the interchangability of lists and arrays.
This one usually takes them down to about the 3rd level of Hell or so:
$c=(split(//, $a))[4]; # Yeilds 5th character in $a
Then newbies start wrapping parens around every damned thing in sight,
trying to get a list--regardless of what context the thing appears. At
this point, the nonsense starts:
$d=($a, $b, $c); # Smell the brimstone
I think the Llama could use a "look out for this" note in the chapter
on arrays and lists. (I haven't seen the Perl 5 Llama yet, if it's in
there, my apologies). The Camel mentions this on Chapter 2, in the 3rd
to the last paragraph on "Lists and Arrays". Elsewhere the Camel does
things like:
yaddayaddayadda; # Don't do this.
Maybe it should have an example of using a comma-operator where you
THINK you're in a list and pointing out that this is Evil.
The Camel talks about Context quite a bit. Since the list/array/scalar/
comma-operator/context thing is such a newbie-confusing aspect of the
language, maybe the Llama should point it out, and the Camel draw those
two sections a little closer together. It's implied:
"You will be miserable until you learn the difference between
scalar and list context...." (Camel, Chap 2, Context)
"...A comma-seperated list evaluated in a scalar context will
return the last value..." (Camel, Chap 2, List Values and Arrays)
Anyways, that's my $.02. I haven't had a lot of experience teaching this,
so it may only be $.01's worth, but I've observed once you put the two
statements together for students, and then show them a BAD example, they
usually don't forget it.
"$d=($a, $b, $c);"
Vizzini: It returned $c? INCONCEIVABLE!
Inigo: You keep using that code. I do not think it
means what you think it means.
--
+------------------------------------------------------------------------+
| Clinton A. Pierce | "If you rush a Miracle Man, | http://www. |
| cpierce1@ford.com | you get rotten miracles" | dcicorp.com/ |
| fubar@ameritech.net |--Miracle Max, The Princess Bride| ~clintp |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*
------------------------------
Date: Wed, 27 May 1998 15:13:47 GMT
From: charlie@antipope.org (Charlie Stross)
Subject: Re: list context: || vs or
Message-Id: <slrn6mobfd.scr.charlie@cs.ed.datacash.com>
On 27 May 1998 14:35:22 GMT, Tom Christiansen
<tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, charlie@antipope.org writes:
>:you get singular, set, and
>:dictionary types (scalars, arrays, hashes).
>
>Um, one uses hashes for sets, not arrays.
Now _I'm_ confused. I used the word 'set' colloquially, to
mean a collection of unindexed thingies, as opposed to a hash (a bunch
of indexed thingies); as in, "perl understands singular, plural, and
indexed data". Is my understanding incorrect?
>I use `batshit' in an idiosyncratic fashion. --Andrew Hume
(Don't we all?)
-- Charlie
------------------------------
Date: 27 May 1998 15:35:59 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: list context: || vs or
Message-Id: <6khbsv$nan$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, charlie @antipope.org writes:
:tchrist>Um, one uses hashes for sets, not arrays.
:
:Now _I'm_ confused. I used the word 'set' colloquially, to
:mean a collection of unindexed thingies, as opposed to a hash (a bunch
:of indexed thingies); as in, "perl understands singular, plural, and
:indexed data". Is my understanding incorrect?
The classic use of a hash as a set is:
something($whatever) unless $seen{$whatever}++;
--tom
--
I'm TRYING to be a back end! - --Andrew Hume
------------------------------
Date: Wed, 27 May 1998 15:00:32 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Listening to a modem.....
Message-Id: <Pine.GSO.3.96.980527075952.13639O-100000@user2.teleport.com>
On Wed, 27 May 1998, Stuart Grimshaw wrote:
> I'm having trouble getting Perl to have a conversation with my modem...
Have you seen what the FAQ has to say about using serial ports? Hope this
helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 27 May 1998 15:10:37 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Listening to a modem.....
Message-Id: <1998052715103700.LAA17402@ladder03.news.aol.com>
Hi Stuart:
>I'm having trouble getting Perl to have a conversation with my modem...
>
>I open the port thus :-
>
> open(MODEM, "+>COM2");
>
>and can get it to dial the number...
>
> print(MODEM "ATDT 0973100602")
>
>but can I get it to listen to the characters coming in...
>
This is a well-known problem on Win32 (you didn't indicate NT, 95, or other).
I have written a module to address this. It entered alpha test this week. It's
not ready for "prime time" yet, however. You can see the documentation at:
http://members.aol.com/Bbirthisel
Keep watch for future announcements.
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: Wed, 27 May 1998 15:56:57 GMT
From: "J" <jaeguy@hotmail.com>
Subject: Modules in Perl
Message-Id: <01bd8988$0eb459e0$1000000a@iain>
Sorry for bugging....
I'm using Website running with Perl5 installed... (and now Escape.pm)
am trying to call it from a perl script using
use URI::Escape
but every time I include this in the script the server throws back a 500
Error......
the script is being used to grab a reference number (ie: hmr00001) from
QUERY_STRING and search a database, pull out the relevant information then
call a second script as follows:
createhtml.pl?a=1&b=2&caption=Hello There My
Son&Filename=http://www.domain.com/images/crap.jpg
what am I doing wrong?
J
------------------------------
Date: Wed, 27 May 1998 07:49:34 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Need a "word-count"
Message-Id: <6kh96f$7d8@hplntx.hpl.hp.com>
Charlie Stross wrote in message ...
...
>print join("\n", map { "$_ -> " . $words{$_}} sort keys %words);
...
Why are you going out of your way to avoid printing a complete last line
(that is, a line complete with a terminating "\n")? And why not let the
double-quotes do all the concatenation?
print map "$_ -> $words{$_}\n", sort keys %words;
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Wed, 27 May 1998 15:11:15 GMT
From: charlie@antipope.org (Charlie Stross)
Subject: Re: Need a "word-count"
Message-Id: <slrn6mobal.scr.charlie@cs.ed.datacash.com>
On Wed, 27 May 1998 07:49:34 -0700, Larry Rosler
<lr@hpl.hp.com> wrote:
>Why are you going out of your way to avoid printing a complete last line
>(that is, a line complete with a terminating "\n")?
Because it never occured to me to print from within a map(). Sheesh!
------------------------------
Date: 27 May 1998 15:39:31 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Need a "word-count"
Message-Id: <6khc3j$nan$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Larry Rosler" <lr@hpl.hp.com> writes:
:print map "$_ -> $words{$_}\n", sort keys %words;
^ ^
Boy, those space are sure important there!
--tom
--
A formal parsing algorithm should not always be used.
--D. Gries
------------------------------
Date: Wed, 27 May 1998 09:04:06 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Need a "word-count"
Message-Id: <6khdi7$8nb@hplntx.hpl.hp.com>
[courtesy cc of this posting sent to cited author via email]
Tom Christiansen wrote in message
<6khc3j$nan$2@csnews.cs.colorado.edu>...
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc,
> "Larry Rosler" <lr@hpl.hp.com> writes:
>:print map "$_ -> $words{$_}\n", sort keys %words;
> ^ ^
>
>Boy, those space are sure important there!
>
>--tom
...
Actually, they're not. It works perfectly well without them.
I was slightly concerned by the original submitter's use of the token
'->' when all he wanted was the appearance of an arrow. Apparently the
perl lexer doesn't see the syntax there either.
my %words = (foo => 2, bar => 4);
print map "$_->$words{$_}\n", sort keys %words;
__END__
bar->4
foo->2
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Wed, 27 May 1998 16:24:45 GMT
From: charlie@antipope.org (Charlie Stross)
Subject: Re: Need a "word-count"
Message-Id: <slrn6mofkg.vv2.charlie@cs.ed.datacash.com>
On Wed, 27 May 1998 09:04:06 -0700, Larry Rosler
<lr@hpl.hp.com> wrote:
>I was slightly concerned by the original submitter's use of the token
>'->' when all he wanted was the appearance of an arrow. Apparently the
>perl lexer doesn't see the syntax there either.
Yeah, I noticed that double-quoting seems to prevent interpretation
of symbolic refs some time ago (though I have to admit, I still felt
the need to include those spaces!). Is this potentially a problem? If
nothing else, it seems to me to be something of a linguistic
inconsistency ...
-- Charlie
------------------------------
Date: Wed, 27 May 1998 08:10:26 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Perl for WindowsNT?
Message-Id: <6khadj$7uj@hplntx.hpl.hp.com>
Brian J. Sayatovic wrote in message <6kh7ld$81c$1@malgudi.oar.net>...
...
>Basically. Perl for NT is about 99% compatible with Perl for UNIX.
Some of
>the crazy IPC, etc. stuff doesn't work but there are workarounds for
even
>that.
Some functions that are not "crazy IPC, etc. stuff", such as flock and
alarm, are nonexistent and difficult to emulate. Some Win32
implementations of Perl do not implement crypt.
> Furthermore, you have to wrroy about stuff like \'s on NT and /'s on
>UNIX in pathnames.
No, you don't. '/' works fine. But NT (like DOS) has a more restricted
character set and ignores case distinctions in pathnames.
> Witha bit of concentration, you make a script that will
>work on both platforms. If you're writing perl scripts for CGI on web
>servers, its worth a shot grap Perl for Win32, and IIS 4.0 and develop
'em
>locally.
...
Also, the set of environment variables is different -- for example,
$ENV{TZ} is defined on all Unix systems and no NT (or Windows 95 or Dos)
systems.
"About 99% compatible" obviously depends strongly on what you're trying
to do. For basic character manipulation, Perl is much easier to port
than C, for example. And the restrictions on portability imposed by the
operating system apply to all languages, of course.
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Wed, 27 May 1998 16:37:52 +0100
From: pjg7@aber.ac.uk (Peter Gradwell)
Subject: Re: Perl for WindowsNT?
Message-Id: <pjg7-2705981637520001@pcihhh.ott.aber.ac.uk>
In article <6kh3lf$2sd$1@o.online.no>, "T.J. Arnesen"
<T.J.Arnesen@collector.org> wrote:
> Hi.
> I have heard that there is a Perl Version for WindowsNT. Does that mean if
> you have NT installed on your computer, you do not need to be online in
> order to test your Perl scripts.
probably.
go www.activestate.com or read the FAQ!
Peter.
--
peter at gradwell dot com
mailto:peter[@]gradwell.com online @ http://www.gradwell.nu/
"To look back all the time is boring. Excitement lies in tomorrow"
...have you seen www.aber.nu? - It'll be a "nu" aber web site.
------------------------------
Date: Wed, 27 May 1998 16:46:26 +0200
From: "T.J. Arnesen" <T.J.Arnesen@collector.org>
Subject: Re: Perl for WindowsNT?
Message-Id: <6khcg2$ame$1@o.online.no>
Sorry for being a bit unclear in my last message.
The reason why I asked the question was anxious to learn more about perl. I
have read books and studied perl script, and even made some changing in
scripts. Though I have always thought that I would need to be online.
Probably because Perl earlier was written for Unix. The phone bill has
become very high as I have to pay for every second I am using. It would be
much cheaper to install Windows server software on my computer. It doesn't
need to be Unix. All I want to do is learn more and make programs in Perl.
Thanks a lot for giving me answer an advises.
T.J.
T.J. Arnesen wrote in message <6kh3lf$2sd$1@o.online.no>...
>Hi.
>I have heard that there is a Perl Version for WindowsNT. Does that mean if
>you have NT installed on your computer, you do not need to be online in
>order to test your Perl scripts.
>
>Thanks
>T.J.
>
>
------------------------------
Date: 27 May 1998 09:36:55 -0700
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Re: Perl Memory profiling?
Message-Id: <6khff7$t8g@cello.hpl.hp.com>
> Is there any way I can get memory usage info from a running perl process?
To find out where the RAM is going, this is what I do. I run my script
under the Perl debugger, let it run a while, and then use the `V' command.
The only problem is, if it is truly generating a lot of structures,
you want that output stored to a file where you can analyze it. (For
instance, count the number of objects of a particular type, and so on.)
The only way I've been able to do this is a real hack. What I do is
create a shell script in my local directory called mytrace that contains
#!/bin/csh
cat >mytrace.log
(You of course may use Perl). I then use this as my pager, with the
debugger command
O pager=mytrace
Then, run V through the pager with
|V
If anyone knows a better way to do this, I'd love to hear it.
Because `V' only lists each `address' once, this gives you a pretty
good idea of where memory is going.
-tom
$g=join'',map{chr rand 2}a..wls;for($q=201;print'-'x79;$g=($f^($w=($z=$m.$e)^
substr$e,$q)^($n=$b^$d|$a^$l))&($w|$z^$f^$n)&($l|$g)){for$y(1..20){$_=substr$g
,$y*$q+6060,79;tr/\0\1/ X/;print"$_\n"}$c=($d=($a=substr$g,1)^($b=0 .$g))^$g;
$e=($f=$a&$b)|$d&$g;$l=substr$d^($a=($b=($m="\0"x$q).$c)^substr$c,$q),0,15879}
------------------------------
Date: Wed, 27 May 1998 09:54:15 +0000
From: tim@calabama.com
Subject: Please help with silly problem...
Message-Id: <356BE2A6.3021@calabama.com>
Hello I am new to perl.
When I call this script from the command line a file is creatd if it
does not already exist. It also seems to append an existing file.
If I call the script from a browser , it does not respond the same way.
a file is NOT creatd if it does not exist already . It also seems to NOT
append an existing file.
dir permission chmod 750
file permission chmod 750
Can anyone help me?
Tim
______________________________________
#!/usr/local/bin/perl5
$thedate = `/bin/date`; chop($thedate);
print "Content-type: text/html\n\n";
read(STDIN, $raw_data, $ENV{CONTENT_LENGTH});
$items = split('&', $raw_data);
for ($i = 0; $i < $items; $i++) {
($title,$body) = split('=', $_[$i]);
$body =~ tr/+/ /;
$body =~ s/%(..)/pack("C", hex($1))/eg;
$in{"$title"} = $body;
}
print "Doc contains Data\n";
print "<BR>\n";
print "$thedate\n";
###########################
#
# File should open?
#
##########################
open(FILE,">/webadmin/home/web1/timb97/public_html/news.html") || die
"Well, whats up.. cant open file";
print FILE "<html>\n";
print FILE "<head>\n";
print FILE "</head>\n";
print FILE "<body>\n";
print FILE "<IMG SRC='gifs/online.gif'>\n";
print FILE "<body bgcolor=#FFFFFF>\n";
print FILE "<BR Clear=All>\n";
print FILE "<BR Clear=All>\n";
print FILE "<BR>\n";
print FILE "$thedate\n";
print FILE "</CENTER>\n";
print FILE "</body>\n";
print FILE "</html>\n";
close (FILE);
print "Location:/news.html\n\n";
exit(0);
------------------------------
Date: 27 May 1998 11:19:35 -0500
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Problem reading large files under Win95
Message-Id: <356c2f07.0@news.one.net>
Vasile CALMATUI <vasile@club-internet.fr> wrote:
> vasile@club-internet.fr (Vasile CALMATUI) wrote:
>>I have a problem with big files under Win95.
>>
>>The problem is that I can read only the first 4-5 Mb from the file (total length is 25 Mb).
>>It works well by splitting the file in some little files of 4 Mb.
>>PS : I'm using Perl for Win32 "normal version" (not ActiveState) version 5.004_02
> OK, I will re-explain the problem here.
> I have a 25Mb text file made by a mail program. I want to take all the URLs
> which are in this file. In most cases, an URL ends at the end of the line.
> The problem is that the URLs at the end of the file were not matched.
> Finally, I found the problem : the <FROM> never reached the end
> of the file.
> So, by splitting the big file in some 4Mb files, it worked well.
> The script is simple(little) enough, so I post it entirely.
> #Takes all the UNIQUE URL from a file and put them in another file
> my @fromFile = ("big25MbFile.txt");
> my $outputFile = "allURL.txt";
> my @all;
> foreach $file (@fromFile) {
> #reading the file entirely
> open (FROM,"$file") || die " Error opening file: $file\n";
binmode(FROM);
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
"The U.S. Senate -- white 131 Willow Lane, Floor 2 | || _ \
male millionaires working Oxford, OH 45056 | || |_) |
for YOU!" -- Dave Barry <mikeh@minivend.com> |___| _ <
513.523.7621 FAX 7501 |_| \_\
------------------------------
Date: Wed, 27 May 1998 16:26:03 GMT
From: tarou@kormedia.com
Subject: Re: sort array of hashes
Message-Id: <356c3e24.3968139@news.comstar.com>
On 20 May 1998 10:58:01 GMT, Tom.Grydeland@phys.uit.no (Tom Grydeland)
wrote:
>If I read you correctly, this is what you need:
>
>
>sub byrel_focus {
> $a->{byrel_focus} <=> $b->{byrel_focus};
>}
>
>
>//Tom Grydeland <Tom.Grydeland@phys.uit.no>
> - Do radioactive cats have 18 half-lives? -
I ran into the same problem and am finding that this isn't working for
me. Perhaps I'm just not implementing it correctly<SIGH>
Kirk Tarou <tarou@kormedia.com>
------------------------------
Date: Wed, 27 May 1998 18:34:38 +0200
From: Jan Setnan <jan.setnan@fm.sintef.no>
Subject: system() in NT-Perl
Message-Id: <356C409E.67D999F7@fm.sintef.no>
Hi ..
I'm running this simple program (dir.pl) :
$utfil = "d:\\temp\\utfil.txt";
system(qq(dir > $utfil));
on a PC with Windows NT 4.0.
When I run it from the command prompt, it works OK,
the file utfil.txt is created and it contains the directory listing.
But when I try to schedule it with "at 12:00 perl dir.pl"
nothing happens, no file is created.
What's up ??
Jan
------------------------------
Date: Wed, 27 May 1998 10:50:56 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Why does "each" not go thru entire hash??
Message-Id: <356C2850.66D20A4B@matrox.com>
brian d foy wrote:
> In article <3569916B.FA2C8EF7@matrox.com>, Ala Qumsieh <aqumsieh@matrox.com> posted:
>
> > I don't exactly get the question. But I think the "problem" might be with
>
> why "think"? there's no need to guess when you can test it yourself.
>
Did you really understand what I said? When I said "I think the problem ..." I meant
that my impression of the posted problem appears to be due to the way Perl organizes
its hashes. The only test that I can do in this case is to ask the poster for more
clarification! Ididn't say "I think Perl organizes its hashes in a seemingly random
fashion" because I know that it does.
> >the way Perl stores its hashes (in an "apparently" random order). Of course,
> >it does so to maximize memory usage efficiency.
>
> how is it more memory efficient? you still have to store the data!
Yep .. but you achieve faster access to the data.
> >Ignore my comments if I'm totally off :-)
>
> we can't ignore your comments. they're archived at Deja News. if nobody
> stepped in to correct mistakes, others might think you were right.
What was wrong with what I said? I meant to ignore my comments if my original
assumption of what the problem might be was not correct. My answer is based on that
assumptions which gives it no merit once my assumption is proved wrong.
> --
> 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>
> Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
I don't understand why you (specifically) love to prove me wrong at every chance. Was
it something I did?
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Wed, 27 May 1998 12:45:06 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Why does "each" not go thru entire hash??
Message-Id: <comdog-ya02408000R2705981245060001@news.panix.com>
Keywords: from just another new york perl hacker
In article <356C2850.66D20A4B@matrox.com>, Ala Qumsieh <aqumsieh@matrox.com> posted:
>brian d foy wrote:
>> In article <3569916B.FA2C8EF7@matrox.com>, Ala Qumsieh <aqumsieh@matrox.com> posted:
>> >the way Perl stores its hashes (in an "apparently" random order). Of course,
>> >it does so to maximize memory usage efficiency.
>> how is it more memory efficient? you still have to store the data!
>Yep .. but you achieve faster access to the data.
which has nothing to do with memory efficiency.
>> >Ignore my comments if I'm totally off :-)
>> we can't ignore your comments. they're archived at Deja News. if nobody
>> stepped in to correct mistakes, others might think you were right.
>What was wrong with what I said?
besides being incorrect, uninformed, and untested?
>I don't understand why you (specifically) love to prove me wrong at every chance. Was
>it something I did?
to some people i pay extra attention because they are
frequently wrong. would you rather Tad or Tom C. prove you
wrong instead of me?
rather than worry about the Why, perhaps you should read the
Camel, or the man pages, write code to test your ideas,
*then* post your response. be aware, though, that your
message is broadcast globally. your posts are the only
things that many people will know about you. this should
give you some pause before you rush off to post an untested
or uninformed answer!
--
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>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
ahhhh, filtering! ahhhh, procmail!
------------------------------
Date: 27 May 1998 09:44:14 -0700
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Re: Xor computation
Message-Id: <6khfsu$br@cello.hpl.hp.com>
> ($alpha = <<EOF) =~ s/^\s*//gm;
> This particularly rapid unintelligible patter isn't
> generally heard and if it it, it doesn't matter.
> EOF
> ($beta = <<EOF) =~ s/^\s*//gm;
> What a to-do to die to day at a minute or two to two.
> A thing distinctly hard to say, yet harder still to do.
> And they'll beat a tatoo at twenty to two, a rat-ta-tat
> tat-ta-tat tat-ta-tatoo. And the dragon will come when
> he hears the drum at a minute or two to two today at
> a minute or two to two.
> EOF
> $alpha ^= $beta;
> $beta ^= $alpha;
> $alpha ^= $beta;
> print "$alpha\n\n$beta\n\n";
But this munges the lengths of the strings, appending a bunch of nulls
to the shorter one. If you run this and pipe the output to a file, and
then examine that file, you'll see all those null's. (Or just print the
length of the strings).
This is one of those clever, yet egregiously dangerous hacks that
cause problems because they are generally `invisible' (just like make
requiring an invisible tab before commands, or shells treating
\ <space> <newline> at the end of a line differently from \ <newline>.
-tom
for(@a=map{int rand 2}1..1580;$p=1;print'-'x60,"\n"){map{map{print(($n[$p]=(($a
[$p]|grep{$a[$p+$_]}(-80..-78,-1,1,78..80))==3))?'#':' ');$p++}(1..79);print
"\n"}(1..20);@a=@n}
------------------------------
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 2736
**************************************