[9973] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3567 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 27 18:03:22 1998

Date: Thu, 27 Aug 98 15:01:29 -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           Thu, 27 Aug 1998     Volume: 8 Number: 3567

Today's topics:
    Re: Perl compiler (John Stanley)
    Re: Perl Docs.. forget the original post (Author) <jdporter@min.net>
    Re: Please Help Me With A RegX. (Patrick Timmins)
    Re: Q: getting core dump from perl, maby problem with f <rootbeer@teleport.com>
        Random Numbers in Range? <stepherd@gusun.georgetown.edu>
    Re: Random Numbers in Range? (Larry Rosler)
    Re: Random Numbers in Range? (Matt Knecht)
    Re: Random Numbers in Range? (Karlon West)
    Re: When using CGI.pm to upload file I get extraneous d (Robert Watkins)
    Re: Which perl for win32 (Windows NT)? (Brian Jepson)
    Re: Y2K Date Support mee@mine.com
    Re: Y2K Date Support (Craig Berry)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 27 Aug 1998 21:26:58 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Perl compiler
Message-Id: <6s4iv2$6t6$1@news.NERO.NET>

In article <oziF1.51$V5.373521@shore>,
Nathan V. Patwardhan <nvp@shore.net> wrote:
>John Stanley (stanley@skyking.OCE.ORST.EDU) wrote:
>
>: I have a really cool new server that has a whole computer that does
>: nothing but monitor the rest of the server. It wants a password before
>: it will let me get to the data. 
>
>So why can't the "operator" login to the machine by themselves and
>grab the data?  

Maybe the confusion is because you deleted the part where I said I
wanted to log the data.

I can log in to the machine and get the data myself, but I want the
data every five minutes. That's why I wrote a script to connect and get
it automatically. Actually, the first version connected every five
minutes. The second version connects once and asks every five minutes.
It does need the password when it first connects, and that can happen
at 3 AM. 

>Or why can't the program ask the person who's running
>it for a password?  

It could. But 1) if nobody is here at 3 AM, how do I keep from losing
data while it waits until someone is here, and 2) since this is run by
cron, which tty should it print its prompt to? 

You see, one of the important bits about logging this data is that I
can see if things are working correctly while I am not here to observe
them myself. If I am not here to observe them, I am not here to enter a
password.

>Why is hardcoding of a password necessary?

Because the other end wants a password and the task has to be
accomplished, and there is nobody around at the moment to type one in.

>: I need tide data on a daily basis. The dialup tide guage wants a
>: password.
>
>See above.

"Above" applies even less. This task ALWAYS takes place at 3 AM.  I
have no control over the tide guage. I am not going to come into work
at 3 AM every day of the year just to enter a password for the tide
guage, and if I collect the data during the day it interferes with
other user of the data.

>: Now put all three examples in the user's context, where chown doesn't
>: work. 
>
>You meant chmod, I think, 

No, I meant chown. Chmod works fine in the user's context, at least on
the systems I use. "Make the script setuid and put the password in a
file readable only by the destination uid" is the closest to a viable
solution I have heard. Sorry, but users cannot make scripts setuid to
anything but themselves, and if someone has broken in as them and they
can read the script, they will be able to read the password.

>and the issue was whether or not someone
>should be hardcoding cleartext passwords.  And you didn't address
>*why* the password needed to be hardcoded for each of these examples.

Here's the context of my examples:

]>Russ Allbery (rra@stanford.edu) wrote:
]>: While I generally agree with this, it's also the case that sooner or later
]>: you'll have to do that or the equivalent, just because sooner or later
]>: you'll need to deal with a password-authenticated system on an automated
]>: basis.
]>
]>Using the terms password-authenticated and automated in the same
]>sentence concerns me.
]>
]>Could you give a non-web example?

The examples I gave are all non-web, automated, password-authenticated
tasks.  Your questions suggest that you forgot the part about it being
automated -- the operator isn't there to log in and grab the data
himself, he has programmed the computer to do it automatically. The
person who is "running the program" is not sitting at the terminal
ready to enter a password, he is at home asleep.

Now, what way, other than hardcoding the password, can you think of to
accomplish these tasks? The only ones I can think of all result in a
hardcoded password appearing somewhere, or the equivalent. (E.g., the
password used to decrypt the password appears; the hardcoded algorithm
to decode the encrypted password is readable; no password at all, which
makes the login name function as both login name and password.)



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

Date: Thu, 27 Aug 1998 15:59:02 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl Docs.. forget the original post (Author)
Message-Id: <35E5BA86.2F6D@min.net>

