[17100] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4512 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 3 21:10:29 2000

Date: Tue, 3 Oct 2000 18:10:18 -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: <970621818-v9-i4512@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 3 Oct 2000     Volume: 9 Number: 4512

Today's topics:
        problems to install perl module <bpan99@yahoo.com>
    Re: Sendmail/Perl question <aslay@ucsd.edu>
    Re: Sendmail/Perl question (Martien Verbruggen)
    Re: some questions <jeffp@crusoe.net>
    Re: some questions <anmcguire@ce.mediaone.net>
    Re: some questions <lr@hpl.hp.com>
    Re: some questions <zoo.tv@btinternet.com>
    Re: some questions (Craig Berry)
    Re: some questions (Jerome O'Neil)
        SSL with HTTP::Request::Common qw(POST) ? irf@netexecutive.com
        Strange behavior with DESTROY and END sh_kell@my-deja.com
    Re: tranferring a file on remote host mweatherford@aventail.com
    Re: What's the differences between perl4 and perl5 <godzilla@stomp.stomp.tokyo>
    Re: What's the differences between perl4 and perl5 <godzilla@stomp.stomp.tokyo>
    Re: What's the differences between perl4 and perl5 <harrisr@bignet.net>
        Win32API::File [was: WinewAPI::File] <elephant@squirrelgroup.com>
    Re: Windows Event Log Module???? Anyone?? <elephant@squirrelgroup.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 3 Oct 2000 18:02:59 -0500
From: "Bo Pan" <bpan99@yahoo.com>
Subject: problems to install perl module
Message-Id: <MxtC5.54$r4.1814@client>

Hello,
I am trying to install XML:Parser on my SGI machine, (IRIX 6.5).  As I
do not have cc compiler,
I installed gcc. But when ever I try 'perl Makefile.PL', makefile
generated still uses cc as
compiler, and CFlag includes -n32, mip3, etc.
What should I do to make the Makefile use gcc?
Thanks in advance.

--
Bo Pan




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

Date: Tue, 03 Oct 2000 16:01:50 -0700
From: Rip Curl <aslay@ucsd.edu>
Subject: Re: Sendmail/Perl question
Message-Id: <39DA655D.EFCDBF3C@ucsd.edu>

Hey,

    First of all, I looked in the sendmail bat book, sendmail man pages, the perl
book, and perl docs and I don't see them claiming what I suggested is a security
risk.  All I have to go on is what Brad wrote.  So either I have the choice of
blindly agreeing with his statement or it's not that much of a security risk to
even mention!  So does that make every document I read, "part of the problem".
Second, there's pratically hundreds of security risks besides what I wrote down
(if it is in fact one!). What am I gonna do?  Explain them all??  Since you
reverted to attacking my posting style (ouch, that hurt), you can't be all that
intelligent.  Welcome to my world.  Oh, I all most forgot to mention, since you
didn't ask about it, leaving your door open at night is a security risk.... I
would give you more but there's just too damn many.  Sorry.


"Alan J. Flavell" wrote:

> On Tue, 3 Oct 2000, Rip Curl jeopardized:
>
> > ?????
> > Oh no you didn't... This wasn't directed at me right??  Cause nowhere in the
> > original post did they mention security.
>
> If you don't understand that there is a security issue involved, and
> won't admit it even when it's pointed out, then any advice from you is
> even more dangerous than at first appeared.
>
> Fortunately, you're still posting upside-down, which is an almost
> sure-fire warning alarm around here.



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

Date: Tue, 03 Oct 2000 23:20:34 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Sendmail/Perl question
Message-Id: <slrn8tkqe1.64u.mgjv@verbruggen.comdyn.com.au>

[fixed jeopardy-posting style. PLEASE stop doing that. The commonly
accepted quoting style here, and on most of Usenet, is to quote
material first, and to put your reply after it. Mixing the two makes
posts unreadable. Also, wrap your lines at 72 characters, or
thereabouts]

On Tue, 03 Oct 2000 16:01:50 -0700, Rip Curl <aslay@ucsd.edu> wrote:
> 
> "Alan J. Flavell" wrote:
> 
> > On Tue, 3 Oct 2000, Rip Curl jeopardized:
> >
> > > ?????  Oh no you didn't... This wasn't directed at me right??
> > > Cause nowhere in the original post did they mention security.
> >
> > If you don't understand that there is a security issue involved,
> > and won't admit it even when it's pointed out, then any advice
> > from you is even more dangerous than at first appeared.
> >
> > Fortunately, you're still posting upside-down, which is an almost
> > sure-fire warning alarm around here.
> 
> Hey,
> 
> First of all, I looked in the sendmail bat book, sendmail man pages,
> the perl book, and perl docs and I don't see them claiming what I
> suggested is a security risk.  All I have to go on is what Brad
> wrote.

Let's demonstrate it. Your suggestion is to pass variables on the
command line to sendmail, with a construct like:

open(MAIL,"|sendmail -t $email_addrs");

apart from the erroneous -t (didn't your books tell you what that
does?) What happens if 

$email_addrs = '; rm -rf /'; # [1]

? Do you know? Do you see now why it is dangerous to do that sort of
thing?

And you don't only have what Brad wrote. www.deja.com, even in its
curent stripped down state, still has numerous posts about this.
You're not the only person who did this wrong. Instead of taking it so
personally, you should try to learn. Open your mind.

# perldoc perlsec

> Second, there's pratically hundreds of security risks besides what I
> wrote down (if it is in fact one!).

None that are a direct result of code that you provided, that are
easily fixed, and that are discussed here a few times every month.

>             Since you reverted to attacking my posting style (ouch,
> that hurt), you can't be all that intelligent.

Non sequitur.

>                                                 Welcome to my world.

And byebye from mine. *plonk*

> Oh, I all most forgot to mention, since you didn't ask about it,
> leaving your door open at night is a security risk.... I would give
> you more but there's just too damn many.  Sorry.

But you didn't open my door, did you? You _did_ open that other
security risk that people were talking about. Just give up and listen.
You might actually learn something.

Martien

[1] Do NOT try this to find out what happens. It is destructive.
-- 
Martien Verbruggen              | 
Interactive Media Division      | Think of the average person. Half of
Commercial Dynamics Pty. Ltd.   | the people out there are dumber.
NSW, Australia                  | 


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

Date: Tue, 3 Oct 2000 18:28:06 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: some questions
Message-Id: <Pine.GSO.4.21.0010031827120.14163-100000@crusoe.crusoe.net>

[posted & mailed (or tried)]

On Oct 3, jonrasm@my-deja.com said:

>foreach $line (@line)
>  {
>  $line =~ tr/\"/ /;
>  }
>
>How can I remove " without leaving a space?

Learn about the 'd' modifier to tr///

  tr/"//d;

>$#scores = -1;
>
>Is there another way of doig it?

Yes.  Personally speaking, I'd use @array = ().

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: Tue, 3 Oct 2000 17:39:45 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: some questions
Message-Id: <Pine.LNX.4.21.0010031736390.7823-100000@hawk.ce.mediaone.net>

On Tue, 3 Oct 2000, jonrasm@my-deja.com quoth:

> 1. Removing characters from string
> ************************************
> I am trying to remove some characters from
> strings by using:
> 
> foreach $line (@line)
>   {
>   $line =~ tr/\"/ /;
>   }
> 
> This results in replacing " with space.
> How can I remove " without leaving a space?

$line =~ tr/"//d;

> 2. Empty an array
> *****************
> I am currently using
> 
> $#scores = -1;
> 
> to empty the array @scores.
> 
> Is there another way of doig it?

Assign it the empty list:

@array = ();

HTH.

anm
-- 
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$'



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

Date: Tue, 3 Oct 2000 15:50:49 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: some questions
Message-Id: <MPG.144402a5432fa38598adfd@nntp.hpl.hp.com>

[In the future, you would be better served by using one post per 
question, and making the Subject relate to the speicif question.]

In article <8rdis9$g1f$1@nnrp1.deja.com> on Tue, 03 Oct 2000 21:25:38 
GMT, jonrasm@my-deja.com <jonrasm@my-deja.com> says...
> 1. Removing characters from string
> ************************************
> I am trying to remove some characters from
> strings by using:
> 
> foreach $line (@line)
>   {
>   $line =~ tr/\"/ /;
>   }
> 
> This results in replacing " with space.
> How can I remove " without leaving a space?

By reading the documentation (`perldoc perlop`).

    tr/"//d for @line;

> 2. Empty an array
> *****************
> I am currently using
> 
> $#scores = -1;
> 
> to empty the array @scores.
> 
> Is there another way of doig it?

  @scores = ();

Others may say:

  undef @scores;

But recent discussion indicates there is no particular merit in that.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 4 Oct 2000 00:57:43 +0100
From: <zoo.tv@btinternet.com>
Subject: Re: some questions
Message-Id: <8rdrv4$r87$1@plutonium.btinternet.com>


<jonrasm@my-deja.com> wrote in message news:8rdis9$g1f$1@nnrp1.deja.com...
> I am trying to remove some characters from
> strings by using:
>
> foreach $line (@line)
>   {
>   $line =~ tr/\"/ /;
>   }

Use s/// for this.

foreach (@line) {
  s/\"//g;
}

=) Pete





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

