[16582] in Perl-Users-Digest
Perl-Users Digest, Issue: 3994 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 12 00:05:34 2000
Date: Fri, 11 Aug 2000 21:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <966053117-v9-i3994@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 11 Aug 2000 Volume: 9 Number: 3994
Today's topics:
Auto running a script via email or by a specific time?? <ryanmh_99@yahoo.com>
Re: Cross-platform shebang line CGI script shenanigans <chris@spagnet.com>
Re: Dynamic Hash and variable declaration?? <bwalton@rochester.rr.com>
Re: HELP - string permutations in perl <bwalton@rochester.rr.com>
Re: HELP - string permutations in perl (Joe Smith)
Re: How to replace the newline in perl? (Joe Smith)
Re: How to replace the newline in perl? <chris@spagnet.com>
Re: IO::Socket problem <sumengen@hotelspectra.com>
Re: Negativity in Newsgroup <joehecht@code4sale.com>
Re: Negativity in Newsgroup (Randal L. Schwartz)
Re: Negativity in Newsgroup <godzilla@stomp.stomp.tokyo>
Re: Negativity in Newsgroup (Eric Bohlman)
Re: Perl calls shell (Joe Smith)
Re: perl script (Joe Smith)
Re: Pipe on WinNT (Joe Smith)
Re: Problem redirecting error messages to a file : v5.6 (Joe Smith)
ps on NT <sumengen@hotelspectra.com>
Re: s/// and symbolic references (Joe Smith)
Re: setting cookie twice in same script (Joe Smith)
User-defined hash... <scoot99@hotmail.com>
Re: Were are all the executibles? (Joe Smith)
Re: where can find the document about how to install pe (Joe Smith)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 12 Aug 2000 03:29:52 GMT
From: Ryan <ryanmh_99@yahoo.com>
Subject: Auto running a script via email or by a specific time??
Message-Id: <sp9h5g9mn4t27@corp.supernews.com>
Is it possible to run a PERL script in response to an email to a specific
email address?? Is it possible to have a script run on a specific time
every day?? Thanks for the help
Ryan
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Fri, 11 Aug 2000 22:11:52 -0400
From: Chris Barnabo <chris@spagnet.com>
Subject: Re: Cross-platform shebang line CGI script shenanigans - Windows and Linux with Apache
Message-Id: <MPG.13fe7c74d5de4f909896a3@news.supernews.com>
On Fri, 11 Aug 2000 20:45:53 GMT, Doran <doran@NOSPAMaltx.net> said ...
> It shouldn't matter* what the shebang line reads on the Windows
> machine, particularly if it's running as a CGI script on a web server,
> since Windows handles all this through the registry.
>
Not necessarily ... Apache, for instance, will ignore the registry setting
unless you include the directive "ScriptInterpreterSource registry" in your
configuration.
But then, this is actually more of a server issue than a Perl issue ...
probably ought to move it over to the appropriate server group to get a
definitive answer - Glyndwr said the _source_ environment was
Debian/Apache/Perl/MySQL, but didn't actually specify what the target
environment was on the Win2K system.
-- Chris
________*________ Chris Barnabo, chris@spagnet.com
____________ \_______________/ www.spagnet.com
\__________/ / /
__\ \_______/ /__ "The heck with the Prime Directive,
\_______________/(- let's destroy something!"
------------------------------
Date: Sat, 12 Aug 2000 01:17:14 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Dynamic Hash and variable declaration??
Message-Id: <3994A5CE.B72BBEA2@rochester.rr.com>
stimpiton@my-deja.com wrote:
>
> Is it possible to declare hashes and variables on the fly in a perl
> program?
Of course.
>
> I am reading a config file that is like so:
> Key[hash] value
> Key2[hash] value
>
> Key[hash2] value
> Key2[hash2] value
>
> ...
>
> I don't know how many hashes will be in the file since it can vary.
> What I want to do in psudo code:
> while (<FILE>)
> {
> split into $key $hash and $value
> put $value into $hash (that has not been declared and is not named
> hash)
> }
That's a BAD IDEA. The reason why is that by creating variable names
that come from your data, you run the risk of overwriting variables your
program uses otherwise. In general, you wouldn't know what names might
come in your data. The BETTER IDEA is to use a hash to hold references
to the hashes you want to generate. Then you use the namespace of your
outer hash to hold the inner hashes, so you don't corrupt your program's
variable namespace.
>
> For example:
> Key[junk] 1
> Key2[junk] 5
>
> Key[junk] 3
> Key2[junk2] 4
>
> would make two hashes (one junk and one junk2) and the keys would be
> Key and Key2 and the values of each the value.
>
> I tried something like
>
> $hash{$key} = $value
>
> hoping it would translate into something like $junk{Key} = 1 but it
> doesn't.
>
> Is this possible?
> How do I access it if so?
>
> Thanks
> Cade
...
Try something like:
use Data::Dumper;
while(<DATA>){
chomp;
if(/^(\w+)\[(\w+)\]\s*(.*)/){
$key=$1;
$hash=$2;
$value=$3;
$varhash{$hash}{$key}=$value;
}
}
print Dumper(\%varhash);
__END__
Key[junk] 1
Key2[junk] 5
Key[junk] 3
Key2[junk2] 4
--
Bob Walton
------------------------------
Date: Sat, 12 Aug 2000 01:56:41 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: HELP - string permutations in perl
Message-Id: <3994AF0A.1AB8880D@rochester.rr.com>
kassaal@my-deja.com wrote:
>
> I am working on a project that requires me to
> create fixed length strings
> (8 -16 characters). Each character can be
> (A,C,G,U). That probably perked
> up the ear of a biologist or two. I need to
> generate every permutation of
> (A,C,G,U) for each length of each string.
> Basically, I want to create all
> permutations of strings which are between 8 and
> 16 characters in length and
> only consisting of the 4 characters I specified.
> I can't seem to come up
> with an elegant solution. I also can't fine a
> module that can do what I
> want. I think the solution involves a bunch on
> nested for loops, but I am
> pretty stumped on this one. Any help would
> greatly be appreciated.
...
> Altaf Kassam
> email - kassaal(at)about.com
...
Are you aware that there are over 4 trillion permutations for your
16-character string? You might want to reconsider what you are doing.
If you actually wish to proceed, one way is (assuming this is what you
really mean, since the definition of a permutation doesn't seem to fit
what you are doing):
$string='A' x 4; #modify for desired string length
%nextchar=('A'=>'C','C'=>'G','G'=>'U','U'=>'A');
print "$string\n"; #print first one
print "$string\n" until &addacharacter;
print "$string\n"; #print last one
sub addacharacter{
my @in=split //,$string;
for(@in){
$_=$nextchar{$_};
last unless /A/; #carry needed?
}
$string=join '',@in;
$string=~/^U+$/; #last one is all U's
}
--
Bob Walton
------------------------------
Date: 12 Aug 2000 03:09:49 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: HELP - string permutations in perl
Message-Id: <8n2f5t$1upv$1@nntp1.ba.best.com>
In article <8n1soa$9fr$1@nnrp1.deja.com>, <kassaal@my-deja.com> wrote:
>I need to generate every permutation of (A,C,G,U) for each length of each
>string. I think the solution involves a bunch on nested for loops, but I am
>pretty stumped on this one.
#!/usr/local/bin/perl -w
BEGIN { $cache[1] = [ qw(A C T U) ]; }
sub permute4 {
my $count = shift;
return @{$cache[$count]} if $count <= $#cache;
$cache[$count] = [ map { ("A$_","C$_","T$_","U$_") } permute4($count-1) ];
@{$cache[$count]};
}
foreach $n (3, 1, 2) { # Do in random order just for fun
print "Permuations of length $n: ",join(' ',permute4($n)),"\n";
}
############
Permuations of length 3: AAA CAA TAA UAA ACA CCA TCA UCA ATA CTA TTA UTA
AUA CUA TUA UUA AAC CAC TAC UAC ACC CCC TCC UCC ATC CTC TTC UTC AUC CUC
TUC UUC AAT CAT TAT UAT ACT CCT TCT UCT ATT CTT TTT UTT AUT CUT TUT UUT
AAU CAU TAU UAU ACU CCU TCU UCU ATU CTU TTU UTU AUU CUU TUU UUU
Permuations of length 1: A C T U
Permuations of length 2: AA CA TA UA AC CC TC UC AT CT TT UT AU CU TU UU
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 12 Aug 2000 01:39:57 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: How to replace the newline in perl?
Message-Id: <8n29td$1bs0$1@nntp1.ba.best.com>
In article <8n1ied$1f7$1@nnrp1.deja.com>,
<coughlan@gothaminteractive.com> wrote:
>Hi, I'm trying to parse an excel spreadsheet, but I'm having trouble
>because the data contains newlines. That makes it more complex that it
>seems.
>
>I thought to replace the windows newline char \n\r with a token,
>process the data line by line, and then swap the \n\r back in when I'm
>done.
The CSV files I've looked at have two types of \n in them:
1) For lines that are longer than 80 characters and have quoted strings,
some instances of " " are stored as "\n" (no \r).
2) The end of the row is indicated by "\r\n".
I have used this code to pre-process CSV files:
local $/ = "\r\n" if $msdos; # So that \n by itself is not end of line
while($_ = <IN>) {
s/-\n/-/g; # Convert soft hyphen to hard hyphen
s/\n/ /g if $msdos; # Convert lone LF into a blank
s/\r /\n/ if $msdos; # Convert what used to be CRLF to LF
$count++ if /\n/; # Count full lines, not partials
...
}
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Fri, 11 Aug 2000 22:02:15 -0400
From: Chris Barnabo <chris@spagnet.com>
Subject: Re: How to replace the newline in perl?
Message-Id: <MPG.13fe7a30f8252ee89896a2@news.supernews.com>
On Fri, 11 Aug 2000 18:59:29 GMT, coughlan@gothaminteractive.com
<coughlan@gothaminteractive.com> said ...
> Hi, I'm trying to parse an excel spreadsheet
<snip!>
You might try looking at the Spreadsheet::WriteExcel module on CPAN. The
README specifically states that the module itself won't read Excel files
but indicates that the main documentation has some suggestions on the
matter. Might point out other potential trip points besides the newlines!
-- Chris
________*________ Chris Barnabo, chris@spagnet.com
____________ \_______________/ www.spagnet.com
\__________/ / /
__\ \_______/ /__ "The heck with the Prime Directive,
\_______________/(- let's destroy something!"
------------------------------
Date: Fri, 11 Aug 2000 18:14:34 -0700
From: "Baris" <sumengen@hotelspectra.com>
Subject: Re: IO::Socket problem
Message-Id: <3994a49f$1_4@goliath2.newsfeeds.com>
Thanks for the reply.
Sorry about my mistake. I don't want to access the urls, but the domain
name. In this case the domain name is "www.yahoo.com", which I specify when
creating the socket. But there is no way to access this info in a later
point of the program.
Basically I am creating several sockets and I am looping through all the
sockets in another part of my program. I want to be able to understand which
socket is associated with which domain name.
Hope this is more clear.
Thanks,
Baris.
"Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com> wrote in message
news:8n0r3h$67i6@intranews.dresdnerbank.de...
> Hi,
>
> Baris schrieb in Nachricht <3993d832$1_3@goliath2.newsfeeds.com>...
> >I am creating a socket connection using IO::Socket
> >
> > $socket = IO::Socket::INET->new(PeerAddr => "www.yahoo.com",
> > PeerPort => 80,
> > Proto => "tcp",
> > Type => SOCK_STREAM,
> > )
> >
> >Now I want to access the url information at another place of my program.
>
> until now you have not requested any URL. I have not seen any
> HTTP request asking for a document from www.yahoo.com in
> the above code.
>
> >Following the documentation, I only was able to access the remote ip
> address
> >using:
> >$socket->peerhost
> >method. But ip addresses are not unique identifiers for a web site... Is
it
> >possible to access the web url somehow?
>
> So you do not have an IO::Socket problem as stated in the title
> of your posting but you seem to need some kind of unique
> identifiers. Maybe we can help you if you can give us some
> further details.
>
> Peter Dintelmann
>
>
>
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
------------------------------
Date: Sat, 12 Aug 2000 02:04:01 GMT
From: "Joe C. Hecht" <joehecht@code4sale.com>
Subject: Re: Negativity in Newsgroup
Message-Id: <lg2l5.564$O16.225822@paloalto-snr1.gtei.net>
"DM" shaped the electorns to say:
>Why are there so many negative remarks in this newsgroup?
>[yada yada]
[out of lurk mode]
There are a few sides to the issue.
1) This is a faily high volume newsgroup, where a lot of
the same questions get asked over and over again, and
the information is commonly available in the various
online resources. Note that it *is* best to check the faqs
before asking a question :)
2) Asking a question tends to irritate the folks that think that
this is a discussion group. Note that this is not a discussion
group (or it would be named comp.lang.perl.discussion),
it is, in fact, a peer supported help desk :o)
3) Asking a question often results in an obscure answer,
indended to demonstrate the superiority of the answerer,
and leave the askee in total confusion. The positive part
of this is that the other superiors will immediatly start
trying to top one another, and while they are distracted,
someone might actually sneek in a question and it might
actually get answered.
4) Asking a question often results in a rude response.
This is probably due to the fact that if this is done
frenquently enough, it will scare off the new folks
trying to learn perl, and the old dinosaurs will
control the group. The result of this intimidation
tactic is fewer gurus, thus better job security
for the intimidator.
I will readly admit that the average treatment of
new folks entering this group really bothers me.
As far as the average comp newsgroup,
comp.lang.perl.misc is probably one of the
most unfriendly groups that I have seen, and
I have seen a lot of them over the years.
I highly discourage the new perl user from
posting here, and often question the worth
of the group for anything but discussion
of obscure pearlisms. Simply put, if your
not a very fast reader, you are probably
waisting your time trying to mine this
group for anything but insults.
In my own way, I think its very sad, as
the more people there are learing perl,
the more in demand the language will
be. Scaring off the newbies serves no
usefull purpose.
Now, before I get flamed off the side
of the earth for my opinions, please
note what I said in issue #1. Read the
FAQ Luke, then, if you still have a
question, your probably better off to
go ask it somewhere else.
[back to lurk mode, and putting on the flame retardent suit]
Joe
--
Joe Hecht Associates
http://www.code4sale.com/joehecht/index.htm
------------------------------
Date: 11 Aug 2000 20:36:37 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Negativity in Newsgroup
Message-Id: <m1em3vcfqy.fsf@halfdome.holdit.com>
>>>>> "Joe" == Joe C Hecht <joehecht@code4sale.com> writes:
Joe> 2) Asking a question tends to irritate the folks that think that
Joe> this is a discussion group. Note that this is not a discussion
Joe> group (or it would be named comp.lang.perl.discussion),
Joe> it is, in fact, a peer supported help desk :o)
There is no basis in fact to anything in this paragraph.
Given how far off an early paragraph was, I didn't the rest in great
detail. I'd suggest you re-read the charter for this group, and take
a look at as much archived history for this group as you can.
comp.lang.perl.misc is a community. It's a potluck. Some take, some
give, most do both. If you go to a potluck with an empty plate, and
don't stand in line, but cut right to the front, then take seconds and
thirds while others are still waiting to get firsts, you are viewed as
rude, and not likely to be accepted as well, especially by those who
bring more to the potluck than they eat.
But if you're conservative in what you eat, making sure to share, and
everyone gets fed, you are welcome, and invited back.
Some people want comp.lang.perl.misc to be a soup kitchen. It's not.
Those are the people that call this group a "help desk". Wrong.
Bzzt. Stop disrespecting the community.
"reading the FAQs" is one of the many things you must do to appear to
"stand in line". Another is "posting in the right group". Sure, you
can skip over both, but it's the same as cutting in line. There's no
law. Only custom. And a "for a good reason" custom, at that.
So don't cut in line. Don't hog the food. And you'll get all the
meal you want, now, and next time. This ain't no soup kitchen.
Welcome to the feast.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 11 Aug 2000 20:42:42 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Negativity in Newsgroup
Message-Id: <3994C7B2.E2B04CC2@stomp.stomp.tokyo>
"Joe C. Hecht" wrote:
> "DM" shaped the electorns to say:
> >Why are there so many negative remarks in this newsgroup?
> >[yada yada]
(snipped some pertinent thoughts here and there)
> I will readly admit that the average treatment of
> new folks entering this group really bothers me.
> As far as the average comp newsgroup,
> comp.lang.perl.misc is probably one of the
> most unfriendly groups that I have seen, and
> I have seen a lot of them over the years.
> I highly discourage the new perl user from
> posting here, and often question the worth
> of the group for anything but discussion
> of obscure pearlisms. Simply put, if your
> not a very fast reader, you are probably
> waisting your time trying to mine this
> group for anything but insults.
I find it rather odd, not a person in this
thread has even mentioned the personal insults,
vulgarities, bigotry, sexism, racism, threats
of physical violence, threats of crime, email
bombing, attempted break-ins at my sites and
actual crimes committed against our family,
such as threatening email, forgery, harassment
and the such, to a point where we needed to make
not only contact with internet service providers
but law enforcement contact as well, as noted
in archived articles. All of these repugnant
activities being committed mostly by prominent
well known regulars here. These events have
been taking place, hmm.. six to eight months
now? At least six months. I would have to
pull my documentation to pin a time frame.
So what is the deal you people are not realistic
enough and brave enough to comment upon what
regulars here are truly like; sociopaths if
not outright criminals. Sure reads like a
coverup to me. If you are intent on discussing
issues like these, why cannot you be candid
and truthful? Afraid of reality are you?
Easy to speak as a victim. Very difficult to
speak up when you are a perpetrator, yes?
This is not a reflection upon you Mr. Hecht.
I am simply using your article to add some
of my own thoughts. This has nothing to do
with you personally. Don't be offended.
Only note I would add to your comments, Mr. Hecht,
is newbies here best be prepared to be subjected
to the worst, ranging from vile hatred to crime.
Godzilla!
------------------------------
Date: 12 Aug 2000 03:52:29 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Negativity in Newsgroup
Message-Id: <8n2hlt$bd6$1@slb7.atl.mindspring.net>
Joe C. Hecht (joehecht@code4sale.com) wrote:
: 3) Asking a question often results in an obscure answer,
: indended to demonstrate the superiority of the answerer,
: and leave the askee in total confusion. The positive part
: of this is that the other superiors will immediatly start
: trying to top one another, and while they are distracted,
: someone might actually sneek in a question and it might
: actually get answered.
IME, this only happens when someone asks a question whose answer is
*absurdly* obvious ("Does PERL have a function for finding the length of a
string?") and which indicates either that the poster is asking for advice
on running technique before he's finished learning to crawl (and in that
case, many regulars will politely inform the poster of that fact rather
than responding sarcastically) or refuses to be bothered with doing even a
minimum of personal research (thinking about likely names for such a
function and seeing if they show up in a list of Perl functions). I've
never seen this happen when someone asks a "newbie" question that just
indicates that he's unfamiliar with the right terminology ("How do I
delete a file?" almost always gets a simple pointer to unlink()).
------------------------------
Date: 12 Aug 2000 01:51:22 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Perl calls shell
Message-Id: <8n2aiq$1f1m$1@nntp1.ba.best.com>
In article <8n0qdb$dqo$1@nnrp1.deja.com>, <subnet32@yahoo.com> wrote:
>Hello Gurus:
>
>On a Linux 2.2x box running Perl5.005, I need to have a perl script call
>a Bourne shell.
>
>Shouldn't
> {print `/home/scripts/shell`;}
>in my perl script do the trick and execute the shell ?
$shell = $ENV{SHELL} || "/bin/sh";
$|++; # Make sure output buffer gets flushed
print "Starting $shell - enter 'exit' to return to $0\n";
system $shell;
print "Now back in $0\n";
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 12 Aug 2000 02:42:53 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: perl script
Message-Id: <8n2djd$1pdi$1@nntp1.ba.best.com>
In article <8n26th$geq$1@nnrp1.deja.com>, <ujwal@my-deja.com> wrote:
>Without a script one can 'grep' or 'egrep' as follows
>>grep -i "insulin" test.txt > result.txt (to handle a single string)
>>egrep -i "adp-ribosylation|complement|coagulation|necrosis|insulin"
$search = "adp-ribosylation|complement|coagulation|necrosis|insulin";
open(IN,"test.txt") or die "open(test.txt): $!\n";
@matches = grep /$search/,<IN>;
print "Found ",scalar(@matches)," matches.\n",@matches;
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 12 Aug 2000 02:28:57 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Pipe on WinNT
Message-Id: <8n2cp9$1mpe$1@nntp1.ba.best.com>
In article <399429A5.3811238A@lucent.com>,
Peter Gunreben <pgunreben@lucent.com> wrote:
>I've detected a really funny thing:
>After the open command, the error message ($!) is
>set to "No such file or directory" but the return
>code of the open is nonzero.
That's not strange. If the system() call indicates success (nonzero),
then the value of $! is meaningless and should not be looked at. $!
should only be checked when a call to the OS has failed. The call
to system() is special; it sets $? on failure (on Unix systems).
>... seems to be an implementation problem ...
I see no problem here. Check the return code first, check $! only if
the return code indicates failure.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 12 Aug 2000 01:47:02 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Problem redirecting error messages to a file : v5.6.0
Message-Id: <8n2aam$1dog$1@nntp1.ba.best.com>
In article <8n0su8$8mo$1@news.netmar.com>,
Mahesh Asolkar <maheshasolkar@engineer.com> wrote:
>Hi,
>
>I have a couple of small perl scripts which involve redirecting error messages
>to a file...
>
>One is exec.pl ...
>
>#!/usr/local/bin/perl -w
>
>my $CmdStr1 = "my.pl > lst1";
>my $CmdStr2 = "my.pl >& lst2";
^^
Illegal syntax: ------^^
Q: How does one redirect both STDOUT and STDERR to the same file?
A: Depends on whether you are using a shell based on 'sh' or on 'csh'.
The line above suitable for someone with csh or tcsh as a login shell.
It is NOT suitable for /bin/sh, which perl uses.
my $CmdStr2 = "my.pl >lst2 2>&1";
See the man page for 'sh' for more info.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Fri, 11 Aug 2000 18:20:59 -0700
From: "Baris" <sumengen@hotelspectra.com>
Subject: ps on NT
Message-Id: <3994a621_4@goliath2.newsfeeds.com>
Hello,
Inside my perl program I want to be able to get the current process list on
winNT . On unix I am doing:
@list = `ps -e`;
(which probably is not the best way to do it. I am open to suggestions).
On windows I want to access the same list, but probably with a native perl
function since it looks like there is no system command similar to ps. I
looked at Win32::xxx modules at Activestate, but I am not sure if any of
them is doing this.
Any ideas?
Thanks,
Baris.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
------------------------------
Date: 12 Aug 2000 01:58:58 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: s/// and symbolic references
Message-Id: <8n2b12$1h50$1@nntp1.ba.best.com>
In article <8n17sg$a98$1@newsg3.svr.pol.co.uk>,
Daniel Foster <daniel@blackomega.com> wrote:
>> reason, although $$s in a double-quoted string is interpreted as
>> ${$s}, $$2 is interpreted as ${$}2.
>
>Mad. I decided to go the way of the FAQ and do it all with a hash. I
>now have the regex
>s/\$(\w+)/$$dataref{$1}/g;
>so why doesn't the $$ in that get interpreted as the process number?
As mentioned above, $$dataref is treated as ${$dataref}, due to the
alphabetical character immediately following the double dollar sign.
>
>> If you'd been using strict and -w (as frequently recommended on
>> this group), they would have given you a clue about what was
>> going on.
>
>Fair point, and to be honest I thought they were already being used.
>Mea culpa. This brings up an interesting point though. The code I
>wrote is residing in a package, so there's no shebang line to put
>the -w on. Does it inherit it from the script 'use'ing the package?
You can enable and disable warnings at will via two methods.
use warnings; # Enable warnings until end of block (or file)
no warning; # Undoes the above
$^W = 1; # This is what the -w switch does
{ local $^W = 0; code_which_produces_unwanted_warnings; }
# Disable warnings for a block of code
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 12 Aug 2000 02:47:49 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: setting cookie twice in same script
Message-Id: <8n2dsl$1q3b$1@nntp1.ba.best.com>
In article <8n26a9$g27$1@nnrp1.deja.com>,
Chovy <johndoyle33@hotmail.com> wrote:
>Prior to the loop iteration I print "Content-Type: text/html".
>
>However, I cannot set a cookie in the same script because the CGI.pm
>cookie method uses the header() method which again prints
>"Content-Type"...
>
>So when I actually do try to set the cookie at the end of the script, it
>just prints to the browser "Set-cookie: ....etc..."
>instead of actually setting the cookie.
>
>Is there a way around this?
1) Don't print "Content-type".
2) In the loop, push the results onto an array (or append to a string)
instead of printing in the middle of the loop.
3) Calculate the new cookie value.
4) Let CGI.pm send the header and cookie.
5) Print the results that were saved in step 2.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sat, 12 Aug 2000 10:12:34 +0800
From: Scoot <scoot99@hotmail.com>
Subject: User-defined hash...
Message-Id: <3994B292.53420020@hotmail.com>
I want to set an user-defined hash in the client side, this hash should
be used by other scripts for reference, and it will be stored until the
browser in the client side is closed.
I don't want to use cookies.
Is there any way to implement this in Perl? Please give me an example of
it, thanks a lot!
Scoot.S
------------------------------
Date: 12 Aug 2000 02:36:06 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Were are all the executibles?
Message-Id: <8n2d6m$1o7f$1@nntp1.ba.best.com>
In article <8n0lpj$apk$1@nnrp1.deja.com>, <john_s_brown@my-deja.com> wrote:
>Why is Perl a scripting language? Why one can't make executibles (this
>is, *.exe files)? Wouldn't compiling be much more intelligent than
>interpreting? That way anybody could drive a perl program without
>having perl interpreter!
If the perl program uses eval() or s///e then it HAS to have the
perl interpreter available at run time in order to work.
The FAQ ("perldoc -q compile") mentions that the size of the compiled
binary is about the same size as the interpreter.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 12 Aug 2000 01:29:11 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: where can find the document about how to install perl
Message-Id: <8n2997$192l$1@nntp1.ba.best.com>
In article <8n24nd$jun$1@bcrkh13.ca.nortel.com>,
Jerry Lei <jlei@nortelnetworks.com> wrote:
>Hi,
>
>I try to make and install perl on the Solaris2.6 (SUN).
>But I have some problem with configuration settings.
>Where can I find the document which talk about how to do the settings.
Some settings require that you recompile perl when you change them.
If you currently have a binary-only release, you may need to:
1) Download gcc-2.95.2 from http://www.sunfreeware.com
2) Download perl-5.6.0 sources from
http://www.perl.com/pub/language/info/software.html#stable
3) "more perl-5.6.0/INSTALL"
If there are just a few particular settings you're concerned about,
post your questions here.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3994
**************************************