Charles Maier wrote:
> 
> John Porter wrote:
> >
> > Simon Wistow wrote:
> > >
> > > > Simon Wistow wrote:
> > > > >
> > > > > Some of us with window boxes don't have grep either (now there's an
> > > > > idea, hmmmm);
> > > >
> > > > So what. Don't you have "Find: Files or Folders..." ???
> > >
> > > Yeah, but that doesn't work exactly like grep does, does it?
> >
> > No, but does it need to?  You can still search for specific text,
> > which is sufficient 93% of the time.
> 
> This just is not true. FIND: Files or Folders..." will find FILENAMES
> that match the argument.

Care to put a little money where your mouth is, monkey boy?

-- 
John Porter


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

Date: Thu, 27 Aug 1998 20:49:05 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Please Help Me With A RegX.
Message-Id: <6s4go1$9nl$1@nnrp1.dejanews.com>

In article <6s44us$oh6$1@nnrp1.dejanews.com>,
  chad@gurucom.net wrote:
>
>
> Hi,
>
> Ok, I have 1 big long line and in that line there are many occuances of this
>
> <li><a href="Employment/"><b>Employment</b></a><em>
>
> I want to get everything from the <li> to the <em>, how might I go about this?
>
> Thanks,
>
> -chad

You're right ... I would use a regex too:

I'd probably nest it in a couple of 'while' loops, and use a non-greedy
modifier on a 'one or more of any character' set between the two tags you
mentioned, all captured in the $1 of the 'g' modified said pattern, which
then gets repeatedly pushed to an array (or printed or something).

or maybe:

while (<>) {
  while ( /(<li>.+?<em>)/g ) {push @arr, $1;}
}

or maybe you want /<li>.+<em>/ , but I doubt it.