Date: Wed, 04 Oct 2000 00:05:53 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: some questions
Message-Id: <stkt31lp8r990d@corp.supernews.com>

jonrasm@my-deja.com wrote:
(a bunch of questions in one post)

You should limit yourself to one question per post, and give each a
relevant subject.

: I am trying to remove some characters from strings by using:
:   $line =~ tr/\"/ /;

That \ probably isn't doing what you think it is.  If you just want to
operate on ", you don't need it.  " isn't special in this context.

: This results in replacing " with space. How can I remove " without
: leaving a space?

  tr/"//d;

: I am currently using
: $#scores = -1;
: to empty the array @scores.  Is there another way of doig it?

Many, but most people would tend to use

  @scores = ();

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Quidquid latine dictum sit, altum viditur."
   |


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

Date: Wed, 04 Oct 2000 00:11:13 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: some questions
Message-Id: <BAuC5.2538$Tx3.241940@news.uswest.net>

<zoo.tv@btinternet.com> elucidates:
> 
> <jonrasm@my-deja.com> wrote in message news:8rdis9$g1f$1@nnrp1.deja.com...
>> I am trying to remove some characters from
>> strings by using:
>>
>> foreach $line (@line)
>>   {
>>   $line =~ tr/\"/ /;
>>   }
> 
> Use s/// for this.

