[24349] in Perl-Users-Digest
Perl-Users Digest, Issue: 6538 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 7 18:06:00 2004
Date: Fri, 7 May 2004 15:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 7 May 2004 Volume: 10 Number: 6538
Today's topics:
a simple RegExp question <sly5@pitt.edu>
Re: a simple RegExp question <remorse@partners.org>
Re: a simple RegExp question <noreply@gunnar.cc>
Re: a simple RegExp question <noreply@gunnar.cc>
Re: Books online???? <jgibson@mail.arc.nasa.gov>
Re: Books online???? <bxb7668@somewhere.nocom>
Re: Books online???? (taswold)
Re: Books online???? <cwilbur@mithril.chromatico.net>
Re: Concurrent processes (waiting for children) <jgibson@mail.arc.nasa.gov>
Re: free source authentication script (Kevin Collins)
Re: Open cdrom device on windows (Kevin Collins)
Re: pb PERL script with Apache server (Nicolas D)
Perl DBI and DB2 Stored Procedure (Wonderinguy)
Re: Perl DBI and DB2 Stored Procedure (Kevin Collins)
Re: Perl script runs from command prompt but not from T <brian_helterline@hp.com>
Raw body parts in MIME:Parser <admin@asarian-host.net>
Re: regex utility <matternc@comcast.net>
Set Permanent ENV variables on Windows (Prabh)
Re: Set Permanent ENV variables on Windows <1usa@llenroc.ude>
Re: Set Permanent ENV variables on Windows <makbo@pacbell.net>
Re: Set Permanent ENV variables on Windows (Kevin Collins)
Re: Sort Hash o Hash accordint to two keys <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 07 May 2004 16:37:36 -0400
From: "S. Levent Yilmaz" <sly5@pitt.edu>
Subject: a simple RegExp question
Message-Id: <c7gs2a$n9e$1@usenet01.srv.cis.pitt.edu>
Hello,
It sounded like a very simple problem but I couldn't come up with an
elegant solution. The problem is:
Find all lines which contain a given word (say 'kitty') not preceded
with another given word (say 'puppy') . For instance:
I have two pets:
my kitty is very cute
but puppy is cuter than kitty
What regular expression stands only for the 2nd line? Note that the
other way around is very easy, that is the lines with 'puppy' followed
by 'kitty' is only "puppy.*kitty"
Is this possible at all with a single RegExp?
thank you so very much!
-Levent.
------------------------------
Date: Fri, 07 May 2004 16:58:12 -0400
From: Richard Morse <remorse@partners.org>
Subject: Re: a simple RegExp question
Message-Id: <remorse-E9E4D3.16581107052004@plato.harvard.edu>
In article <c7gs2a$n9e$1@usenet01.srv.cis.pitt.edu>,
"S. Levent Yilmaz" <sly5@pitt.edu> wrote:
> Hello,
>
> It sounded like a very simple problem but I couldn't come up with an
> elegant solution. The problem is:
>
> Find all lines which contain a given word (say 'kitty') not preceded
> with another given word (say 'puppy') . For instance:
>
> I have two pets:
> my kitty is very cute
> but puppy is cuter than kitty
>
> What regular expression stands only for the 2nd line? Note that the
> other way around is very easy, that is the lines with 'puppy' followed
> by 'kitty' is only "puppy.*kitty"
> Is this possible at all with a single RegExp?
>
> thank you so very much!
> -Levent.
You're looking for negative look-behind assertion. (I think).
perldoc perlre
look for "look-behind".
Short form:
my $line =~ m/(?<!puppy).*kitty/;
HTH,
Ricky
--
Pukku
------------------------------
Date: Fri, 07 May 2004 22:55:05 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: a simple RegExp question
Message-Id: <2g2bo7F3rb9iU1@uni-berlin.de>
S. Levent Yilmaz wrote:
> Find all lines which contain a given word (say 'kitty') not
> preceded with another given word (say 'puppy') . For instance:
>
> I have two pets:
> my kitty is very cute
> but puppy is cuter than kitty
>
> What regular expression stands only for the 2nd line? Note that the
> other way around is very easy, that is the lines with 'puppy'
> followed by 'kitty' is only "puppy.*kitty"
> Is this possible at all with a single RegExp?
Don't know, but why not just do:
/\bkitty\b/ and !/\bpuppy\b.*\bkitty\b/
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 07 May 2004 22:59:37 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: a simple RegExp question
Message-Id: <2g2c0oF3pq7uU1@uni-berlin.de>
Richard Morse wrote:
> You're looking for negative look-behind assertion. (I think).
Think? How about testing the code before posting?
> Short form:
>
> my $line =~ m/(?<!puppy).*kitty/;
That matches any line containing "kitty".
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 07 May 2004 12:15:29 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Books online????
Message-Id: <070520041215298584%jgibson@mail.arc.nasa.gov>
In article <288fb229.0405070132.7727c73f@posting.google.com>, taswold
<hen_mcgiggle@yahoo.co.uk> wrote:
> Charlton Wilbur <cwilbur@mithril.chromatico.net> wrote in message
> news:<87oep1fjfa.fsf@mithril.chromatico.net>...
> > >>>>> "t" == taswold <hen_mcgiggle@yahoo.co.uk> writes:
> >
> > t> "RTFM" IS rude and unhelpful, how in God's name can you
> > t> seriously pretend otherwise?
> >
> > A flat "RTFM" is usually rude and unhelpful. However, "RTFM -
> > particularly perldoc -q 'my own module'" -- especially when the answer
> > to the question is found in the FAQ, and it's clear that the querent
> > hasn't read it -- is quite helpful. What could *possibly* be gained
> > by the respondent writing yet another response to the question instead
> > of providing a pointer to the peer-reviewed answer in the FAQ or other
> > documentation?
>
> Seems sensible. I just wish we could take the "F" out. The pedantic,
> sarcastic manner is a waste of time too, and that's absolutely rife on
> c.l.p.misc.
>
> tas
Why would you want to remove the word "Fine" from the phrase "Read The
Fine Manual (RTFM)"?
------------------------------
Date: Fri, 7 May 2004 19:50:34 GMT
From: "bxb7668" <bxb7668@somewhere.nocom>
Subject: Re: Books online????
Message-Id: <HxD0GA.9oM@news.boeing.com>
"Jim Gibson" <jgibson@mail.arc.nasa.gov> wrote in message
news:070520041215298584%jgibson@mail.arc.nasa.gov...
> Charlton Wilbur <cwilbur@mithril.chromatico.net> wrote in message
> news:<87oep1fjfa.fsf@mithril.chromatico.net>...
> > Seems sensible. I just wish we could take the "F" out. The
pedantic,
> > sarcastic manner is a waste of time too, and that's absolutely
rife on
> > c.l.p.misc.
> >
> > tas
>
> Why would you want to remove the word "Fine" from the phrase "Read
The
> Fine Manual (RTFM)"?
You forgot the smiley ;-) since the original and commonly accepted
meaning was a bit cruder than "Fine". I agree with Charlton. I would
also like the acro to be RTM. Much nicer.
------------------------------
Date: 7 May 2004 13:53:23 -0700
From: hen_mcgiggle@yahoo.co.uk (taswold)
Subject: Re: Books online????
Message-Id: <288fb229.0405071253.5e02d3ed@posting.google.com>
[file under depressing predictions come true]
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<c7fk18$pag$1@mamenchi.zrz.TU-Berlin.DE>...
> taswold <hen_mcgiggle@yahoo.co.uk> wrote in comp.lang.perl.misc:
> > anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:
> >
> > > When a posting annoys me, I reserve the right to reply in kind. Why
> > > should the wishes of the poster take precedence?
> >
> > That depends on how easily annoyed you are, and how justified your
> > annoyance.
>
> You're not making sense. We are talking about general rules of
> conduct. They can't depend on the individual, far less on the
> individual case.
We are, however, not talking about Kant's categorical imperative. If
you get annoyed at everything, and keep displaying it, you start to
annoy other people, and mess up the general 'feel' of the group.
Therefore your behaviour will be frowned upon. In other circumstances
anger might be seen to be appropriate.
There you are: different rules in different cases, QED. I would
venture to suggest that one or two of you are closer to the first case
than the second.
> > People in the real world might expect you to keep your irritation to
> > yourself for the general good.
>
> The general good, eh? Sure, we tend to forget that while we're
> spending hours of spare time answering questions. Thanks for
> the reminder.
Same old injured, self righteous fury. You always use this as a
justification for rude behaviour and it doesn't follow at all.
> > I *almost* sympathise with you about the trolls and the
> > do-my-homeworks. You guys sometimes do some great things on here*.
> > Unfortunately, you're also such a pompous bunch of nitwits.
>
> Thanks. Care to be specific? Or does everyone become a pompous
> nitwit, just by virtue of answering questions here?
Well ... oh never mind!
> > I've read that nonsensical document (can't find the bookmark just now)
>
> Then find it. Vague reminiscences of something you have read somewhere
> are of no interest.
found, as requested (yesyesyes, it's not all nonsensical, I know):
http://www.catb.org/~esr/faqs/smart-questions.html
quote on RTFM:
"You shouldn't be offended by this; by hacker standards, he is showing
you a rough kind of respect simply by not ignoring you. You should
instead thank him for his grandmotherly kindness." (is he being
funny?)
On rudeness:
"Much of what looks like rudeness in hacker circles is not intended to
give offence. Rather, it's the product of the direct,
cut-through-the-bullshit communications style that is natural to
people who are more concerned about solving problems than making
others feel warm and fuzzy."
(oh, fine, social skills not important then?- in a forum that human
beings use?)
On "community standards":
"Odds are you'll screw up a few times on hacker community forums — in
ways detailed in this article, or similar. And you'll be told exactly
how you screwed up, possibly with colourful asides. In public.
When this happens, the worst thing you can do is whine about the
experience, claim to have been verbally assaulted, demand apologies,
scream, hold your breath, threaten lawsuits, complain to people's
employers, leave the toilet seat up, etc. Instead, here's what you do:
Get over it. It's normal. In fact, it's healthy and
appropriate.Community standards do not maintain themselves: They're
maintained by people actively applying them, visibly, in public."
This sounds horribly like 'Rudeness is appropriate. Don't complain'
(whyever not???? if community standards are maintained by people
applying them then surely taking issue with rudeness is doing exactly
that. I believe you'll find the lines somewhat blurry)
All bad justificaions for bad behaviour. Why do I post? because I can
either shut up and allow a culture to get more egotistical, or I can
try and alter it to make it less egotistical.
sorry about the length of this post. Won't happen again, ever.
tas
------------------------------
Date: Fri, 07 May 2004 20:59:16 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Books online????
Message-Id: <87smecdl0s.fsf@mithril.chromatico.net>
>>>>> "t" == taswold <hen_mcgiggle@yahoo.co.uk> writes:
t> Seems sensible. I just wish we could take the "F" out. The
t> pedantic, sarcastic manner is a waste of time too, and that's
t> absolutely rife on c.l.p.misc.
You know, if we're wasting so much of your time, you *could* find
other things to do with it.
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: Fri, 07 May 2004 12:37:36 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Concurrent processes (waiting for children)
Message-Id: <070520041237368197%jgibson@mail.arc.nasa.gov>
In article <6b0229d280ef62c66b56e7764e252aaf@news.teranews.com>, Jacob
Heider <lord-jacob@comcast.net> wrote:
> I've been following clpm for some months now, so hopefully I'll be able
> to do this in a way that doesn't offend anyone.
Where did you get the idea anyone would take offense? We are all just
one big, happy family here on c.l.p.m!
>
> I'm trying to write a console-based replacement for Grip, a
> CD-ripper/-encoder under linux. In theory, I should be able to encode
> the wav files while ripping subsequent once, since the actual CD-ripping
> is IO-bound. The obvious way (to me, at least) is to fork a child to do
> the encoding, and tell subsequent children not to start working until
> prior children finish. (I think) I know why this doesn't work, i.e. the
> first child isn't a child of the second child, etc., so waitpid won't
> work. I know there got to be a better way, and probably at least a
> half-dozen ways which could work. Please help.
>
> The code (excerpt) which doesn't work is (some lines split to get under
> 72-characters):
>
>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> my $lastpid;
>
> for (my $i = 1; $i <= 5; $i++) {
>
> system("cdda2wav -D /dev/cdrom -I cooked_ioctl -P 0 -t $i"
> "-O wav -H -g $i.wav") == 0
> or die "cdda2wav failed: $?\n";
The second time around this loop you need to wait here in the parent
for the first child to complete. So move your waitpid call here, but do
check for errors (untested):
if( $lastpid ) {
if( waitpid($lastpid,0) == -1 ){
warn("Can't call waitpid($lastpid): $?");
}
}
See perldoc perlipc for more info.
>
> my $childpid = fork;
> die "fork failed: $?\n" unless defined($childpid);
>
> if ($childpid == 0) {
>
As you correctly surmise, the following will not work because the child
to-be-waited-on is not a child of the waiting process:
> if ($lastpid) {
> waitpid($lastpid, 0);
> }
>
> system("lame -V 3 $i.wav $i.mp3") == 0
> or die "lame failed: $?\n";
> system("oggenc -q 3 -o $i.ogg $i.wav") == 0
> or die "oggenc failed: $?\n";
> system("flac -6 -o $i.flac $i.wav") == 0
> or die "flac failed: $?\n";
>
> system("rm $i.wav");
>
> exit;
>
> }
>
> $lastpid = $childpid;
> }
>
> __END__
------------------------------
Date: Fri, 07 May 2004 20:27:59 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: free source authentication script
Message-Id: <slrnc9nsaa.99i.spamtotrash@doom.unix-guy.com>
In article <c7e9l0$72c$1@reader2.nmix.net>, Robin wrote:
-snip-
>
> I might be an idiot, but not a stupid one.
> -Robin
That is one of the funniest things I have seen in a long time :)
------------------------------
Date: Fri, 07 May 2004 19:36:21 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: Open cdrom device on windows
Message-Id: <slrnc9np9g.99i.spamtotrash@doom.unix-guy.com>
In article <97b3e53c.0405070039.50ae7588@posting.google.com>, manux wrote:
> Hi,
>
> someone knows if there is a way to open the cdrom device on windows
> with perl?
> I found just about opening Serial ports (open P,"+>COM1") but nothing
> about cdrom.
> I tried to open /Devices/CdRom0, \\.\CdRom0 but it doesn't work.
>
> Thanks
>
> manux
>
> P.S. what I'd like to do is to burn an iso image on a cd-r and verify
> md5sum (on linux I would open /dev/cdrom)
Assming your CD-ROM's drive letter is E:, you would use:
open(CDR, "E:/") || die "can't open E: drive: $!";
Of course, this is to open the PATH at the root of the CD-ROM, not the actual
device...
Kevin
------------------------------
Date: 7 May 2004 12:16:16 -0700
From: nico99@netcourrier.com (Nicolas D)
Subject: Re: pb PERL script with Apache server
Message-Id: <7fe6c964.0405071116.3cbbe251@posting.google.com>
"gnari" <gnari@simnet.is> wrote in message news:<c7e8nm$dh8$1@news.simnet.is>...
> "Nicolas D" <nico99@netcourrier.com> wrote in message
> news:7fe6c964.0405061250.1ce532f7@posting.google.com...
> > Hello,
> >
> > My perl program doesn't work.
> > In my error.log i have:
> > [error] 27979: ModPerl::Registry: Can't locate CGI_Lite.pm in @INC
> > (@INC... contains: /var/www/perl
> >
>
> > so, where is the problem ?
>
> and where is CGI_Lite.pm ?
>
> gnari
ok i m stupid,
thanks
------------------------------
Date: 7 May 2004 12:18:25 -0700
From: wonderinguy@hotmail.com (Wonderinguy)
Subject: Perl DBI and DB2 Stored Procedure
Message-Id: <6950e82.0405071118.794a3981@posting.google.com>
Hi everybody , I have been trying to execute a simple DB2 stored
Procedure from perl. But it doesn't work. Could anybody please help me
find out why this is happening :
here is my perl script that execute the SP :
<snip>
my $dbh = DBI->connect( "dbi:DB2:$database","user1","passwd1") || die
"cannot connect to db2";
my $callstmt = "CALL SPACESP('DB','TEXAS')";
my $sth = $dbh->prepare($callstmt) || die "can't do
prepare",$dbh->errstr(),"\n";
$sth->execute || die "Can't do executed:" , $dbh->errstr(),"\n";
<snip>
When I execute this I get this on the apache error.log :
Premature end of script headers: get_dbspace.cgi, referer:
http://localhost/space.html
[Fri May 07 15:14:56 2004] [error] [client 127.0.0.1] Use of
uninitialized value in warn at C:/Program Files/Apache
Group/Apache2/cgi-bin/space/get_dbspace.cgi line 8., referer:
http://localhost/space.html
[Fri May 07 15:14:56 2004] [error] [client 127.0.0.1] Warning:
something's wrong at C:/Program Files/Apache
Group/Apache2/cgi-bin/space/get_dbspace.cgi line 8., referer:
http://localhost/space.html
[Fri May 07 15:14:56 2004] [error] [client 127.0.0.1] DBD::DB2::st
execute failed: [IBM][CLI Driver][DB2] SQL0440N No function by the
name "SPACESP" having compatible arguments was found in the function
path. SQLSTATE=42884
, referer: http://localhost/space.html
[Fri May 07 15:14:56 2004] [error] [client 127.0.0.1] Can't do
executed:[IBM][CLI Driver][DB2] SQL0440N No function by the name
"SPACESP" having compatible arguments was found in the function path.
SQLSTATE=42884
, referer: http://localhost/space.html
[Fri May 07 15:14:56 2004] [error] [client 127.0.0.1] , referer:
http://localhost/space.html
[Fri May 07 15:14:56 2004] [error] [client 127.0.0.1] Database handle
destroyed without explicit disconnect., referer:
http://localhost/space.html
I have tested the stored procedure manually. I can execute the stored
procedure from a command line or a third party tool.
Any input is greatly appreciated
Thanks
------------------------------
Date: Fri, 07 May 2004 21:14:06 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: Perl DBI and DB2 Stored Procedure
Message-Id: <slrnc9nv0u.99i.spamtotrash@doom.unix-guy.com>
In article <6950e82.0405071118.794a3981@posting.google.com>, Wonderinguy wrote:
> Hi everybody , I have been trying to execute a simple DB2 stored
> Procedure from perl. But it doesn't work. Could anybody please help me
> find out why this is happening :
>
-snip-
>
> I have tested the stored procedure manually. I can execute the stored
> procedure from a command line or a third party tool.
>
> Any input is greatly appreciated
See 'perldoc DBI':
"func"
$h->func(@func_arguments, $func_name);
The "func" method can be used to call private non-standard and
non-portable methods implemented by the driver. Note that the
function name is given as the last argument.
This method is not directly related to calling stored procedures.
Calling stored procedures is currently not defined by the DBI.
Some drivers, such as DBD::Oracle, support it in non-portable
ways. See driver documentation for more details.
Even though you are not attempting to use func(), this tells me that stored
procedures are not necessarily supported. Maybe 'perldoc DBD::DB2' can shed
light for you on whether or not DB2 does in some 'non-portable' way.
Also:
"This is the DBI specification that corresponds to the DBI version 1.21"
Quite possible that my DBI is older than yours...
Kevin
------------------------------
Date: Fri, 7 May 2004 12:54:11 -0700
From: "Brian Helterline" <brian_helterline@hp.com>
Subject: Re: Perl script runs from command prompt but not from Task Scheduler in Win2000
Message-Id: <409bea18$1@usenet01.boi.hp.com>
"Richard Morse" <remorse@partners.org> wrote in message
news:remorse-D63F92.12101007052004@plato.harvard.edu...
> Or put a line like the following at the start of the script:
>
> open(STDERR, ">>", "c:/temp/odd_errors")
> or die("can't change STDERR: $!"); # yes, I see the problem
> open(STDOUT, ">>", "c:/temp/odd_output")
> or die("can't change STDOUT: $!");
or better yet, put it in a BEGIN block to catch compile time info
------------------------------
Date: Fri, 7 May 2004 22:21:15 +0200
From: "Mark" <admin@asarian-host.net>
Subject: Raw body parts in MIME:Parser
Message-Id: <fvOdnc8T_O1ecgbdRVn-gQ@giganews.com>
Hello,
It would really be a great idea if MIME:Parser had a way to parse the
unencoded, raw body of a part. There are several parts in its documentation
which CLAIM to do that. But this is not the case. Every time I encounter
such a method, it appears to simply be a re-encoded, decoded part. Which is
NOT the same as the raw body! And having the raw body is vital, if you want
to replace a part within a string containing the original message. As it
stands now, I have all these neatly decoded parts, but have no way to
replace the old message-bodies with new (reformatted) ones.
Does anyone have any experience with this?
Thanks,
- Mark
------------------------------
Date: Fri, 07 May 2004 15:19:01 -0400
From: Chris Mattern <matternc@comcast.net>
Subject: Re: regex utility
Message-Id: <2LidnbGvFdG4fAbdRVn-tA@comcast.com>
Christian Winter wrote:
> Thomas Kratz schrieb:
>> or simpler:
>>
>> my @matches = $ARGV[1] =~ m($ARGV[0]);
>> my $i = 1;
>> print "match $i++: $_\n" for map {
>> defined($_) ? $_ : 'undef'
>> } @matches;
>> print "no matches\n" unless @matches;
>
> or even:
>
> my $c;
> print "match ",++$c,": $_$/" for($ARGV[1]=~m($ARGV[0])g);
>
Such a lovely day for golf, isn't it?
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: 7 May 2004 13:24:17 -0700
From: Prab_kar@hotmail.com (Prabh)
Subject: Set Permanent ENV variables on Windows
Message-Id: <e7774537.0405071224.69c35870@posting.google.com>
Hello all,
Could anyone tell me how to set a Windows environment permanently?
I need to set the PATH variable from my Perl script and any changes I
make to this variable last only for the duration of my script's
running.
I realize Perl inherits a copy of the system ENV. and any changes made
to it are temporary, but heres my question, the install programs for
various products, Windows Installers, .msis, Setup.exes all make
permanent changes to the PATH variable when the product is installed.
Obviously, the changes made by these installers are permanent.
I just want to replicate this process from Perl.
Could anone give me some pointers, please?
Thanks for your time,
Prab
------------------------------
Date: 7 May 2004 21:02:34 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Set Permanent ENV variables on Windows
Message-Id: <Xns94E2AD5F09C5Easu1cornelledu@132.236.56.8>
Prab_kar@hotmail.com (Prabh) wrote in news:e7774537.0405071224.69c35870
@posting.google.com:
> Hello all,
> Could anyone tell me how to set a Windows environment permanently?
> I need to set the PATH variable from my Perl script and any changes I
> make to this variable last only for the duration of my script's
> running.
>
> I realize Perl inherits a copy of the system ENV. and any changes made
> to it are temporary, but heres my question, the install programs for
> various products, Windows Installers, .msis, Setup.exes all make
> permanent changes to the PATH variable when the product is installed.
> Obviously, the changes made by these installers are permanent.
>
> I just want to replicate this process from Perl.
> Could anone give me some pointers, please?
What version of Windows are we talking about?
In XP, you would modify the registry entry corresponding to the user
path:
HKEY_CURRENT_USER\Environment
You can add or modify the PATH variable under that key. Changes will not
take effect in the current cmd shell.
HTH
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: Fri, 07 May 2004 21:14:56 GMT
From: Mark Bole <makbo@pacbell.net>
Subject: Re: Set Permanent ENV variables on Windows
Message-Id: <k%Smc.62016$s05.52324@newssvr25.news.prodigy.com>
Prabh wrote:
> Hello all,
> Could anyone tell me how to set a Windows environment permanently?
> I need to set the PATH variable from my Perl script and any changes I
> make to this variable last only for the duration of my script's
> running.
>
> I realize Perl inherits a copy of the system ENV. and any changes made
> to it are temporary, but heres my question, the install programs for
> various products, Windows Installers, .msis, Setup.exes all make
> permanent changes to the PATH variable when the product is installed.
> Obviously, the changes made by these installers are permanent.
>
> I just want to replicate this process from Perl.
> Could anone give me some pointers, please?
>
> Thanks for your time,
> Prab
In W2K, right click "My Computer", then click "Properties", "Advanced",
"Environment Variables". You can permanently set variables for both the
current user and the system (if you have admin privileges, I suppose).
--Mark Bole
------------------------------
Date: Fri, 07 May 2004 21:30:13 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: Set Permanent ENV variables on Windows
Message-Id: <slrnc9nvv5.99i.spamtotrash@doom.unix-guy.com>
In article <e7774537.0405071224.69c35870@posting.google.com>, Prabh wrote:
> Hello all,
> Could anyone tell me how to set a Windows environment permanently?
> I need to set the PATH variable from my Perl script and any changes I
> make to this variable last only for the duration of my script's
> running.
>
> I realize Perl inherits a copy of the system ENV. and any changes made
> to it are temporary, but heres my question, the install programs for
> various products, Windows Installers, .msis, Setup.exes all make
> permanent changes to the PATH variable when the product is installed.
> Obviously, the changes made by these installers are permanent.
>
> I just want to replicate this process from Perl.
> Could anone give me some pointers, please?
>
> Thanks for your time,
> Prab
This would probably be better asked in a Windows forum... A quick search in my
WinXP help on 'PATH' came up with help on the PATH command. That help mentions:
"When started from a shortcut, Cmd.exe inherits the environment variables set
in My Computer/Properties/Advanced/Environment."
So, I searched my registry with regedit for "environment" and found the key:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment
Which has a entry called "Path" containing the system's defailt PATH setting.
So, if you want to change it system-wide, this is a good place to do that....
Kevin
------------------------------
Date: Fri, 07 May 2004 18:22:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Sort Hash o Hash accordint to two keys
Message-Id: <x73c6cw10t.fsf@mail.sysarch.com>
>>>>> "MY" == Malik Yousef <yousef@pcbi.upenn.edu> writes:
please stop top posting. look at the difference with how i reply to your
posts. read the regularly posted group guidelines.
MY> Here the code i'm using now:
MY> @pos = sort {
MY> $allresults{$a}{HDR} cmp $allresults{$b}{HDR}
MY> || $allresults{$a}{WinStart} <=>
MY> $allresults{$b}{WinStart}
MY> # $allresults{$a}{WinStart} <=>
^
what is that doing there?
i can't tell what you actually are running because of the odd line
wrap.
MY> $allresults{$b}{WinStart}
MY> } keys %allresults;
MY> But the results that i'm getting are partioally sorted according to
MY> the used commands.
and what is in %allresults? you don't show how you stuff it and that can
be half the work.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6538
***************************************