[13482] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 892 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 23 17:17:26 1999

Date: Thu, 23 Sep 1999 14:10:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938121016-v9-i892@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 23 Sep 1999     Volume: 9 Number: 892

Today's topics:
    Re: REQ: tell-a-friend script <tchrist@mox.perl.com>
    Re: REQ: tell-a-friend script <tchrist@mox.perl.com>
    Re: REQ: tell-a-friend script <tchrist@mox.perl.com>
    Re: REQ: tell-a-friend script (Alan Curry)
    Re: REQ: tell-a-friend script <uri@sysarch.com>
        taint/ENV{PATH}/pRPC <rockie@apk.net>
    Re: taint/ENV{PATH}/pRPC <t.dillerNOnlSPAM@xpres.com>
    Re: You should be admired (Henry Penninkilampi)
    Re: You should be admired (Henry Penninkilampi)
    Re: You should be admired <elaine@chaos.wustl.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 23 Sep 1999 13:51:04 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: REQ: tell-a-friend script
Message-Id: <37ea84a8@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    pacman@defiant.cqc.com (Alan Curry) writes:
:I don't think it's "ruined". If they're ambiguous, give a warning, like gcc
:-Wall does since about 2.8. When they're not ambiguous, the extra braces are
:annoying.

Perl if/while/for constructs do not take other statements as targets.
They take blocks.  This is critical.  Oterhwise you're back to the


    while (1)
	do something;
	do something else;

problem.

:So why not elif, as in Bourne shell and cpp? 

"elif" is considered deeply annoying by Larry.  Rule #1 applies.

--tom
-- 
	    "Perl is to sed as C is to assembly language."  


------------------------------

Date: 23 Sep 1999 13:53:09 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: REQ: tell-a-friend script
Message-Id: <37ea8525@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    bart.lateur@skynet.be (Bart Lateur) writes:
:There is NO dangling else problem in Perl. 

That's right.  Everything takes a block.  if() never optionally takes
a statement.  This is good.  I get very annoyed by ignorant elsif whiners.

--tom
-- 
 "there is not enough floorspace for all the stuff I want to put on
 it" -- Dean Roehrich's (only) complaint about his cubicle


------------------------------

Date: 23 Sep 1999 13:55:17 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: REQ: tell-a-friend script
Message-Id: <37ea85a5@cs.colorado.edu>

In comp.lang.perl.misc, 
    planb@newsreaders.com (J. Moreno) writes:
:Bah.  That's beneath you.  Not the same thing at all and you know it.

"Whatever".

It is the same.

:> I repeat: you're wrong.  In fact, you're verging on being full of it.
:Opinionated for sure, but full of it?

You're wrong.  Larry misspelled nothing.  Everything was completely
intenional.  And saying otherwise is pure flaming bullshit.

I don't expect you to back down or apologize.  I do expect you
to find your way into many people's killfiles.

--tom
-- 
Some of you know what the Perl slogan on Windows is, and you can say it
with me: "It's a good thing there's more than one way to do it, because
most of them don't work."  --Larry Wall


------------------------------

Date: Thu, 23 Sep 1999 20:17:21 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: REQ: tell-a-friend script
Message-Id: <lVvG3.6796$QJ.393239@typ11.nn.bcandid.com>

In article <37ea84a8@cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>     [courtesy cc of this posting mailed to cited author]

Hmm... what was that header called... "Mail-Copies-To: never" or something
like that...

>Perl if/while/for constructs do not take other statements as targets.
>They take blocks.  This is critical.  Oterhwise you're back to the
>
>    while (1)
>	do something;
>	do something else;
>
>problem.

How often do C programmers make that mistake? Maybe I'm different, but I
don't think I've done it more than once, way back when I was new. Is it
*really* a problem, or is it just something that bad programmers trip over,
like tm_year?
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


------------------------------

Date: 23 Sep 1999 16:32:46 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: REQ: tell-a-friend script
Message-Id: <x7u2ol2wsx.fsf@home.sysarch.com>

>>>>> "AC" == Alan Curry <pacman@defiant.cqc.com> writes:

  >> Perl if/while/for constructs do not take other statements as targets.
  >> They take blocks.  This is critical.  Oterhwise you're back to the
  >> 
  >> while (1)
  >> do something;
  >> do something else;
  >> 
  >> problem.

  AC> How often do C programmers make that mistake? Maybe I'm different,
  AC> but I don't think I've done it more than once, way back when I was
  AC> new. Is it *really* a problem, or is it just something that bad
  AC> programmers trip over, like tm_year?