Why?  It's much, much slower.

Larry will be along any minute and explain why.

What he needs to do is remove the \.  It's not DWOPM.

-- 
"Civilization rests on two things: the discovery that fermentation 
produces alcohol, and the voluntary ability to inhibit defecation.  
And I put it to you, where would this splendid civilization be without 
both?" --Robertson Davies "The Rebel Angels" 


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

Date: Wed, 04 Oct 2000 00:10:27 GMT
From: irf@netexecutive.com
Subject: SSL with HTTP::Request::Common qw(POST) ?
Message-Id: <8rdshe$o49$1@nnrp1.deja.com>

Hello, I am trying to write a script that submits a form to
a secure server. below is the code im trying to use:

  use HTTP::Request::Common qw(POST);
  use LWP::UserAgent;
  $ua = LWP::UserAgent->new();
  my $req = POST 'https://mymerchant.com', \@params;
  $content = $ua->request($req)->as_string;

unfortunately, $content ends up being :
"501 (Not Implemented) Protocol scheme 'https' is not supported"

Admittedly, I am not familiar with libwww - any suggestions please?
Thanks
irfan


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 03 Oct 2000 23:31:47 GMT
From: sh_kell@my-deja.com
Subject: Strange behavior with DESTROY and END
Message-Id: <8rdq93$m5g$1@nnrp1.deja.com>

Ok, I have run into an interesting situation within a simple Test.pm
using a test.pl to run it (Perl 5.005_03; Redhat Linux 6.0). It seems
that depending on how I instantiate the object it affects the order of
execution of the DESTROY and END blocks. It was my understanding that
END{ } was ALWAYS executed right before program exit.

Now what I am seeing is that if I do:

$obj = new Test;

Then END is called before DESTROY

If I do:

my $obj = new Test;

then it executes in what is suppose to be the proper order... DESTROY
then END

I am just wondering if this is suppose to occur as such, is a bug in
Perl itself, is a bug in OS/Perl combo, or I messed something up?

----------------------------------------------------------------------
Test.pm
----------------------------------------------------------------------

package Test;

BEGIN{
    print __PACKAGE_, " BEGIN\n";
}


sub new(){
    my $class = shift;
    my $self = bless {}, ref($class) || $class;
    print __PACKAGE__, " NEW\n";
    return $self;
}


DESTROY{
    print __PACKAGE__, " DESTROY\n";
}


END{
    print __PACKAGE__, " END\n";
}

1;
----------------------------------------------------------------
test.pl
---------------------------------------------------------------

use Test;

$test = new Test;

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

THis gives output of:

Test BEGIN
Test NEW
Test END
Test DESTROY

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

Change to:

my $test = new Test;

and output is:

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

Test BEGIN
Test NEW
Test DESTROY
Test END


Any insight into this would be greatly appreciated. Thank you.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 03 Oct 2000 15:37:18 -0700
From: mweatherford@aventail.com
Subject: Re: tranferring a file on remote host
Message-Id: <nnnkts430tm32nnfqb2l5cvspafbe083ha@4ax.com>

On Thu, 14 Sep 2000 11:32:33 GMT, pscola@tiscalinet.it (Paolo) wrote:

>Hi everibody.
>
>I would know how it is possible 
>to transfer a file ( locally generated )
>on a remote host,  only using perl libraries. 
>
>Thanks in advance for your help, 
>regards.
>
>Paolo
>
>
>PS:
>a possible reply will be appreciated also at:
>paolo_scola@rcm.inet.it


Yes, transferring a file from the current host to a remote 
host is a problem commonly solved by the "Net::FTP" 
module in PERL.

Simple example:

! /usr/local/bin/perl

use Net::FTP;
$local_filename = "somedamnfile.data";
$host = "remotehostname";
$username = "myusername";
$password = "passwordhere";
$remote_filename = "someotherfilename.data";

