[14024] in Perl-Users-Digest
Perl-Users Digest, Issue: 1434 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 19 14:36:02 1999
Date: Fri, 19 Nov 1999 11:35:50 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943040150-v9-i1434@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 19 Nov 1999 Volume: 9 Number: 1434
Today's topics:
Re: SU problem <m.scheferhoff@gmx.de>
Re: SU problem <m.scheferhoff@gmx.de>
Re: SU problem <gellyfish@gellyfish.com>
Re: SU problem (Martien Verbruggen)
Re: Substitute for gethostbyaddr? <slanning@bu.edu>
Re: SYMLINK in a CGI program? <i@moe.co.uk>
Thank you all (Bård Skaflestad)
Re: Thank you all <aqumsieh@matrox.com>
Re: Thank you all <rhomberg@ife.ee.ethz.ch>
Re: unique search and replace problem <joseph.kazimierczyk@bms.com>
using classes <sp00fD@yahoo.com>
Re: want to convert blocking read socket into nonblocki <aqumsieh@matrox.com>
Re: Weekday in perl (Kragen Sitaker)
Win32::FileOp don't work with WIN98 <h.petrich@ebv.com>
Re: Writing data to file on another server. (Scott McMahan)
Re: Writing Modules <slanning@bu.edu>
Re: Writing Modules (Simon Cozens)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 19 Nov 1999 10:37:20 +0100
From: Michael Scheferhoff <m.scheferhoff@gmx.de>
Subject: Re: SU problem
Message-Id: <38351A4F.6F2E5603@gmx.de>
Kragen Sitaker wrote:
> What's your Perl question?
Sorry, of course my application is written in perl/CGI and I'm looking for a
solution, how to switch to another user or execute a command as another user.
Michael
------------------------------
Date: Fri, 19 Nov 1999 10:37:59 +0100
From: Michael Scheferhoff <m.scheferhoff@gmx.de>
To: Kragen Sitaker <kragen@dnaco.net>
Subject: Re: SU problem
Message-Id: <38351A77.B40F417B@gmx.de>
Kragen Sitaker wrote:
> What's your Perl question?
Sorry, of course my application is written in perl/CGI and I'm looking for a
solution, how to switch to another user or execute a command as another user.
Michael
------------------------------
Date: 19 Nov 1999 10:51:54 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: SU problem
Message-Id: <38352bca_1@newsread3.dircon.co.uk>
Michael Scheferhoff <m.scheferhoff@gmx.de> wrote:
>
>
> Kragen Sitaker wrote:
>
>> What's your Perl question?
>
> Sorry, of course my application is written in perl/CGI and I'm looking for a
> solution, how to switch to another user or execute a command as another user.
>
Some systems allow setuid scripts (or possibly perl will emaulate it ) you
*will* want to look at the perlsec manpage very carefully first though.
There are other solutions but these have nothing to do with Perl.
/J\
--
"In last week's show Lee Mack suggested that David Copperfield was a
smarmy fucking twat. Well done Lee" - Channel 4 Continuity Announcer
------------------------------
Date: 19 Nov 1999 10:54:02 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: SU problem
Message-Id: <slrn83ab31.qs.mgjv@wobbie.heliotrope.home>
On Fri, 19 Nov 1999 10:37:20 +0100, Michael Scheferhoff
<m.scheferhoff@gmx.de> wrote:
> Kragen Sitaker wrote:
>
> > What's your Perl question?
>
> Sorry, of course my application is written in perl/CGI and I'm looking
> for a solution, how to switch to another user or execute a command as
> another user.
That just means that you made the same mistake a lot of people make: You
say Perl/CGI. There is no such thing. There's Perl and there's CGI. Then
you confuse issues that are specific to an interface or an OS with
things perl...
A good rule of thumb is: If your question doesn't mentione Perl once, or
if it does, but it does not change meaning when you replace Perl with
another language's name, then the question is not about Perl.
That rule of thumb would have applied to your question.
And you could really have thought about that yourself. Perl has no su
function. Perl does however support the notion of changing uid and gid,
on platforms that support that, but it's still not a Perl issue. It's an
interface to your operating system. If you want to use that interface,
you first have to understand the operating system.
Hence the remarks that your question is not a Perl question, and the
pointers to other places where you might find answers.
Martien
--
Martien Verbruggen |
Interactive Media Division | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
NSW, Australia |
------------------------------
Date: 19 Nov 1999 12:56:32 -0500
From: Scott Lanning <slanning@bu.edu>
Subject: Re: Substitute for gethostbyaddr?
Message-Id: <kusso22uzzj.fsf@strange.bu.edu>
dillon_rm@magix.com.sg (AcCeSsDeNiEd) writes:
> I think the problem running "gethostbyaddr" has been found out:-
> "The function which you are trying to implement can only be run as
> root, "gethostbyaddr" needs to be run as root or superuser.
I can run it at school, where I haven't obtained root.
(yet.... mwuhuhhuuahhuhaaa)
The webadmin must be either an idiot, a sadist, or a paranoid. (oh my)
--
"It showed a lady, with a fur cap on and a fur stole, sitting upright
and holding out to the spectator a huge fur muff into which the whole
of her forearm had vanished!" --From Franz Kafka's Metamorphosis
------------------------------
Date: 19 Nov 1999 12:24:55 GMT
From: Imo <i@moe.co.uk>
Subject: Re: SYMLINK in a CGI program?
Message-Id: <38354197_1@newsread3.dircon.co.uk>
Kazz <kazz@ashernet.net> wrote:
> Is it possible to create a symlink or hard link from within a cgi
> program. I'm trying to make a separate /etc /bin and /lib directory
> for new ftp users because of a chroot. But, some files in /lib are 3
> meg and I would like to simply link to them if possible...
> What code would be used to accomplish what seems so simple.
perldoc -f link
perldoc -f symlink
?
Imo
------------------------------
Date: 19 Nov 1999 11:12:14 +0100
From: bardsk@math.ntnu.no (Bård Skaflestad)
Subject: Thank you all
Message-Id: <dfwn1saiydd.fsf@martens.math.ntnu.no>
Well, upon returning to school this morning I realised that I indeed
wanted the ability to read from STDIN as well as files named on the
command line. Also I only needed the sed(1)-like behaviour of reading
just one line from the file/stream/whatever-you-like-to-call-it, so I
guess I'll stick to this loop:
while (<>) {
chomp;
$max = length if (lenght > $max);
}
With this I actually can remove the (unnecessary) $nchar variable, and
the loop has a more natural reading, at least to me. Is there
anything "fishy" going on here that I might not be grasping?
So I guess I'll once again have to express my extreme appreciation of
all the help I've got this far. I have much enjoyed this first
encounter with the newsgroup (as a poster that is). Special thanks to
those who brought up the issue of wether or not I should use
defined(<>). I truly hadn't thought of this one.
Thank you all!
--
Bård Skaflestad, student of mathematics at
The Norwegian University of Science and Technology
bardsk@math.ntnu.no
------------------------------
Date: Fri, 19 Nov 1999 11:53:57 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Thank you all
Message-Id: <x3yg0y2zal6.fsf@tigre.matrox.com>
bardsk@math.ntnu.no (Bård Skaflestad) writes:
> while (<>) {
> chomp;
> $max = length if (lenght > $max);
> }
>
> With this I actually can remove the (unnecessary) $nchar variable, and
> the loop has a more natural reading, at least to me. Is there
> anything "fishy" going on here that I might not be grasping?
1) The spelling mistake (length NOT lenght :)
2) I would say that calling length() twice is not the best of styles,
but I can't find a way to do it without a temporary variable.
--Ala
------------------------------
Date: Fri, 19 Nov 1999 12:32:06 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Thank you all
Message-Id: <38353536.D8E68FB9@ife.ee.ethz.ch>
Bård Skaflestad wrote:
>
> Well, upon returning to school this morning I realised that I indeed
> wanted the ability to read from STDIN as well as files named on the
> command line. Also I only needed the sed(1)-like behaviour of reading
> just one line from the file/stream/whatever-you-like-to-call-it, so I
> guess I'll stick to this loop:
>
> while (<>) {
> chomp;
> $max = length if (lenght > $max);
> }
Do you have a lenght call? Better to cut and paste code.
Anyway, here is my take:
perl -nle'$b = $a if ($a=length)>$b;}{print "longest line: $b"'
It even runs with -w (with a minor change) and use strict. Though the }(
isn't valid perl golf AFAIK.
- Alex
------------------------------
Date: Fri, 19 Nov 1999 13:04:54 -0500
From: Joe Kazimierczyk <joseph.kazimierczyk@bms.com>
Subject: Re: unique search and replace problem
Message-Id: <38359145.2299C9D4@bms.com>
rancorr@hotmail.com wrote:
> I have a long text files which contain the following types of entries:
>
> <option value="232">Bain & Company
>
> <option value="129">Baker & Botts
>
> <option value="67232">Baker & McKenzie
>
> I want to create a Perl script that will replace the numbers with the
> name of the company that follows it three characters later. Thus, the
> above snipet will become:
>
> <option value="Bain & Company">Bain & Company
>
> <option value="Baker & Botts">Baker & Botts
>
> <option value="Baker & McKenzie">Baker & McKenzie
>
> Doing it by hand is an incredible pain as there are 5,000 entries. Any
> neat Perl solutions?
Here's one way:
$a = '<option value="232">Bain & Company';
$a =~ s/(<option value=")(\d+)(">)(.*)/$1$4$3$4/;
print $a;
<option value="Bain & Company">Bain & Company
------------------------------
Date: Fri, 19 Nov 1999 16:55:55 GMT
From: sp00fD <sp00fD@yahoo.com>
Subject: using classes
Message-Id: <813veg$tmc$1@nnrp1.deja.com>
I'm somewhat familiar with Python and have used it on a couple of
occassions. I'm curious, is there a way to directly use a class/module
as in python? i.e.:
in python
class Foo:
methods...
if __name__ == "__main__":
get command line args..
bar = Foo(sys.argv[1]...)
bar.run()
or whatever..
thanks
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 19 Nov 1999 11:26:16 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: want to convert blocking read socket into nonblocking
Message-Id: <x3yiu2yzbvc.fsf@tigre.matrox.com>
dinodesk@hotmail.com writes:
> How do i change read into a nonblocking call? I just want process to
> wait for 5secs on read.
Checkout perlfaq8:
How do I timeout a slow event?
------------------------------
Date: Fri, 19 Nov 1999 18:53:36 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Weekday in perl
Message-Id: <Q0hZ3.28579$YI2.1316643@typ11.nn.bcandid.com>
In article <xjgg0y2mq3e.fsf@gamora.ndhm.gtegsc.com>,
Vincent Murphy <vincent.murphy@cybertrust.gte.com> wrote:
>>>>>> "books" == books <books@mail.state.fl.us> writes:
> books> Steffen Beyer <sb@sdm.de> wrote:
> books> #!/usr/bin/perl
> books> use Time::Local
> books> my $time = timelocal( 0, 0, 12, $mday, $mon, $year);
> books> $dayOfWeek = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime($time))[6]];
> books> (NB, not tested, should work though.)
>
>Maybe if you tested it you would know that it doesn't work first of all,
>need a semi after Time::Local, and secondly, it would output incorrect
>data because of the $mon needs to be $mon-1;
And $year needs to be $year-1900, although you might have missed that
in testing.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 19 Nov 1999 09:49:44 +0100
From: "Hans-Jürgen Petrich" <h.petrich@ebv.com>
Subject: Win32::FileOp don't work with WIN98
Message-Id: <8132re$nmf@as.ebv.com>
Who knows why Win32::FileOp don't work with WIN98
use Win32::FileOp;
$searchDir = BrowseForFolder('Select Folder');
Thanxxx all
--
Hans-Jürgen Petrich
--
Hans-Jürgen Petrich
------------------------------
Date: Fri, 19 Nov 1999 18:37:37 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Writing data to file on another server.
Message-Id: <RNgZ3.294$AQ2.22013@newshog.newsread.com>
Crawfishy (cans1@hotmail.com) wrote:
> I am writing a cgi script in perl that currently gets data from an html form
> and writes it to a data file. This works great but now I need the script to
> write the data to a file on another server.
E-mail it. Put a pipe alias on another server. If you're paranoid,
encrypt it. The greatest distributed computing tool available.
Scott
------------------------------
Date: 18 Nov 1999 22:04:13 -0500
From: Scott Lanning <slanning@bu.edu>
Subject: Re: Writing Modules
Message-Id: <kushfij6v2q.fsf@bottom.bu.edu>
davidwaters@bigfoot.com (David Waters) writes:
> Can anyone give me some tips please on how I go about writing a Perl
> module. Most of the standard documentation that I've come across is
> useless and doesn't explain the steps required to create a module.
Bah...
'perldoc perlmod', 'perldoc Exporter', 'perldoc perlmodlib',
'perldoc -f use'
--
"I teach you the Superman. Man is something that has to be surpassed.
What have you done to surpass him?" --Nietzsche
------------------------------
Date: 19 Nov 1999 11:35:28 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Writing Modules
Message-Id: <slrn83adg0.ksp.simon@othersideofthe.earth.li>
Bill Moseley (comp.lang.perl.misc):
>perldoc perlmod has this:
> For example, to start a normal module called Some::Module,
> create a file called Some/Module.pm and start with this
> template:
>
>Follows is a template you can cut-n-paste. What else would you want?
Although you really want to start with h2xs if you're thinking of
distributing it. MJD wrote a really good modules tutorial, didn't he?
--
Just once, I wish we would encounter an alien menace that wasn't
immune to bullets.
-- The Brigadier, "Dr. Who"
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 1434
**************************************