i HATE c's allowing naked blocks after if/while. i like the visual
separation of {} and not worrying about nesting and dangling, etc. i
think it is also prone to bugs when modifying code as well. so i always
use {} in c and i can't even write code without it. my fingers won't
type it. thanks to larry for fixing that abomination of syntax.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


------------------------------

Date: Thu, 23 Sep 1999 15:23:19 -0300
From: "R. Brockway" <rockie@apk.net>
Subject: taint/ENV{PATH}/pRPC
Message-Id: <37EA7017.4E3A75F8@apk.net>

I have a script being run from perl -wT and use strict; It is calling a
system command to execute an external program. ENV{PATH} =
"/bin:/usr/bin";  is set as well. This works fine in a standalone model:

#!/usr/bin/perl -wT
use 5.005;
use strict;

$ENV{PATH} = "/bin:/usr/bin";

my $username = "testacc";
my $o2 = `grep $username /etc/passwd`;
print "$o2\n";

I realize that there are perl functions to do this, but it is just a
test, the actual programs it will call are different.

Here's where it gets complicated:

The second phase is to make an RPC client/server and be able to do the
same thing. So, Client calls the internal Server function which goes and
does the grep and gives the server the username to grep for. all that
works fine, but it bombs out on the actual `grep $username /etc/passwd`.

HOWEVER, when I remove the -T, it works perfectly and returns to the
client the line in /etc/passwd, but ENV{PATH} = "/bin:/usr/bin"; is in
the script so that does not make any sense to me. Any ideas out there?
Thank you.

-rockie

Here's some code for the heck of it:

CLIENT:

#!/usr/bin/perl -wT
use 5.005;
use strict;

use IO::Socket();
use RPC::pClient;

$ENV{PATH} = "/bin:/usr/bin";

# Constants
my $MY_APPLICATION = "User_Mod";
my $MY_VERSION = 1.0;

my $username = "rockie";

# Connect to server
my $sock = IO::Socket::INET->new('PeerAddr' => 'remote box',
                                                'PeerPort' => 13000,
                                                'Proto' => 'tcp');
if (!defined($sock)) {
        die "Cannot connect: $!\n";
}

#Login Procedure
my $client = RPC::pClient->new('sock' => $sock,
                                'application' => $MY_APPLICATION,
                                'version' => $MY_VERSION);

if (!ref($client)) {
        die "Cannot create client: $client\n";
}

# Call remote function (get_user)

my @a = $client->Call("get_user", $username);
if ($client->error) {
        die "An error occured : $!\n";
} else {
        my $element;
        foreach $element (@a) {
                print "$element\n";
        }
}


SERVER:

#!/usr/bin/perl -wT
use 5.005;
use strict;

use IO::Socket();
use RPC::pServer;

$ENV{PATH} = "/bin:/usr/bin";

my $MY_APPLICATION = "User_Mod";
my $MY_VERSION = 1.0;


# Function get_user
sub get_user ($$@) {
        # take $username and grep from /etc/passwd
        my ($con, $ref, @args) = @_;
        my $username = shift @args;
        print "$username\n";
        my $get_user = `grep $username /etc/passwd`;
        print "$get_user\n";
        (1, $get_user);
}

# Function quit
sub quit ($$) {
        my($con, $ref) = @_;
        my ($runRef) = $ref->{'running'};
        $$runRef = 0;
        (1, "Bye!");
}

# Function server
sub server ($) {
        # process client requests, set up function table
        my ($con) = shift;
        my %funcTable;
        my ($running) = 1;

        # Create function table
        %funcTable = (
          get_user              => { code => \&get_user },
          quit                  => { code => \&quit,
                                        data => \$running },
        );

        $con->{'funcTable'} = \%funcTable;
        while ($running) {
          if (!$con->Loop()) {
            $con->Log('err', "Exiting\n");
            exit 10;
          }
        }
        $con->Log('notice', "Client quits.\n");
        exit 0;
}

# Main