also take a look at:
perldoc perlre
Mastering Regular Expressions (Jeffrey Friedl, O'Reilly & Assoc. Pub.)
Programming Perl (Wall, Christiansen, Schwartz, O'Reilly & Assoc. Pub.)

Reading Friedl's book, in particular, means you won't have to worry about
this sort problem again.

Patrick Timmins
U. Nebraska Medical Center

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 27 Aug 1998 21:00:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Q: getting core dump from perl, maby problem with fork() ?
Message-Id: <Pine.GSO.4.02A.9808271356200.4382-100000@user2.teleport.com>

On Thu, 27 Aug 1998 dow.jones@home.se wrote:

> I'm getting a core dump from my perl program when I'm running it frow
> a browser (I can't run it from the command line by the way).

Why can't you? Does it dump core? :-)

> Is there anyway to find out why I get the core dump?

Sure; that's what cores are for! But if perl is dumping core, that's
probably a bug in perl itself or in the system library routines which it
calls. OTOH, if it's some program that you're calling from perl, that's
another matter. If you're interested in debugging perl or that other
program, get gdb (or equivalent) and have fun exploring.

My guess is that you're forking too many large processes and running out
of memory, but it's just a guess. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 27 Aug 1998 16:00:29 -0400
From: Dave Stephens <stepherd@gusun.georgetown.edu>
Subject: Random Numbers in Range?
Message-Id: <35E5BADD.FEB21FF3@gusun.georgetown.edu>

Okay,

if

    srand;
    $line = int (rand (10) + 1);
    print $line;

gives you a random number from 1 to 10. How do you generate
random numbers in a range. . .  like 97 to 122?

Okay, so I suck at math.

Thanks.

--Dave Stephens





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

Date: Thu, 27 Aug 1998 13:15:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Random Numbers in Range?
Message-Id: <MPG.104f5e2ec5730683989802@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <35E5BADD.FEB21FF3@gusun.georgetown.edu> on Thu, 27 Aug 1998 
16:00:29 -0400, Dave Stephens <stepherd@gusun.georgetown.edu> says...
 ...
>     $line = int (rand (10) + 1);
>     print $line;
> 
> gives you a random number from 1 to 10. How do you generate
> random numbers in a range. . .  like 97 to 122?
> 
> Okay, so I suck at math.

Can you add?  97 instead of 1 in your own example?  Hmmm...

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


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

Date: Thu, 27 Aug 1998 20:30:04 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Random Numbers in Range?
Message-Id: <gljF1.12$nb7.127537@news3.voicenet.com>

Dave Stephens <stepherd@gusun.georgetown.edu> wrote:
>How do you generate
>random numbers in a range. . .  like 97 to 122?

$num = rand_range(97 => 122);

sub rand_range
{   
    my $lo = shift || 0;
    my $hi = shift || 1;

    ($hi, $lo) = ($lo, $hi) if $hi <=> $lo;
    
    sprintf '%.0f', rand($hi - $lo) + $lo;
}

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: 27 Aug 1998 20:27:04 GMT
From: karlon@bnr.ca (Karlon West)
Subject: Re: Random Numbers in Range?
Message-Id: <6s4feo$jni@crchh14.us.nortel.com>

Dave Stephens (stepherd@gusun.georgetown.edu) wrote:
> Okay,

> if

>     srand;
>     $line = int (rand (10) + 1);
>     print $line;

$line = int (rand (122-97+1) + 97);


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

Date: 27 Aug 1998 21:50:51 GMT
From: r-watkinsNOSPAM@worldnet.att.net (Robert Watkins)
Subject: Re: When using CGI.pm to upload file I get extraneous data
Message-Id: <6s4kbr$pl2@bgtnsc02.worldnet.att.net>

In article <MPG.104f52068bb34d3a989801@nntp.hpl.hp.com>, lr@hpl.hp.com (Larry Rosler) wrote:
>In article <6s46t5$bnh@bgtnsc02.worldnet.att.net> on 27 Aug 1998 18:01:09 
>GMT, Robert Watkins <r-watkinsNOSPAM@worldnet.att.net> says...
>....
>> My guess is that it has to do with \r's and \n's and writing the file under an 
>> NT filesystem, but I don't know what the solution is.
>
>Your guess is correct.  `perldoc -f binmode`.  Use it for each of the files.
>
Okay, so I changed
        while (<$uploadedfile>) {
                print NEWPDF;
        }
to
        binmode $uplaodfile;
        while (read $uploadfile, $buffer, 1024) {
                print NEWPDF $buffer;
        }
but I STILL get extraneous data in the PDF file.

HELLLLP!
 -- Robert
                


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

Date: 27 Aug 1998 20:07:41 GMT
From: bjepson@ids.net (Brian Jepson)
Subject: Re: Which perl for win32 (Windows NT)?
Message-Id: <slrn6ubf69.22t.bjepson@gelvis.ids.net>

On Thu, 27 Aug 1998 17:18:55 GMT, Louie <louie@visca.com> wrote:
>mepstein@staff.uiuc.edu (Milt Epstein) wrote:
>
>>
>>OK, I've read what FAQs I could find, and I've checked out a bunch of
>>previous threads at dejanews, but I'm still confused.
>>
>>I'm trying to determine which version of perl to install on my Windows
>>NT machine. 
>
>My recommendation, for what it's worth (newbie-intermediate), is the
>GS Perl. ActivePerl is not in compliance with the standard Perl. The
>directory tree is a mess. Modules are very difficult to install.
>

[...]

As of 5.005, ActivePerl deals with a lot of these issues - you can use
Visual C++ to install modules by hand, or you can choose from many
precompiled modules and extensions using PPM.  I don't know if you can
build modules by hand using other C compilers.

ActivePerl is based on the core Perl sources, and should be in total
compliance with standard Perl (with the exception of embedding issues
related to the Perl Object API - these issues will be dealt with).

If there are any remaining differences, I expect Gurusamy Sarathy (the GS
in GSPerl) will continue to work closely with ActiveState, as he has done
over the course of the oneperl effort.

Disclaimer: I worked with ActiveState on the Perl Resource Kit, and I am
currently working with them on another project, so I'm not able to offer a
totally impartial opinion...

Cheers,

-- 
Brian Jepson * (bjepson@ids.net)  * http://users.ids.net/~bjepson
              Choosy mothers choose to chew Chew-Z


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

Date: Thu, 27 Aug 1998 20:08:59 GMT
From: mee@mine.com
Subject: Re: Y2K Date Support
Message-Id: <1103_904248539@porcupine>

Having just emerged from the cave I would appreciate someone enlightening me on that propaganda that Perl does not have the Y2K problem.

Back in the cave, ANY language, system or app that does not mean YEAR 0  when it sez "YEAR is 0" is bound to mess up something sooner or later.

Mee


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

Date: 27 Aug 1998 21:10:27 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Y2K Date Support
Message-Id: <6s4i03$5i$1@marina.cinenet.net>

mee@mine.com wrote:
[please wrap your lines at <80 chars; 72 is traditional.]

: Having just emerged from the cave I would appreciate someone
: enlightening me on that propaganda that Perl does not have the Y2K
: problem. 
:
: Back in the cave, ANY language, system or app that does not mean YEAR 0
: when it sez "YEAR is 0" is bound to mess up something sooner or later. 

Well, then, Perl is safe; it means "Year 1900" when it says "Year is 0."
See the doc on localtime.  (And note that actually, the year 1900 can't be
represented by time_t at 32 bits, but the principle remains.)

Summary:  Perl itself is "y2k safe," whatever that means for a language. 
Perl programs can be as y2k-bug-ridden as their authors choose to make
them. 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

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

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