$ftp = Net::FTP->new($host, Debug => 0)
   or die "Couldn't connect to $host\n";

$ftp->login($username, $password)
   or die "Couldn't log in to $host\n";

# $ftp->put(*STDIN, $remote_filename)
$ftp->put($local_filename, $remote_filename)
   or die "Couldn't send to $host $remote_filename\n";

$ftp->quit();



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

Date: Tue, 03 Oct 2000 15:05:45 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: What's the differences between perl4 and perl5
Message-Id: <39DA5839.47075DFE@stomp.stomp.tokyo>

Randall L. Schwartz wrote:
 
> > Otto the Auto Pilot wrote:
 
> > ... restricted to use perl4. 

> Knowledge of the differences between perl4 and perl5 is no longer a
> marketable skill.  It was, about 3 to 5 years ago.  There's a
> particularly vocal person in this newsgroup who is still living in
> that past, so pay no attention to some of the responses you get from
> email addresses to which you cannot successfully reply. :-)


My spider sense is tingling.

Godzilla!


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

Date: Tue, 03 Oct 2000 15:14:15 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: What's the differences between perl4 and perl5
Message-Id: <39DA5A37.1E0025D0@stomp.stomp.tokyo>

Elaine Ashton wrote:
 
> Randall L. Schwartz wrote:
> > Otto the Ottoman wrote:


Perl 4 rocks my socks off!


> > There's a particularly vocal person in this newsgroup who is 
> > still living in that past, so pay no attention to some of the
> > responses you get from email addresses to which you cannot 
> > successfully reply. :-)

> I leave for 3 months only to see the same thing when I come back. It's
> pathetic and I only hope I live long enough to see it finally end.


Perhaps when these boys reach a maturation age lending
to their successful potty training?


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: Tue, 3 Oct 2000 20:49:03 -0400
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: What's the differences between perl4 and perl5
Message-Id: <stkvir98pcur13@corp.supernews.com>


Randal L. Schwartz <merlyn@stonehenge.com> wrote in message
news:m1bsx1fwf6.fsf@halfdome.holdit.com...
> >>>>> "Otto" == Otto Wyss <otto.wyss@bluewin.ch> writes:
>
> Otto> I have to fix a perl-script and are restricted to use perl4.
What are
> Otto> the restrictions between those versions and are they anywhere
> Otto> documented?
>
> Perl4 is what people use when they don't know the difference.
>

Or, when they need to use what comes "out of the box."

# cat perl.ver
#!/usr/bin/perl -w
system "uname -sr";
print "$]\n";

# ./perl.ver
HP-UX B.11.00
$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36

Randy


> All versions of perl prior to 5.004 are known to have demonstrable
> security errors (at least buffer overflows).
>
> Knowledge of the differences between perl4 and perl5 is no longer a
> marketable skill.  It was, about 3 to 5 years ago.  There's a
> particularly vocal person in this newsgroup who is still living in
> that past, so pay no attention to some of the responses you get from
> email addresses to which you cannot successfully reply. :-)
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!




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

Date: Wed, 4 Oct 2000 10:21:10 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Win32API::File [was: WinewAPI::File]
Message-Id: <MPG.144523003c0372f59897e9@localhost>

J Joseph Yusko wrote ..
>Objective: to access the remote machine's file with permission rights
>
>Problematic:  Can't access a remote machine.  No problem with local file
>permission.
>
>Solution: Shoot myself?

show a short example of the problem that you're having - paying 
particular attention to describing your expected results - and the 
result that you're actually getting

also .. explain your network setup - ie. are you attempting to access 
said files across a Win32 network share ? .. or have you mapped a drive 
? .. more details

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 4 Oct 2000 10:11:09 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Windows Event Log Module???? Anyone??
Message-Id: <MPG.144520a6802d80089897e8@localhost>

hallian@hotmail.com wrote ..
>I need to grab a WindowNt/Window2000 event logs to a centralized
>console.  So, is here a Windows Event Log module in PERL.  Or something
>similar!!!

for this an all other queries that follow the pattern "is there a module 
that does [action] ?" there are two excellent options available to you

first .. CPAN .. go to

  http://search.cpan.org/

and type in the contents of the [action] placeholder .. it takes a 
little getting used to .. but you will often find success using the 
'Documentation' selection in the drop-down

by selecting 'Documentation' and then typing 'event log' you will get 
your answer (see the Help link on that web page for more details on 
using the search tool)

you can also try using the PPM search facility (see your documentation 
for how to use that) but I prefer CPAN

once you've located your desired module - definitely switch to PPM to 
install it .. installing a module is (usually) as simple as typing the 
following at a command prompt

  ppm install module-name

-- 
  jason -- elephant@squirrelgroup.com --


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

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


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