{
my $sock = IO::Socket::INET->new('Proto' => 'tcp',
                        'Listen' => 3,
                        'LocalPort' => 13000
                        );

if (!defined($sock)) {
        die "Could not bind to port: $!\n";
}

while (1) {
        # add configFile to this next line eventually
        my $con = new RPC::pServer('sock' => $sock);
        if (!ref($con)) {
                die "Cannot Create Server!: $con\n";
        } else {
                if ($con->{'application'} ne $MY_APPLICATION) {
                        $con->Deny("This is a USER_MOD Server, Go
Away");
                } elsif ($con->{'version'} > $MY_VERSION) {
                        $con->Deny("Sorry, but this is version
$MY_VERSION");
                } else {
                        # OK, accept the client, spawn child
                        my $pid = fork();
                        if (!defined($pid)) {
                                $con->Deny("Cannot fork: $!");
                        } elsif ($pid == 0) {
                                $con->Accept("Your Client is Accepted");

                                &server($con);
                        }
                }
        }
}
}



------------------------------

Date: Thu, 23 Sep 1999 12:52:03 -0700
From: Tim Diller <t.dillerNOnlSPAM@xpres.com>
Subject: Re: taint/ENV{PATH}/pRPC
Message-Id: <0eeed401.1e8604f9@usw-ex0108-057.remarq.com>

Hi!

It blows with the -T option because the $username variable 
is tainted and therefore can't be used to affect anything 
outside of your script.  

If you man perlsec and do a search for the word 'taint' it 
will give you some help.

Tim


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



------------------------------

Date: Fri, 24 Sep 1999 04:55:05 +0930
From: spamfree@metropolis.net.au (Henry Penninkilampi)
Subject: Re: You should be admired
Message-Id: <spamfree-2409990455060001@d6.metropolis.net.au>

In article <xkfwvthijvj.fsf@valdemar.col.hp.com>, Eric The Read
<emschwar@rmi.net> wrote:

> Perhaps because the FAQ is already included with the standard Perl
> documentation-- the very same documentation which is itself included with
> every Perl distribution for the last couple of years?  If you've got
> Perl, you've got the FAQ.  Contrariwise, if you don't have the FAQ, you
> don't have Perl.

Ah, but as society commodifies (?) the Internet (turns Internet access
into a commodity item), and some programming languages with it, people
will be less and less inclined to RTFM.  Just like all other commodity
items, you only refer to the manual when _something_goes_wrong_.  That
means that this problem will only get worse.

:^(


> Besides which, have you looked at the FAQ lately?  It's bloody huge.

The bigger (and more useful) the manual, the less likely it is that anyone
will ever read it.

:^(


> While that makes it a kickass reference that people ought to consult
> before posting (dammit), it also makes it impractical to email to
> everyone-- especially since they should already have it.

Would it even be worth extracting an extremely pertinent section or two?

henry.


------------------------------

Date: Fri, 24 Sep 1999 05:16:01 +0930
From: spamfree@metropolis.net.au (Henry Penninkilampi)
Subject: Re: You should be admired
Message-Id: <spamfree-2409990516010001@d6.metropolis.net.au>

In article <37EA6BA0.BD522A56@chaos.wustl.edu>, elaine@chaos.wustl.edu wrote:

> Are there fewer women in Perl as opposed to the rest of technology? From
> observation, yes though I haven't any statistical proof. Look around the
> newsgroups, the conferences, Perl Monger meetings, in your own
> workplace. We would seem to be a very scarce commodity even if only by
> nickname. The question though is why. 

How about:

"Hell, if I'm going to be a nerd I may as well go the whole hog and learn
to program in the meanest, most powerful language there is - C dammit -
and actually be able to get a job programming in the bargain.  No point
messing around with some namby-pamby scripting (ick) language that doesn't
give you street cred or let you rake in the big bucks!"

?

I wouldn't be surprised if there is a disproportionate swing away from
scripting languages as a whole, towards the 'real' programming languages.

Maybe the social cost is so high that those women who do want to program
think "in for a penny, in for a pound" and then dive right in the deep
end?

I don't know.  This is all pure speculation.  Personally, I only know two
female programmers and they are both into frighteningly hardcore C/C++. 
Not statistically significant, by any stretch of the imagination, but it's
two data points you can use...

Henry.


------------------------------

Date: Thu, 23 Sep 1999 16:37:38 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: You should be admired
Message-Id: <37EA8EAE.A8327940@chaos.wustl.edu>

Henry Penninkilampi wrote:

> I wouldn't be surprised if there is a disproportionate swing away from
> scripting languages as a whole, towards the 'real' programming languages.

Them's fightin' words in these here parts son. Perl is a 'real'
programming language.

> Maybe the social cost is so high that those women who do want to program
> think "in for a penny, in for a pound" and then dive right in the deep
> end?

To be sure, I have met more pedantic pain in the ass people in Perl than
I have anywhere else, but maybe I'm sick, I find that I like most of
them. There is a lot more to the average Perl person than any other type
of geek I've known.

> I don't know.  This is all pure speculation.  Personally, I only know two
> female programmers and they are both into frighteningly hardcore C/C++.
> Not statistically significant, by any stretch of the imagination, but it's
> two data points you can use...

Well, Perl people span a lot of different types of work so 'programmers'
isn't a restriction I want to apply. I just want to know why so few
women seem to willing to be an active or even benign part of the
community. 

e.


------------------------------

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 892
*************************************


home help back first fref pref prev next nref lref last post