[9816] in Perl-Users-Digest
Perl-Users Digest, Issue: 3409 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 10 19:07:12 1998
Date: Mon, 10 Aug 98 16:00:20 -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 Mon, 10 Aug 1998 Volume: 8 Number: 3409
Today's topics:
"newgrp" in a Perl script (Joseph Bell)
Re: clp.misc etiquette question <ljz@asfast.com>
Corrupted Data Files? <kpatel@mathworks.com>
File updating question (Phil Taylor)
Re: File updating question (Craig Berry)
Re: having trouble with printing array to html (I R A Aggie)
Re: having trouble with printing array to html (Bob Trieger)
help parsing mail file jimmyp@marimba.com
Install error - activestate perl 5.005 <gough@cruznet.net>
msgrcv not blocking kstevens7@my-dejanews.com
msgrcv() not blocking kstevens@globeandmail.ca
Re: NEED REDIRECT SCRIPT (Jeff Yoak)
Re: os/2, modules, filenames (Ilya Zakharevich)
perl question (please help...) <zurhorst@aol.com>
Re: perl question (please help...) <merlyn@stonehenge.com>
Re: perl scripts tries to locate specific file, getting (Bob Trieger)
Re: perlfaq - frequently asked questions about Perl (pa (Patrick)
Re: perlfaq - frequently asked questions about Perl (pa (Nathan V. Patwardhan)
Re: perlfaq - frequently asked questions about Perl (pa (Ilya Zakharevich)
Re: printing remote host <rootbeer@teleport.com>
Re: Self-printing code (Mark-Jason Dominus)
Re: Starting qmail from perl script <rootbeer@teleport.com>
Re: strings (Mark-Jason Dominus)
use strict problem with indirect file variables ? (Phil Taylor)
Re: use strict problem with indirect file variables ? (Craig Berry)
Re: use strict problem with indirect file variables ? (Bob Trieger)
Re: What is the purpose of Perl (I R A Aggie)
Re: what is this stuff? (Steve Linberg)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Aug 1998 21:38:39 GMT
From: jobell@bnr.ca (Joseph Bell)
Subject: "newgrp" in a Perl script
Message-Id: <6qnp8v$due@crchh14.us.nortel.com>
i know this has been answered before, but i can't find it anywhere on the web.
i would like to be able to change my effective user and group ids during the
execution of my perl script. how can I do this?
basically I would like to say:
newgrp mynewgroup;
and have all commands executed afterwards to execute as part of the new
group.
thanks for any help you can give...
regards,
joe
joebell@nortel.com
--
Joseph A. Bell (NOT Cindy Wierschem) jobell@nortel.com
Northern Telecom Wireless Technologies
GSM MSC Tools Development
No funny quotes here.
------------------------------
Date: 10 Aug 1998 18:48:58 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: clp.misc etiquette question
Message-Id: <ltk94g5u79.fsf@asfast.com>
gburnore@databasix.com (Gary L. Burnore) writes:
> On 09 Aug 1998 21:43:36 +0930, in article <r8ww8ibbf3.fsf@asc.sps.mot.com>,
> Martin Gregory <mgregory@asc.sps.mot.com> wrote:
>
> >"Matthew O. Persico" <mpersico@erols.com> writes:
> >
> >> [ ... ]
> >>
> >> what is the general feeling in the group about posting the answer and/or
> >> mailing the answer?
> >
> >As others said, just post a polite answer that says "The answer is <>,
> >and you can find it in <>".
>
> I agree with Martin on this. Politely saying here's your answer and it's in
> the faq.
And for those people who do not choose to give any kind of answer at
all, then I would favor a simple, *polite*, non-insulting pointer to
the FAQ's and doc's.
Not everyone here agrees with this approach, however.
> [ ... ]
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: Mon, 10 Aug 1998 17:01:16 -0400
From: Ketan Patel <kpatel@mathworks.com>
Subject: Corrupted Data Files?
Message-Id: <35CF5F9C.1E65D8E4@mathworks.com>
I have a perl script (~770 lines) which is "included" in a handful of
other scripts, so it's called each time one of those start... This
script and the others open up a primary datafile which is about 100
lines (filesize: 22k)... Now, at somewhat random times, this file seems
to become corrupted. By corrupt, I mean the entire file is not present
(it drops in size to 0k, ~8k, or ~16k) and the end of the file is not at
any logical point which leads me to believe that there is not a problem
in the code... I use "flock DATA, 2" (exclusive lock, right?) every time
the data file is opened... The 'big' script may need to be loaded a
couple times a minute, while the datafile may need to be opened (just
guessing) every few seconds (possibly more often)... Any ideas? Should
I try rewriting in C?
------------------------------
Date: Mon, 10 Aug 1998 21:19:19 GMT
From: phil@ackltd.demon.co.uk (Phil Taylor)
Subject: File updating question
Message-Id: <35cf60bc.11105292@news.demon.co.uk>
I'm trying to achieve the following:-
1) open file
2) lock file
3) backup the file (in case the forthcoming update goes badly wrong)
4) read the file into an array
5) update the array
6) write the array back to the file
7) close the file
8) delete the backup
I have read an alternative method in the perl FAQ where the new file
is built and then copied over the old one but in this case the lock
will have been removed when the copy is perfomed and therefore not
satisfactory.
Can anyone suggest a better way of doing the above ?
What is an efficient way to backup the file(step 3) bearing in mind
the file is open?
If I open a file using this code segment ...
open (FILE, "+<filename")
once the file has been read, how do I ensure the file is emptied
before the array is written back (step 6)
Thanks
Phil
------------------------------
Date: 10 Aug 1998 22:02:09 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: File updating question
Message-Id: <6qnql1$b3v$1@marina.cinenet.net>
Phil Taylor (phil@ackltd.demon.co.uk) wrote:
: I'm trying to achieve the following:-
:
: 1) open file
perldoc -f open
: 2) lock file
perldoc -f flock
: 3) backup the file (in case the forthcoming update goes badly wrong)
perldoc perlrun (with particular attention to the -i option)
or
perldoc File::Copy
: 4) read the file into an array
perldoc perlop (with particular attention to the <> operator)
: 5) update the array
perldoc perldata
perldoc perlop
: 6) write the array back to the file
perldoc -f print
: 7) close the file
perldoc -f close
: 8) delete the backup
perldoc -f unlink
: What is an efficient way to backup the file(step 3) bearing in mind
: the file is open?
File::Copy shouldn't care that the file is open.
: If I open a file using this code segment ...
:
: open (FILE, "+<filename")
:
: once the file has been read, how do I ensure the file is emptied
: before the array is written back (step 6)
perldoc -f seek
perldoc -f truncate
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Mon, 10 Aug 1998 17:50:08 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: having trouble with printing array to html
Message-Id: <fl_aggie-1008981750230001@aggie.coaps.fsu.edu>
In article <35CF5559.5723@rsn.hp.com>, rosso@rsn.hp.com wrote:
+ @delivarray = split(/;/, $deliverables);
+ foreach $line (@delivarray) {
+ print pdstemp "<li>$line\n";
+ }
+ print pdstemp "</ul>\n";
+ close pdstemp;
+ When I go to view the file online, other html is there that I reference
+ earlier in the perl, but there is no list. (This list is part of a
+ larger on-the-fly generated html document.)
I take it that you get a <ul></ul> pair in your file, and nothing in
between? In which case: what is the content of $deliverables? It would
seem that there's something wrong with @delivarray. Do you use the '-w'
flag:
#! /usr/bin/perl -w
What version of perl ('perl -v')? Perhaps you should consider the
'use diagnostics;' to get more verbose diagnostic messages?
I suspect that you're not using '-w', and that you are storing the
input data in a different variable than "$deliverables", so that
the 'split' never gets the data you think it should.
But that's just a WAG.
James - Wild Assed Guess
------------------------------
Date: Mon, 10 Aug 1998 22:22:49 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: having trouble with printing array to html
Message-Id: <6qns19$emf$2@ligarius.ultra.net>
[ posted and mailed ]
rosso@rsn.hp.com wrote:
-> This is the html referencing the textarea:
-> <textarea name="deliverables" wrap=virtual cols=55 rows=8></textarea>
->
-> This is the perl I have - no errors appear when compiled:
->
-> open(pdstemp, ">/itsrc/apache/htdocs/projects/temp/$pid.html");
-> print pdstemp "<ul>\n";
-> @delivarray = split(/;/, $deliverables);
-> foreach $line (@delivarray) {
-> print pdstemp "<li>$line\n";
-> }
-> print pdstemp "</ul>\n";
-> close pdstemp;
1. You don't check the status of your open.
2. When did you define $deliverables? If you parsed the form properly
`deliverable' should be the key in a hash, not a $deliverables variable.
3. If you aren't already doing so, I suggest you use CGI.pm, CARP.pm, strict
and -w in your script. CGI will solve a few of your problems and the others
will point out the problems so you can fix them.
4. This borders really close on being a question for
news:comp.infosystem.www.authoring.cgi and not c.l.p.m.
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: Mon, 10 Aug 1998 21:42:19 GMT
From: jimmyp@marimba.com
Subject: help parsing mail file
Message-Id: <6qnpfr$oqe$1@nnrp1.dejanews.com>
I'm having trouble parsing a mail file to turn info into URLs.
I want to pull out the "Subject:" header and the "Content-Base:" header from a
file with multiple pieces of mail in it.
I am running into trouble with the Content-Base: header as it usually spans
two or three lines. I have read some things like to set $/= "" but I can't
quite get it.
The Content-Base: looks like this
Content-Base: "http://www.perl.com/pace/pub/
perldocs/1998/07/osd.html"
It's really easy for me to get the first line but I can't get just the stuff
in the quotes. It's probably really easy, but I'm stuck.
I'd also like to pull out the Subject and Content-base in one pass (<>).
I tried to use mail-tools and just extract the info via pop3 but I couldn't
figure that one out either.
thanks,
jimmy
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 10 Aug 1998 15:47:39 -0700
From: "Mary Gough" <gough@cruznet.net>
Subject: Install error - activestate perl 5.005
Message-Id: <6qnt22$5af$1@supernews.com>
I am using the win 98 operating system and have no trouble installing perl.
However, certain features don't work for example when executing the program
perlse during the install I get:
C:\Perl\5.005\bin\MSWin32-x86-object>perl perlse.pl
Can't locate Win32/OLE.pm in @INC (@INC contains:
C:\PERL\5.005\lib/MSWin32-x86-
object C:\PERL\5.005\lib C:\PERL\site\5.005\lib/MSWin32-x86-object
C:\PERL\site\
5.005\lib C:\PERL\site\lib .) at perlse.pl line 1.
BEGIN failed--compilation aborted at perlse.pl line 1.
No example programs are 'unpacked' etc.
Can anybody help?
Thanks,
J. Kath
jjkath@csupomona.edu
------------------------------
Date: Mon, 10 Aug 1998 21:51:13 GMT
From: kstevens7@my-dejanews.com
Subject: msgrcv not blocking
Message-Id: <6qnq0h$pjp$1@nnrp1.dejanews.com>
msgrcv() is returning after a short delay (with errno = EINTR "Interrupted
System Call") rather than blocking until a message arrives (as it should).
I'm passing "0" as the flag which according to the msgrcv manpage means that
it should block. I looked at the perl source code for do_msgrcv and it seems
to be passing the flag through unmodified. Is there some wrapper which has a
timeout for system calls? If there's a message in the queue, msgrcv behaves
correctly.
I'm running perl version 5.004_04 built for sun4-solaris.
Please e-mail any replies to kstevens@globeandmail.ca
Thanks!
Ken Stevens
Internet Applications Developer
The Globe and Mail
Canada
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 10 Aug 1998 21:54:27 GMT
From: kstevens@globeandmail.ca
Subject: msgrcv() not blocking
Message-Id: <6qnq6j$pld$1@nnrp1.dejanews.com>
msgrcv() is returning after a short delay (with errno = EINTR "Interrupted
System Call") rather than blocking until a message arrives (as it should).
I'm passing "0" as the flag which according to the Solaris msgrcv manpage
means that it should block. I looked at the perl source code for do_msgrcv
and it seems to be passing the flag through unmodified. Is there some
wrapper which has a timeout for system calls? If there's a message in the
queue, msgrcv behaves correctly.
I'm running perl version 5.004_04 built for sun4-solaris.
Please e-mail any replies to kstevens@globeandmail.ca
Thanks!
Ken Stevens
Internet Applications Developer
The Globe and Mail
Canada
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 10 Aug 1998 21:07:26 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: NEED REDIRECT SCRIPT
Message-Id: <6bJz1.37$vq2.29622@newse2.tampabay.rr.com>
[posted and emailed]
art4all@gate.net (Stuart Sloves) wrote:
>Could someone steer me to a 'redirect script' which will take a client
>browser accessing a new 'parked' domain and redirect it to an existing
>domain and an 'index2.html file in a directory within the root one.
>Please e-mail me at: mailto:art4all@gate.net
This is definately off-topic here. Since you are asking for a handout
/ "pointer", it is probably also off-topic for
comp.infosystems.www.authoring.cgi . If you are going to post the
same question to more than one newsgroup, at least cross-post the
message.
In the thread on ciwac where this is at least remotely on-topic I've
posted an example script to use as a starting point.
Cheers,
Jeff
--
Jeff Yoak jeff@yoak.com
------------------------------
Date: 10 Aug 1998 21:28:46 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: os/2, modules, filenames
Message-Id: <6qnome$lva$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was NOT sent to Tels - \"DONT REPLY TO THIS ADDRESS!\"
<dummy@bloodgate.com>],
Use a programming approach, not this junk. Say, my trnrc contains
Cc: %(%[mail-copies-to]=never?:%t)
line, so if you put
Mail-Copies-To=never
into the headers, you would not get a copy from me (this is not in
RFCs, but I was told that it is supported by several newsreaders).
who wrote in article <35CF5576.3A07@bloodgate.com>:
> the os/2 dir was empty a couple of days ago. my post got delayed because
> my news server is broken and i had to use another. i didnt bother to
> check cpan again. mea culpa.
The OS/2 directory tracks binary releases for many years.
> > > if not, what do i need o get it ported
> > Nothing.
> I need nothing to get it ported? it will port itself magically? [thats
> sarcasm]
Yes. [thatsnotsarcasm]
Ilya
------------------------------
Date: 10 Aug 1998 23:29:44 +0100
From: "Alexander Zurhorst" <zurhorst@aol.com>
Subject: perl question (please help...)
Message-Id: <01bdc4a6$41206820$763a73c2@web-1>
1.Is it possible to have a script, which shows you informations about your
hard disc (e.g. free space) and more important:
2. show all programs running (like the taskmanager) a.) on a single
computer
b.)in a network
(I need a perl script, which counts all open CAD-programs...)
--
Alexander Zurhorst (Germany)
zurhorst@aol.com
------------------------------
Date: Mon, 10 Aug 1998 22:47:18 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: perl question (please help...)
Message-Id: <8c3eb4sbdg.fsf@gadget.cscaper.com>
>>>>> "Alexander" == Alexander Zurhorst <zurhorst@aol.com> writes:
Alexander> 1.Is it possible to have a script, which shows you informations about your
Alexander> hard disc (e.g. free space) and more important:
Alexander> 2. show all programs running (like the taskmanager) a.) on a single
Alexander> computer
Alexander> b.)in a network
Alexander> (I need a perl script, which counts all open CAD-programs...)
Alexander> --
Alexander> Alexander Zurhorst (Germany)
Alexander> zurhorst@aol.com
Please do not post the same message to both comp.lang.perl.misc and
comp.lang.perl.modules.
At a minimum, learn to use CROSS posting (multiple names on the
Newsgroups: line).
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 10 Aug 1998 22:07:07 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: perl scripts tries to locate specific file, getting file not found
Message-Id: <6qnr3q$emf$1@ligarius.ultra.net>
[ posted and mailed ]
djetz@my-dejanews.com wrote:
-> I've checked file permisions, ownership, user rights ...what else can I try?
-> I'm new to both Perl and NT so any suggestions would be welcome.
The `AT' function is probably running your program from a different directory.
You can either change working directory in your program or specify the full
path name.
-> Please reply to djetz@sierrasys.com
Sorry. If you want replies to that address, you should specify it in your
reply-to header.
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: Mon, 10 Aug 1998 21:05:04 GMT
From: patrickq@autobahn.mb.ca (Patrick)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <35d15f23.3264350@news.autobahn.mb.ca>
On 7 Aug 1998 14:22:03 GMT, Tom Christiansen <tchrist@mox.perl.com>
wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, pudge@pobox.com (Chris Nandor) writes:
>:No, on our GUI platforms we often use editors for viewing arbitrary text files.
>
>That's a silly idea. Why would you use an editor when you aren't editing?
>That's as stupid as using a web browser to read mail. Of course, I guess
>on those platforms, you do that, too. :-(
>
>--tom
wondering if tom's minimalist philosophy means he uses:
sed for his stream editing?
awk for his pattern matching?
sh for shell scripting?
:-)
Patrick
__________
"It's better to have loved and lost than to never have seen Lost in Space"
-- Kelly Bundy quoting Chinese philosopher Unconcious
------------------------------
Date: 10 Aug 1998 22:15:21 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <6qnrdp$49j@fridge.shore.net>
Uri Guttman (uri@sysarch.com) wrote:
: and check out tkman which uses polyglotman internally. i think tk will
: run on winblows so you could run this. it is an excellent gui viewer of
: man pages and texinfo pages.
You refer to Windows as "winblows" and yet you refer people to a
GUI-based tool? Something is fishy in Denmark.
REDRUM.
--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>
------------------------------
Date: 10 Aug 1998 22:56:44 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <6qntrc$421$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Nathan V. Patwardhan
<nvp@shore.net>],
who wrote in article <6qnrdp$49j@fridge.shore.net>:
> : and check out tkman which uses polyglotman internally. i think tk will
> : run on winblows so you could run this. it is an excellent gui viewer of
> : man pages and texinfo pages.
>
> You refer to Windows as "winblows" and yet you refer people to a
> GUI-based tool? Something is fishy in Denmark.
For some tasks (reading docs is one of them) GUI-based tool pretty
often blow command-line tools away (*). And I do not see how this
relates to M$ bashing (is it correct that Win* has no format for
online books?!).
Ilya
(*) Yes, I know that no GUI tool provides a full power of Perl for
text search (yet). But I found out that (shell-globbing-like)
search facilities of IBM's online .INF books are adequate for my
(non-trivial) needs 99.9% of time.
------------------------------
Date: Mon, 10 Aug 1998 21:41:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: printing remote host
Message-Id: <Pine.GSO.4.02.9808101438140.10161-100000@user2.teleport.com>
On Sun, 9 Aug 1998, Thomas Emery wrote:
> I have a message board (and the people) want to list all poster's IP
> address.
What people do you have? :-)
> I am assuming that it is as simple as finding the file that right now
> generates the messages and put in a line that says something like
> print Remote_Host or something like that.
What file? Do you mean the program? Yes, it's probably "just" a matter of
changing the program to include that information.
> Am I that far over my head?
Yes. If you hire someone to do this, the invoice will probably read
something like this:
Adding one line of code $0.25
Knowing what to add and where $99.75
Total $100.00
:-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 10 Aug 1998 22:34:43 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Self-printing code
Message-Id: <6qnsi3$n6a$1@netnews.upenn.edu>
For your amusement and edification, I present the following file,
which, when installed in /tmp/p and executed by Perl, emits its own
source code on the standard *error*:
-------------------------------- BEGIN FILE
Illegal division by zero at /tmp/p line 1.
-------------------------------- END FILE
% perl /tmp/p
Illegal division by zero at /tmp/p line 1.
%
------------------------------
Date: Mon, 10 Aug 1998 21:25:04 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Starting qmail from perl script
Message-Id: <Pine.GSO.4.02.9808101415450.10161-100000@user2.teleport.com>
On 8 Aug 1998, Miguel Cruz wrote:
> I need users in a certain group to be able to restart Qmail (after
> editing files in /var/qmail/control).
> It seems that the only way Qmail will start is with the exact syntax
> provided in the documentation -
>
> csh -cf 'qmail-start ./Mailbox splogger qmail &'
And why should you want to start it in an undocumented way? :-)
> So anyway, I can't just stick that in a shell script and +s it because
> Linux doesn't allow suid scripts.
Good for Linux!
> I can't put it in a Perl program because no
> combination of permissions would please csh.
Naaaaah. Perl can do it! If nothing else, you can pass those args to csh,
and let it start qmail.
> The only way I managed to get it to work at all was to write a C
> program that setuid(0) then called that does this with system(). The
> problem with that is, when the Perl program finishes, Qmail dies with
> it.
Why not do is from a set-id Perl program? (Read perlsec, though.) You'll
probably want to use fork-and-exec, rather that system. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 10 Aug 1998 22:26:23 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: strings
Message-Id: <6qns2f$e2j$1@netnews.upenn.edu>
In article <6qnk39$508$1@marina.cinenet.net>,
Craig Berry <cberry@cinenet.net> wrote:
>Seriously, I think it's a reasonable goal that, where possible, code and
>data *should* use the same formats and conventions. And, indeed, I've
>often wished that 077 and 0xCA in input data would parse as octal and hex
>respectively.
I don't think you've thought this through. It would be an incredible
disaster. You'd be reading in your file of zip code, and you'd get to
TPJ,POB 54,Boston,MA,02101
and you'd discover that the zip code had been interpreted as `1089'.
It's much better to call an explicit conversion function if you want
the 1089. In this case, the function is called `oct'.
And of course, it's not hard to build such a conversion function:
if (numval("2,342") < 7) {
...
}
As you pointed out, Lisp does have such features---all invoked through
explicit conversion functions of one kind or another. The most
powerful and well-known of these conversion functions is `eval'.
Perl has `eval' too. If you want underscores in your numbers, then
if (eval "2_342" < 7) {
...
}
will work just fine.
>it's sad how every language and OS become gradually encumbered by the
>weight of past practice.
While I would agree with you in general, I think that this is not a
sad example. I think this is an example of how a good designer can
get things right the first time and not have to change them later.
------------------------------
Date: Mon, 10 Aug 1998 21:30:34 GMT
From: phil@ackltd.demon.co.uk (Phil Taylor)
Subject: use strict problem with indirect file variables ?
Message-Id: <35cf65da.12415688@news.demon.co.uk>
I'm trying to do this:-
$handle = "MYFILE";
open ($handle, "<file1");
but it doesn't seem to work when I ' USE STRICT'. Can anyone suggest a
way around this problem. I want to use indirect file variables so
thatI can use a local procedure to handle my file locking.
Thanks
Phil
------------------------------
Date: 10 Aug 1998 22:06:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: use strict problem with indirect file variables ?
Message-Id: <6qnqt5$b3v$2@marina.cinenet.net>
Phil Taylor (phil@ackltd.demon.co.uk) wrote:
: I'm trying to do this:-
:
: $handle = "MYFILE";
: open ($handle, "<file1");
:
: but it doesn't seem to work when I ' USE STRICT'. Can anyone suggest a
: way around this problem. I want to use indirect file variables so
: thatI can use a local procedure to handle my file locking.
Don't use strict if you don't understand it. Use strict requires all
globals to be declared or explicitly package qualified; as a
result, most vars under use strict are declared as lexicals
using my. Presumably, you got that as a warning:
> perl -Mstrict -e '$foo=1'
Global symbol "foo" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
Has your $handle variable been declared? Is it package qualified? Is it
a lexical?
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Mon, 10 Aug 1998 22:27:39 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: use strict problem with indirect file variables ?
Message-Id: <6qnsaa$emf$3@ligarius.ultra.net>
[ posted and mailed ]
phil@ackltd.demon.co.uk (Phil Taylor) wrote:
-> I'm trying to do this:-
->
-> $handle = "MYFILE";
-> open ($handle, "<file1");
->
->
-> but it doesn't seem to work when I ' USE STRICT'. Can anyone suggest a
-> way around this problem. I want to use indirect file variables so
-> thatI can use a local procedure to handle my file locking.
ahhh?? Did ` my $handle = "MYFILE" ' ever cross your mind?
and check the return on the open.
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: Mon, 10 Aug 1998 17:17:38 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: What is the purpose of Perl
Message-Id: <fl_aggie-1008981717540001@aggie.coaps.fsu.edu>
In article <6qnhja$24q$1@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:
+ [courtesy cc of this posting sent to cited author via email]
+
+ In comp.lang.perl.misc,
+ fl_aggie@thepentagon.com (I R A Aggie) writes:
+ :+ It has mapped the universe and created an exact duplicate.
+ :%universe_2 = %universe;
+
+ Goodness, wouldn't it be easier to just fork? No data copying. :-)
Forgive my presumption here, I only have a vague notion of what forking
does, but wouldn't this give you _parallel_ universes?
James - I don't think the data space is shared...
------------------------------
Date: Mon, 10 Aug 1998 17:30:12 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: what is this stuff?
Message-Id: <linberg-1008981730120001@projdirc.literacy.upenn.edu>
In article <35cf5a13.9334992@news.es.hac.com>, areeves1@csc.com (Anthony
Reeves) wrote:
> Hi, I'm reading a file that is produced by a different process.
>
> when I read the file, its got these weird chacters I cannot figure out
> how to get rid of..
>
> here is the line that is read and displayed during a debug session:
>
> X line
>
> line = "Time\cIAmt\cIJob\cJ"
>
> the \cI \cJ
> I want to remove, I thought they might be something like a control
> char. so I tryed \033I
> did not work, try \eI
> did not work..
>
> any ideas ? Anyone seen this?
tabs and linefeeds. 0x09 and 0x0A.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3409
**************************************