[22519] in Perl-Users-Digest
Perl-Users Digest, Issue: 4740 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 21 14:11:22 2003
Date: Fri, 21 Mar 2003 11:05:07 -0800 (PST)
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, 21 Mar 2003 Volume: 10 Number: 4740
Today's topics:
Re: Best editor for perl scripts (Nataku)
Re: Best editor for perl scripts <southtownoutkast777@hotmail.com>
CHMOD problems <southtownoutkast777@hotmail.com>
Re: CHMOD problems <nobull@mail.com>
Re: CHMOD problems <southtownoutkast777@hotmail.com>
Re: foreach element in a hasharray <nobull@mail.com>
Free to wrong pool <suresh_rukmangathan@hp.com>
Re: Free to wrong pool <peter@nospam.calweb.com>
Re: getOpenFile with -initialdir <pzerwetz@yaccom.com>
help writing a perl script so that it's faster than sed (Dave)
Re: How to use Net::FTP - FTP Client class <jmcada@hotmail.com>
Re: Need a little help with a short script (Nataku)
Re: new Perl feature request: call into shared libs (Walter Roberson)
Re: new Perl feature request: call into shared libs <nobody@nowhere.non>
Re: print to file safley <usenet@tinita.de>
Re: print to file safley <tassilo.parseval@rwth-aachen.de>
Re: Using an Environment variable in a regexp match (Chris)
Re: with ActivePerl, PPM "search" missing results that (Bennett Haselton)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Mar 2003 09:32:27 -0800
From: Crapnut566@yahoo.com (Nataku)
Subject: Re: Best editor for perl scripts
Message-Id: <7e48fc99.0303210932.62ef67c0@posting.google.com>
Do a google for "Open Perl", its a free IDE found on sourceforge. It
lets you set breakpoints, watch variables, step through functions etc
etc ... for the price, you cant beat it, although I still prefer emacs
for doing the programming. The IDE is for debug.
If you are looking for a great perl IDE, you cant beat ActiveState's
Perl .NET plugin. Granted since you are running a mac , im guessing
your ability to get access to .NET is limited ....
Stephan Bour <sbour@niaid.nih.gov> wrote in message news:<BAA094C7.6554%sbour@niaid.nih.gov>...
> Hi,
> My script is getting large enough that I'd like a little help to keep track
> of bracket pairs and syntax errors and to have more flexibility in
> indentation and alignment of code. I'm using BBEdit right now but it's more
> of an HTML editor. Any suggestion for a good Perl editor for Macintosh OS X?
>
> Thank you,
>
> Stephan.
------------------------------
Date: Fri, 21 Mar 2003 18:17:45 GMT
From: "David S." <southtownoutkast777@hotmail.com>
Subject: Re: Best editor for perl scripts
Message-Id: <dHIea.50143$fa.2901149@twister.austin.rr.com>
I use Crimson Editor. It's a free IDE, but it is designed for several
different languages. Even though it has no compiler, so for most languages
I don't see the point, but for perl and html it works fine
"Stephan Bour" <sbour@niaid.nih.gov> wrote in message
news:BAA094C7.6554%sbour@niaid.nih.gov...
> Hi,
> My script is getting large enough that I'd like a little help to keep
track
> of bracket pairs and syntax errors and to have more flexibility in
> indentation and alignment of code. I'm using BBEdit right now but it's
more
> of an HTML editor. Any suggestion for a good Perl editor for Macintosh OS
X?
>
> Thank you,
>
> Stephan.
>
------------------------------
Date: Fri, 21 Mar 2003 18:14:10 GMT
From: "David S." <southtownoutkast777@hotmail.com>
Subject: CHMOD problems
Message-Id: <SDIea.50126$fa.2900414@twister.austin.rr.com>
I'm writing a program that needs to chmod an array of cgi scripts. Yet
everytime i run
@files = ("/path/to/script.cgi",
"/path/to/anotherscript.cgi",
"/path/to/athirdscript.cgi",
"/path/to/arentyoutiredofthesegenericscriptnames.cgi");
for ($k=0; $k<@files; $k++) {
chmod 0755, $files[$k];
}
it does nothing....
So i tried using the unix chmod command through perl
$_="chmod 0755 @files";
s/(.)*=//; s/\+/ /g; s/%(..)/pack("c",hex($1))/ge;
$results=`$_ 2>&1`;
####and then print the results
print $results;
but all i got was,
WARNING: Can not change permissions for script.cgi
WARNING: Can not change permissions for anotherscript.cgi
WARNING: Can not change permissions for athirdscript.cgi
WARNING: Can not change permissions for
arentyoutiredofthesegenericscriptnames.cgi
I've checked the permissions of all of the parent folders, they're all
fine....
Yet, if i manually change the permissions for files (outside of the perl
environment), i have no problem.....
Any solutions?
David Stinemetze
http://www.cs.utsa.edu/~dstineme
------------------------------
Date: 21 Mar 2003 18:31:01 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: CHMOD problems
Message-Id: <u9llz8372y.fsf@wcl-l.bham.ac.uk>
"David S." <southtownoutkast777@hotmail.com> writes:
> I'm writing a program that needs to chmod an array of cgi scripts. Yet
> everytime i run
>
> @files = ("/path/to/script.cgi",
> "/path/to/anotherscript.cgi",
> "/path/to/athirdscript.cgi",
> "/path/to/arentyoutiredofthesegenericscriptnames.cgi");
>
> for ($k=0; $k<@files; $k++) {
> chmod 0755, $files[$k];
> }
There are at least 4 separate mistakes there, none of which would
actually stop the program working:
You forgot the 'my'.
You used a C-style 'for' for no reason ( you could simply iterate
over the values in @files).
You used a 'for' for no reason. chmod() takes a list of filenames.
You forgot to check the sucess of chmod().
> it does nothing....
>
> So i tried using the unix chmod command through perl
>
>
> $_="chmod 0755 @files";
> s/(.)*=//; s/\+/ /g; s/%(..)/pack("c",hex($1))/ge;
> $results=`$_ 2>&1`;
WTF!?
Why have you in-lined the code of URI::Escape::uri_unescape?
Actually that's two questions:
Why are you performing a URI unescape in code that has nothing to do
with web?
Why have you rolled your own, rather than used a standard library?
> WARNING: Can not change permissions for script.cgi
> WARNING: Can not change permissions for anotherscript.cgi
> WARNING: Can not change permissions for athirdscript.cgi
> WARNING: Can not change permissions for
> arentyoutiredofthesegenericscriptnames.cgi
Looks to me like the user as which the Perl script is running does not
own these files.
> Yet, if i manually change the permissions for files (outside of the perl
> environment), i have no problem.....
When you say "perl environment" I'm guessing you mean "the environment
in which perl is being run".
Your problem is likely related to that environment and has nothing
whatever to do with Perl. You'd see exactly the same if you'd run a
shell script or binary in the same environment.
Is that environment CGI perhaps?
If so this is what is called a "stealth CGI question". That is to say
it is a question about CGI but never actually mentions CGI.
Asking stealth CGI questions is considered rude.
> Any solutions?
I suspect that your problem has nothing to do with Perl so you are
looking for solutions in the wrong place.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 21 Mar 2003 18:53:13 GMT
From: "David S." <southtownoutkast777@hotmail.com>
Subject: Re: CHMOD problems
Message-Id: <tcJea.50233$fa.2906602@twister.austin.rr.com>
well actually.. it's not the only info i have. i setup the loops and
stuff like this for different reasons to.. I have more source code within
the for loops, etc.....
and as far as checking the success of the chmod,
i had set
$cnt = chmod 0755 $file; (or whatever i called it)
and $cnt was equal to 2, i have no clue what relevance that has.
"Brian McCauley" <nobull@mail.com> wrote in message
news:u9llz8372y.fsf@wcl-l.bham.ac.uk...
> "David S." <southtownoutkast777@hotmail.com> writes:
>
> > I'm writing a program that needs to chmod an array of cgi scripts. Yet
> > everytime i run
> >
> > @files = ("/path/to/script.cgi",
> > "/path/to/anotherscript.cgi",
> > "/path/to/athirdscript.cgi",
> > "/path/to/arentyoutiredofthesegenericscriptnames.cgi");
> >
> > for ($k=0; $k<@files; $k++) {
> > chmod 0755, $files[$k];
> > }
>
> There are at least 4 separate mistakes there, none of which would
> actually stop the program working:
>
> You forgot the 'my'.
>
> You used a C-style 'for' for no reason ( you could simply iterate
> over the values in @files).
>
> You used a 'for' for no reason. chmod() takes a list of filenames.
>
> You forgot to check the sucess of chmod().
>
> > it does nothing....
> >
> > So i tried using the unix chmod command through perl
> >
> >
> > $_="chmod 0755 @files";
> > s/(.)*=//; s/\+/ /g; s/%(..)/pack("c",hex($1))/ge;
> > $results=`$_ 2>&1`;
>
> WTF!?
>
> Why have you in-lined the code of URI::Escape::uri_unescape?
>
> Actually that's two questions:
>
> Why are you performing a URI unescape in code that has nothing to do
> with web?
>
> Why have you rolled your own, rather than used a standard library?
>
> > WARNING: Can not change permissions for script.cgi
> > WARNING: Can not change permissions for anotherscript.cgi
> > WARNING: Can not change permissions for athirdscript.cgi
> > WARNING: Can not change permissions for
> > arentyoutiredofthesegenericscriptnames.cgi
>
> Looks to me like the user as which the Perl script is running does not
> own these files.
>
> > Yet, if i manually change the permissions for files (outside of the perl
> > environment), i have no problem.....
>
> When you say "perl environment" I'm guessing you mean "the environment
> in which perl is being run".
>
> Your problem is likely related to that environment and has nothing
> whatever to do with Perl. You'd see exactly the same if you'd run a
> shell script or binary in the same environment.
>
> Is that environment CGI perhaps?
>
> If so this is what is called a "stealth CGI question". That is to say
> it is a question about CGI but never actually mentions CGI.
>
> Asking stealth CGI questions is considered rude.
>
> > Any solutions?
>
> I suspect that your problem has nothing to do with Perl so you are
> looking for solutions in the wrong place.
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: 21 Mar 2003 17:41:20 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: foreach element in a hasharray
Message-Id: <u9ptok39dr.fsf@wcl-l.bham.ac.uk>
didrikse@stud.ntnu.no (IDid) writes:
> I'm new to perl and desperately need some advice.
I advise you to attempt to reduce your problems.
> I've got a web-interface that interacts with a database, and by using
> SQL I'm collecting a number of scripts from one table (NO) and trying
> to count the number of empty textfields in several other tables where
> script=[NO].[script].
Information overload.
Reduce your problem.
> I would like the result to look like this:
> EN IR
> script1 0 0
> script2 5 6
> script3 0 0
> script4 0 0
> ..
> with hyperlinked numbers
> f.i
> $lang=EN&$script=script1 $lang=IR&$script=script1
> $lang=EN&$script=script2 $lang=IR&$script=script2
> $lang=EN&$script=script3 $lang=IR&$script=script3
> $lang=EN&$script=script4 $lang=IR&$script=script4
>
>
> For the moment I get:
>
> EN IR
> script1 0 0 0 0 0 0
> script2 5 6 5 6 5 6
> script3 0 0 0 0 0 0
> script4 0 0 0 0 0 0
>
> with hyperlinked numbers
> $lang=EN&$script=script1 $lang=EN&$script=script1
> $lang=IR&$script=script1
> $lang=EN&$script=script2 $lang=EN&$script=script2
> $lang=IR&$script=script2
> $lang=EN&$script=script3 $lang=EN&$script=script3
> $lang=IR&$script=script3
> $lang=EN&$script=script4 $lang=EN&$script=script4
> $lang=IR&$script=script4
Information overload.
Reduce your problem.
> Here is my code:
[ huge badly indented program ]
Information overload.
Reduce your problem.
Look only at the bits that are involved in your problem.
Produce a short but complete (_not_ web!) script containing just those
parts. This advice, and more, can be found in the posting guidelines.
Indent your code consistantly for the sake of readbility.
> my @innerlist = @{$resulthash2{$keys[$i]}};
> foreach my $listelement ( @innerlist ) {
> #here is my problem!
>
> print "<td><Font size=2><a
> href=./listForUpdate.pl?sLang=$tablenames[$j]&scriptName=$keys[$i]>";
> print $listelement, "</a></td>"; }
> }
> print "</tr>\n";
> }
I think you are saying the problen is that @innerlist has 6 elements
but you were expecting 2.
So go back and look at the code that populates %resulthash2 in the
first place.
> while ( $database2->FetchRow() ) {
> my %data = $database2->DataHash();
> my $count = $data{'NumOfText'};
>
> if( exists $resulthash2{$script} ) {
> my @innerlist2 = @{$resulthash2{$script}};
> push( @innerlist2, $count );
> $resulthash2{$script} = \@innerlist2;
> }
>
> else {
> $resulthash2{$script} = [$count];
> }
>
> }
Gee that's convoluted lets reduce it. As as general rule the less
code you write the less you have to debug...
while ( $database2->FetchRow() ) {
my %data = $database2->DataHash();
push(@{$resulthash2{$script}},$data{NumOfText});
}
Hmmm... that didn't help - but it's a lot neater.
Well... perhaps FetchRow() is returning 6 items.
Have you tried debugging?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 21 Mar 2003 18:47:16 GMT
From: "Suresh Rukmangathan" <suresh_rukmangathan@hp.com>
Subject: Free to wrong pool
Message-Id: <U6Jea.643$S55.324@news.cpqcorp.net>
Hi,
I am seeing the following error.
Free to wrong pool 15d2850 not 1afbea0 at my.pl line 1855.
Do somebody know when I get something like this? I am using perl5.8 with
threads.
Thanks,
-sureshr
------------------------------
Date: Fri, 21 Mar 2003 11:16:13 -0800
From: Penguinista <peter@nospam.calweb.com>
Subject: Re: Free to wrong pool
Message-Id: <3e7b6220$0$53735$d368eab@news.newshosting.com>
Suresh Rukmangathan wrote:
> Hi,
>
> I am seeing the following error.
> Free to wrong pool 15d2850 not 1afbea0 at my.pl line 1855.
> Do somebody know when I get something like this? I am using perl5.8 with
> threads.
>
> Thanks,
> -sureshr
>
>
Might help if we had the relivant code.
------------------------------
Date: Fri, 21 Mar 2003 18:57:38 +0100
From: "Pascal Zerwetz" <pzerwetz@yaccom.com>
Subject: Re: getOpenFile with -initialdir
Message-Id: <b5fjqe$1232$1@biggoron.nerim.net>
Thanks... but it does seems to do anything, I am sorry.
The initialdir is not even changed by a reboot...
I have not found a key in the registry that contains the path.
Where is it stored ?
How can I change it ?
"Chris W" <bb@removeriverslime.com> a écrit dans le message de news:
b5d5t0$46h$1@bob.news.rcn.net...
> cwd is giving you the latest used directory. just give it the name of
your
> directory. i think that you need to specify backslashes in the directory
> name on windows (not sure about cygwin), forward slashes won't work.
>
>
> "Pascal Zerwetz" <pzerwetz@yaccom.com> wrote in message
> news:b5d0nk$24l6$1@biggoron.nerim.net...
> > Hello
> > First many thanks to Christian Winter!
> > I am using perl/Tk in Cygwin, on W2k.
> > When I open the getOpenFile dialog, even with use of Cwd and -initialdir
=
> > Cwd,
> > the starting directory is the latest used.
> > Can anyone tell me how can I force the initialdir, please ?
> > Thank you.
> > Pascal.
> >
> >
>
>
------------------------------
Date: 21 Mar 2003 09:19:25 -0800
From: zmrzlina@volny.cz (Dave)
Subject: help writing a perl script so that it's faster than sed
Message-Id: <15fe3ffc.0303210919.3deb0c51@posting.google.com>
Hi,
Perl newbie - standard disclaimer
I need a script that will scan a text file to verify I have correct
data.
The text file reads:
-----------------------------------------------------------------------
OPEN: File addfaa.1.1.96.73.pgg4210 to be Opened on Unit 10 Exists
-------------------------------------------------------------------
Y M D H DAY FC STASH PROC EXP LREC GD LEV VC
1964020100 0 1374 101 0 addfa 7008 1 0.9970 9
1964020100 0 1374 101 0 addfa 7008 1 0.9750 9
1964020100 0 1374 101 0 addfa 7008 1 0.9304 9
.
. [thousands of similar lines more]
.
1964030100 0 581 106 0 addfa 7008 1 0.1560E-02 9
1964030100 0 581 106 0 addfa 7008 1 0.000 9
1964030100 0 581 106 0 addfa 7008 1 0.000 9
1964030100 0 581 106 0 addfa 7008 1 0.000 9
-------------------------------------------------------------------
End of input file reached after 13794 fields read
successfully.
All 13794 fields matching
* I know the file is correct if:
the first line reporting data (line 5) has the first day of the month
(in this case 1964020100 ) AND the first stash code (column 4 -- in
this case 101)
AND
the last line has the first day of the next month (in this case
1964030100 ).
AND the last stash code (in this case 106).
Since the text files have a fixed length, would it be easier to to go
straight to line 5, examine it, then go to the last line (number
13798) and examine it?
I've written something that works using sed and awk, but I am not
satisfied with the speed. Perhaps Perl can do this faster?
Any help appreciated
David
------------------------------
Date: Fri, 21 Mar 2003 16:42:00 GMT
From: "Josh McAdams" <jmcada@hotmail.com>
Subject: Re: How to use Net::FTP - FTP Client class
Message-Id: <shHea.528$Kh4.348849326@newssvr12.news.prodigy.com>
It's possible that there is a firewall issue. Can you manually ftp from the
machine that you are on to the target machine using the command line program
'ftp'? If you can't, then your firewall (or your targets firewall) might be
in the way.
Also, I seem to remember that Net::FTP has different debugging levels.
Check the documentation, but you might can set Debug=>3, or something
similar, in order to get more messages.
"Joe Kamenar" <joey19020@aol.com> wrote in message
news:fca4c27e.0303210603.480de921@posting.google.com...
> "Josh McAdams" <jmcada@hotmail.com> wrote in message
news:<KMqea.98$6Y.35595308@newssvr30.news.prodigy.com>...
> > Your script was allowed to execute, so Perl must have found found
Net::FTP.
> > Try temporarily turning debugging on {Debug=>1} to get some diagnostic
> > messages. Also, it wouldn't hurst to permanently change your script to
look
> > something like:
> >
> > $ftp = Net::FTP->new("ftp.fund.xxxxx.com", Debug => 0) or die("Unable to
> > create ftp object");
> >
> OK, I did that, but simply got the die message. I turned the debug to
> 1 but no messages were displayed. If I am behind a firewall, could
> this be the problem?
>
> - Joe
------------------------------
Date: 21 Mar 2003 08:15:44 -0800
From: Crapnut566@yahoo.com (Nataku)
Subject: Re: Need a little help with a short script
Message-Id: <7e48fc99.0303210815.1c68063e@posting.google.com>
Pick up the llama ... you wont be disapointed. Its as good as every
perl programmer says it is :)
hkvandal@shackmail.com (HKVandal) wrote in message news:<8dbe2cad.0303201415.6af7bba6@posting.google.com>...
> hkvandal@shackmail.com (HKVandal) wrote in message news:<8dbe2cad.0303192231.1cc76cc1@posting.google.com>...
> > Hi trying to make my first productive script, it (in theory)renames
> > file extensions in win32, script is below
> >
> > print "Type in name of Directory, ie. C:\\music\\\n";
> > chomp($dirname=<STDIN>);
> > print "Type in name of extension to replace ie. mp3 (no period)";
> > chomp($old=<STDIN>);
> > print "Type in name of the new extension ie. mpg";
> > chomp($new=<STDIN>);
> > opendir (DIR, $dirname) or die "can't open dir $!";
> > while(defined($file=readdir(DIR))){
> > $old_file=$file;
> > if($file=~/.*\.(.*)/){
> > $currext=$1;
> > if($currext=$old){
> > $file=~/(.*)\..*/;
> > $currfile=$1;
> > $new_file=$currfile . "\." . $new;
> > rename ($old_file, $new_file) or die "$!";
> > }
> > }
> > }
> > closedir(DIR);
> >
> >
> >
> > I get the following error when I run it
> >
> > Permission denied at c:\docs\ext.pl line 16, <STDIN> line 3.
> >
> > Any help is greatly appreciated
>
>
>
> Thank you both very much, I appreciate your help excpecially the links
> to other resources. I have been trying to learn perl by using perldoc
> and it has been slow going
------------------------------
Date: 21 Mar 2003 17:47:43 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: new Perl feature request: call into shared libs
Message-Id: <b5fj7v$htb$1@canopus.cc.umanitoba.ca>
In article <b5emkm$2upc$1@agate.berkeley.edu>,
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
:<mgjv@tradingpost.com.au>], who wrote in article <slrnb7kpfs.8eh.mgjv@verbruggen.comdyn.com.au>:
:> and some programs, written in compliance with the ISO C
:Did not know that this was possible. I got an impression that it does
:not allow I/O.
All of standard C's I/O is in terms of (possibly unbuffered) streams.
I/O at the file descriptor level is not part of the C standard --
it's left up to system libraries, especially POSIX compliant ones.
The C language is defined under the assumption that you might
be writing in C for embedded targets that might not *have*
an operating system, or whose operating system is very very different
from Unix or Windows (or VMS or VM/370 or ....) If you need a feature
such as sockets then your code is inherently not portable to
[say] room dimmers. In my opinion, the division point the C
standardizers choose is a reasonable one.
--
If a troll and a half can hook a reader and a half in a posting and a half,
how many readers can six trolls hook in six postings?
------------------------------
Date: Fri, 21 Mar 2003 19:03:39 GMT
From: "nobody" <nobody@nowhere.non>
Subject: Re: new Perl feature request: call into shared libs
Message-Id: <fmJea.13703$usW1.6677@news01.bloor.is.net.cable.rogers.com>
"Walter Roberson" <roberson@ibd.nrc-cnrc.gc.ca> wrote in message
news:b5fj7v$htb$1@canopus.cc.umanitoba.ca...
> In article <b5emkm$2upc$1@agate.berkeley.edu>,
> Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> :<mgjv@tradingpost.com.au>], who wrote in article
<slrnb7kpfs.8eh.mgjv@verbruggen.comdyn.com.au>:
>
> :> and some programs, written in compliance with the ISO C
>
> :Did not know that this was possible. I got an impression that it does
> :not allow I/O.
>
> All of standard C's I/O is in terms of (possibly unbuffered) streams.
> I/O at the file descriptor level is not part of the C standard --
> it's left up to system libraries, especially POSIX compliant ones.
>
> The C language is defined under the assumption that you might
> be writing in C for embedded targets that might not *have*
> an operating system, or whose operating system is very very different
> from Unix or Windows (or VMS or VM/370 or ....) If you need a feature
> such as sockets then your code is inherently not portable to
> [say] room dimmers. In my opinion, the division point the C
> standardizers choose is a reasonable one.
> --
> If a troll and a half can hook a reader and a half in a posting and a
half,
> how many readers can six trolls hook in six postings?
24. I guess I'm one of them (readers :-)
------------------------------
Date: 21 Mar 2003 17:09:38 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: print to file safley
Message-Id: <b5fh0i$28dq3q$1@ID-24002.news.dfncis.de>
Tassilo v. Parseval <tassilo.parseval@rwth-aachen.de> wrote:
> Since you asked about safety: This is safe as long as you are sure that
> only processes that respect advisory locks write into these files. There
> could still be a program that simply opens one of the files and writes
> into it. But since the above script is probably the only program working
> with these files, it should be reasonably safe.
but i'd say it's only safe if you open the file for reading and
writing at the same time:
regards, tina
--
http://www.tinita.de/ \ enter__| |__the___ _ _ ___
http://Movies.tinita.de/ \ / _` / _ \/ _ \ '_(_-< of
http://www.perlquotes.de/ \ \ _,_\ __/\ __/_| /__/ perception
http://www.tinita.de/peace/link.html - Spread Peace
------------------------------
Date: 21 Mar 2003 17:48:06 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: print to file safley
Message-Id: <b5fj8m$ono$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Tina Mueller:
> Tassilo v. Parseval <tassilo.parseval@rwth-aachen.de> wrote:
>
>> Since you asked about safety: This is safe as long as you are sure that
>> only processes that respect advisory locks write into these files. There
>> could still be a program that simply opens one of the files and writes
>> into it. But since the above script is probably the only program working
>> with these files, it should be reasonably safe.
>
> but i'd say it's only safe if you open the file for reading and
> writing at the same time:
Hmmh, why?
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 21 Mar 2003 09:56:31 -0800
From: c_campise@hotmail.com (Chris)
Subject: Re: Using an Environment variable in a regexp match
Message-Id: <cf545555.0303210956.3eb517ef@posting.google.com>
That did the trick. Thanks for the help!
Chris
Josef Möllers <josef.moellers@fujitsu-siemens.com> wrote in message news:<3E7B1CC6.A9200924@fujitsu-siemens.com>...
> Chris wrote:
> >
>
> > I have a simple text file that contains data similar to the following
> > (each line is preceded with a space).
> >
>
> > ...
> > ...
> > c:\vss\diamond\firmware\i960\h\flshfile.h \
> > c:\vss\diamond\firmware\i960\h\rw.h \
> > c:\vss\diamond\firmware\i960\h\global.h \
> > c:\vss\diamond\firmware\i960\h\ispiport.h \
> > c:\ctools65/include\stdarg.h \
> > c:\vss\diamond\firmware\i960\h\resvarea.h \
> > c:\vss\diamond\firmware\i960\h\slednvr.h \
> > c:\vss\diamond\firmware\i960\h\device.h \
> > c:\vss\diamond\firmware\i960\h\devkind.h \
> > ...
> > ...
> >
>
> > I'm trying to extract the 5th line : c:\ctools65/include/stdarg.h \
> >
>
> > Thing is, I have the DOS environment variable
> > $G960BASE defined to be = c:\ctools65
> >
>
> > Now I figured all I would do is loop through the file like :
> >
>
> > while( <FILE> )
> > {
> > if ( /$G960BASE/ )
> > {
> > print "Found it!\n";
> > }
> > }
> >
>
> > But that doesn't work! But if I strip off the leading 'c:\' from
> > $G960BASE, it does work :
> >
>
> > $G960BASE =~ s/.*\\(\w+)/$1/;
> > while( <FILE> )
> > {
> > if ( /$G960BASE/ )
> > {
> > print "Found it!\n";
> > }
> > }
> >
>
> > Does the parser not like the 'c:\' in the original $G960BASE??
> > Because if I
> > do :
> >
>
> > while( <FILE> )
> > {
> > if ( /c:\\ctools65/ )
> > {
> > print "Found it!\n";
> > }
> > }
> >
>
> > that also works.
> >
>
> > Any thoughts??
>
> Hmmm, you have done a very thorough analysis but you fail to draw the
> final conclusion:
>
> It is indeed the \ in the pattern you are trying to match!
> You need to tell the regex not to match any of the meta characters like
> \:
>
> if ( /\Q$G960BASE\E/ )
------------------------------
Date: 21 Mar 2003 10:13:02 -0800
From: bennett@peacefire.org (Bennett Haselton)
Subject: Re: with ActivePerl, PPM "search" missing results that match regular expression?
Message-Id: <e614455c.0303211013.5eb10532@posting.google.com>
tiltonj@erols.com (Jay Tilton) wrote in message news:<3e7ad51c.6529696@news.erols.com>...
> bennett@peacefire.org (Bennett Haselton) wrote:
>
> : I'm running ActivePerl 5.6.0 with PPM interactive shell (2.1.2). When
> : I type
> :
> : ppm search
> :
> : I get a whole lot of screenfuls of module names, and if I hit Enter
> : enough times and scroll far enough through the list, I can see
> : Crypt-SSLeay listed:
>
> [snip...yup, it's there]
>
> : But if I do
> :
> : ppm search "crypt"
> :
> : then some of the ones listed above are missing from the results:
>
> [huuuge snip. was all that necessary?]
>
> : Specifically, Crypt-Random, Crypt-SKey, Crypt-SSLeay, and
> : Crypt-Serpent (and probably some others; I didn't check all the
> : Crypt-* modules) are listed in the first set of results, but not in
> : the second set. Why would a search for "crypt" not include those
> : modules in the results?
> :
> : I also tried doing:
> : ppm search SSLeay
> :
> : but that turned up zero results, even though "Crypt-SSLeay" is listed
> : in the first set of results above.
>
> Suspect that a bare "search" lists everything in the repository,
> whether it can be installed on your system or not. But a non-bare
> search will return only items useful to your Perl on your OS.
>
> You can go to ppm.activestate.com if you want to look around. Pulling
> down Crypt-SSLeay.zip from the repository of 5.6.x packages, I see
> from its PPD that it's built for Solaris. If you're not on a Solaris
> box, the right thing for PPM to do is not to present it as a package
> available for installation.
Good idea... I assumed that the Crypt::SSLeay was available for
Windows because I actually already have Crypt::SSLeay installed (I was
searching for it because I'm trying to write a batch file that will
check if the user has Crypt::SSLeay installed, and if they don't, will
run the ppm install command to install it for them). But PPM says
it's no longer available for this platform:
PPM> install Crypt-SSLeay
Install package 'Crypt-SSLeay?' (y/N): y
Installing package 'Crypt-SSLeay'...
Error installing package 'Crypt-SSLeay': Could not locate a PPM binary
of 'Crypt
-SSLeay' for this platform
Is that normal, for ActivePerl to remove a PPM for a package that was
there previously? Why would they do that?
-Bennett
------------------------------
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.
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 4740
***************************************