[10094] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3687 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 10 21:07:36 1998

Date: Thu, 10 Sep 98 18:00:19 -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, 10 Sep 1998     Volume: 8 Number: 3687

Today's topics:
    Re: Automate change of remote user's password <oldno7@home.com>
    Re: Change NT IP Address Using Perl (Gregory Spath)
        Danish FXE tcd@post10.tele.dk
    Re: Design by Contarct Seminar Series (Tad McClellan)
    Re: Design by Contarct Seminar Series (Larry Rosler)
    Re: Detecting one character in a Form Field (Tad McClellan)
    Re: Graphs (Danny Aldham)
        How to do the background work in NT system !? (James  Bond  098)
        Localizing $_ (John Siracusa)
    Re: Localizing $_ <tchrist@mox.perl.com>
    Re: Localizing $_ (John Siracusa)
    Re: Not Spam! [was: For Sale: O'Reilly Perl Resource Ki (Andre L.)
        passing variables <btm9003@rit.edu>
    Re: Perl & Java - differences and uses <borg@imaginary.com>
    Re: Perl & Java - differences and uses <borg@imaginary.com>
    Re: Perl & Java - differences and uses <borg@imaginary.com>
    Re: Perl & Java - differences and uses <borg@imaginary.com>
        Perl on Domino Go <carlking@freewwweb.com>
        printf,sprintf padding character <travis.cox@itron.com>
    Re: printf,sprintf padding character (Craig Berry)
    Re: printf,sprintf padding character <tchrist@mox.perl.com>
    Re: Regular Expression - substitution from lower to upp (Gabor)
    Re: Regular Expression - substitution from lower to upp (Andre L.)
    Re: Using perl to write a passwd program... <sneaker@sneex.fccj.org>
        What is Robot in Perl? (James  Bond  098)
    Re: Where to find CGI.PM for PerlW32 Build 316 (Danny Aldham)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 10 Sep 1998 23:13:26 GMT
From: "Rev. Don Kool" <oldno7@home.com>
Subject: Re: Automate change of remote user's password
Message-Id: <35F85D16.41ECAB6A@home.com>

Rich Sy wrote:
> 
> I need to periodically change the password of a remote user. I wanted to
> automated the change, ie. every week with password randomly generated or
> cycled, etc.
> 
> Any idea is very much appreciated.
> 
> (I can think of using Expect but this require Tcl which is not available
> in our system and will not be available.  We have Perl and I think I can
> use Comm.pl or Net::Telnet).

	You don't mention what OS you're running.  Under AIX you can set
all of this up for each user with SMIT.  It is the fist OS I've seen
where you can be almost as annoying to the user as under OpenVMS.
:-)  SOLARIS also lets you set expiration times but it doesn't (that
I know of) support automatically generated passwords.

			Hope this helps,
			      Don


--
**********************      You a bounty hunter?
* Rev. Don McDonald  *      Man's gotta earn a living.
* Baltimore, MD      *      Dying ain't much of a living, boy.
**********************             "Outlaw Josey Wales"
http://members.home.net/oldno7


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

Date: 10 Sep 1998 23:33:38 GMT
From: gspath@NOSPAM.epix.net (Gregory Spath)
Subject: Re: Change NT IP Address Using Perl
Message-Id: <z2H2FGLjexoj-pn2-4UdWn0ZOU1FF@hobbes.epix.net>

On Sun, 30 Aug 1998 00:42:55, Tripp Lilley <tlilley@perspex.com> 
wrote:

> While I heartily agree with you, this isn't exactly useful commentary. I
> believe the answer the original poster sought is "yes, you can, and
> here's how:".
>  
> IP address and gateway are stored in the registry. I'll be damned if I can
> remember the fully-qualified key, and I'm on a Win95 box right now, but if
> you search the registry for your hostname, you'll find the IP address and
> such nearby. 
>  
> You can manipulate the registry using the Win32::Registry package, which
> ought to be in your Perl distribution, but is available in libwin32. If
> you aren't up to building libwin32, try Gurusamy Sarathy's Win32 kit
> (http://www.perl.com will point you there).
> 

Cool.

Can you do this in windows95 too?  I have a laptop that has different 
network setting depending on whether I'm on my home lan or at work.  
What keys should I look for?  I'll be doing it with object rexx, not 
perl, so I don't need the perl functions.

Thanks!




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

Date: Fri, 11 Sep 1998 01:50:55 +0200
From: tcd@post10.tele.dk
Subject: Danish FXE
Message-Id: <35F865DF.71B4@post10.tele.dk>

I have been looking at some database scripts
And it seems that they all have the same fault.
When you do a search for a word that starts with a danish letter
F X E f x e - like in the words  "Fg" "Xlstykke" "Erhus"
the scripts cant find it.


I'm not sure but this seems to be a problem with
perls reg expression matching, not the programs..

Can anyone help me with this problem ????????????
Please email me if you have the answer to the problem.

I realy hope so.

Kind regards
Tommy
mailto:tcd@post10.tele.dk


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

Date: Thu, 10 Sep 1998 17:30:50 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Design by Contarct Seminar Series
Message-Id: <quj9t6.gpf.ln@metronet.com>


[ emailed, posted]


Interactive Software Eng. (training@eiffel.com) wrote:

: DESIGN BY CONTACT AND THE COMPONENT REVOLUTION
: Presented by Dr. Bertrand Meyer


   Woe is me!

   I have respected Dr. Meyer both from reading his posts in
   comp.software-eng and from hearing (second hand) that his
   Eiffel programming language was pretty slick.


   How disillusioning to now know that his company is simply
   another of the crass SPAM spewers.

   Anything for a buck...


[snip]


: FOR THE DETAILED PROGRAM AND LOCATIONS OF THE SEMINAR


   Sheesh!

   Spamming is not enough.

   (Real, classic spam at that. Multiple individual postings of 
    the identical article to several newsgroups...)


   Need some shouting at us too (probably because it is a given that we
                                 are dense, else we would be using
                                 Eiffel instead of Perl. Shouting helps
                                 dolts understand what you are saying...)





   Dr. Meyer, your marketing department is running amok.

   Fix them fast before they do yet more damage to your reputation.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 10 Sep 1998 17:33:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Design by Contarct Seminar Series
Message-Id: <MPG.10620fce34104ffe98979e@nntp.hpl.hp.com>

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

In article <quj9t6.gpf.ln@metronet.com> on Thu, 10 Sep 1998 17:30:50 -
0500, Tad McClellan <tadmc@metronet.com> says...
 ...
>    (Real, classic spam at that. Multiple individual postings of 
>     the identical article to several newsgroups...)
 ...
>    Dr. Meyer, your marketing department is running amok.
>    Fix them fast before they do yet more damage to your reputation.

;Dear Mr. Rosler,
;
;LR> I searched this post for 'perl' and the only place I found it was in
;LR> 'comp.lang.perl.misc'.  SPAM SPAM SPAM!
;
;Although the text does not contain word 'perl' it does not mean it will 
;not be relevant to your audience. The message is intended for anyone who 
;is interested in software development.
;
;Thank you!
;
;Alexander Prigozhin
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Interactive Software Engineering Inc.
;270 Storke Road, 2nd Floor
;Goleta, CA 93117, USA
;
;Alexander.Prigozhin@eiffel.com
;http://www.eiffel.com
;tel.: 805 685-1006
;fax: 805 685-6869
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Then presumably you also posted it in other newsgroups.  You should learn 
about cross-posting, so subscribers to several newsgroups will need to 
read only one copy of your message, and so subscribers to only one 
newsgroup can see the names of the others.

That said, I still do not believe comp.lang.misc.perl was an appropriate 
target.  No one has yet argued with my response to your post.

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


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

Date: Thu, 10 Sep 1998 17:59:11 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Detecting one character in a Form Field
Message-Id: <vjl9t6.i1g.ln@metronet.com>

Eric (_nospam_eric@kissco.com) wrote:
: I'm new to perl programming and I need help on 1 problem.  I have a form
: field, which is a serial number($FORM{'Serial'}), and I need to detect what
: the 5th character is.  It sounds simple enough, but I can't figure it out.


   perldoc -f substr


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 10 Sep 1998 23:19:00 GMT
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Graphs
Message-Id: <6t9mp4$r9b$2@lennon.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

Daniel Caraway ("jdcaraway@mindspring.com"@mindspring.com) wrote:
: Is it possible to create graphs with Perl?  If so How?

Yup, use the GD modules, available from CPAN.

--
Danny Aldham             SCO Ace, MCSE, JAPH, DAD 
Field Service Manager    BCTel Systems Support
7000 Lougheed Hwy, Burnaby BC   (604) 444-8949


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

Date: Fri, 11 Sep 1998 20:58:42 GMT
From: burningboy@hotmail.com (James  Bond  098)
Subject: How to do the background work in NT system !?
Message-Id: <314d0863.17642812@news.au.ac.th>

hmm......
In Unix we can do some background work?
but on NT system can we do it ?------------------------1

which command in Perl can do that ?<---------------2

I'd written some commnad like

while(true){print "a"}

then the screen didn't show anything, but in pascal

while(true) do writeln("a");

it returned "a" infinitely!

How can i do the infinite job in perl ?<----------------3

-.-''


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

Date: 10 Sep 1998 23:51:02 GMT
From: macintsh@cs.bu.edu (John Siracusa)
Subject: Localizing $_
Message-Id: <6t9ol6$5ge$1@news1.bu.edu>

I'm not sure when to localize $_.  For instance, if I have
a method call in an object-oriented module in which $_ is
used in a map { ... } block, do I need to have "local $_;"
up top in that method to avoid squashing the caller's $_?

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow



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

Date: 11 Sep 1998 00:13:42 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Localizing $_
Message-Id: <6t9pvm$mb4$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    macintsh@cs.bu.edu (John Siracusa) writes:
:I'm not sure when to localize $_.  For instance, if I have
:a method call in an object-oriented module in which $_ is
:used in a map { ... } block, do I need to have "local $_;"
:up top in that method to avoid squashing the caller's $_?

foreach (even when spelled out as for), map, and grep all
implicitly localize.   while does not.

--tom
-- 
"Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in."
	--Larry Wall in <1994Jul21.173737.16853@netlabs.com>


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

Date: 11 Sep 1998 00:22:43 GMT
From: macintsh@cs.bu.edu (John Siracusa)
Subject: Re: Localizing $_
Message-Id: <6t9qgj$7s7$1@news1.bu.edu>

Damn, look at those date headers.  That's gotta be some
sort of record.

Well, either that, or an auto-reply perl script with a newsfeed
coming in one end and a cross-referenced Perl FAQ data
structure hanging off the side... ;)

Thanks :)

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow



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

Date: Thu, 10 Sep 1998 19:17:53 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Not Spam! [was: For Sale: O'Reilly Perl Resource Kit - WIN32]
Message-Id: <alecler-1009981917530001@dialup-539.hip.cam.org>

Relevant or not to our interests, a "forsale" message is out of place in
this newsgroup. And the posting of the unmungled e-mail address was fair
retribution. 

(May I point out that, ironically, in quoting Greg's post, you
inadvertently reposted the address yourself. <g>)

Andre

===============================

In article <35F84291.4405BAD7@compclass.com>, Vincent Lowe
<vincent@compclass.com> wrote:

> Greg Bacon wrote:
> > 
> > In article <6t4esf$v73$1@nnrp1.dejanews.com>,
> >         gregkeene@yahoo.com writes:
> > : Send mail (REMOVE NOSPAMTODAY) to:
gregkeeneNOSPAMTODAY@NOSPAMTODAYyahoo.com
> > : for information.
> > 
> > Funny, <A Href="MAILTO:gregbacon@yahoo.com">gregkeene@yahoo.com</A>, how
> > you'd spam us but would be unwilling to receive spam in return.  Go
> > crawl back into whatever hole you came from.
> > 
> ...the original message was NOT spam.  A post to this newsgroup offering
> something for sale relevant to our interests is not what is not spam any
> more than waiting for a pretty girl outside a class you know she takes
> is stalking.
> 
>  As a reader of this group I found interest in the fact that someone
> wants to sell relevant literature soon after its publication.  Was the
> collection useless or disappointing to this reader?
> 
>  The gratuitous posting of his email address was however, both rude and
> offensive.  Good work!  I'll keep an eye out for other responsible posts
> from you in the future.
> 
>  ---v


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

Date: Thu, 10 Sep 1998 20:01:17 -0400
From: Brian Mayer <btm9003@rit.edu>
Subject: passing variables
Message-Id: <35F8684D.1BA1251F@rit.edu>

page to pass over variables (to another cgi script) without having to
click on a submit button.  Is this at all possible?  I've tried using
the meta tag as following:
<META HTTP-EQUIV=\"Refresh\"
CONTENT=\"0;URL=http://www.rit.edu/~btm9003/rsp/cgi/search.cgi?".$FORM{"dbfield"}
 ."\">

to no success.  Anyone have an idea how this could work?


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

Date: Fri, 11 Sep 1998 00:19:19 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <b0_J1.783$E9.2626893@ptah.visi.com>

In comp.lang.java.programmer John Porter <jdporter@min.net> wrote:
: bitnut1@my-dejanews.com wrote:
:> 
:> I hate to throw cold water on both Perl and Python camps but there are
:>...
:> no amount of your kicking and screaming is going to save them.

: What do ya say, George, shall we go kick this guy's ass?

I would actually like to hear what he is talking about first :)

-- 
George Reese (borg@imaginary.com)       http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
   "Keep Ted Turner and his goddamned Crayolas away from my movie."
			    -Orson Welles


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

Date: Fri, 11 Sep 1998 00:37:57 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <Fh_J1.789$E9.2626893@ptah.visi.com>

In comp.lang.java.programmer John Porter <jdporter@min.net> wrote:
: Might I also point out that Perl is no more my "pet language" than
: Python is yours, and that your saying so was unnecessarily
: provocative?

I don't actually code in Python.  I use Java for most everything.  For
a couple of sys admin tasks (such as automating the posting of the FAQ
I maintain), however, I did write some Perl scripts which I later
replaced with Python scripts.  

Once upon a time, before Java, I used to do much more Perl
programming.  Anyways, I know a lot more Perl than Python.

-- 
George Reese (borg@imaginary.com)       http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
   "Keep Ted Turner and his goddamned Crayolas away from my movie."
			    -Orson Welles


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

Date: Fri, 11 Sep 1998 00:35:04 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <Ye_J1.788$E9.2626893@ptah.visi.com>

In comp.lang.java.programmer John Porter <jdporter@min.net> wrote:
: George Reese wrote:
:> In comp.lang.java.programmer John Porter <jdporter@min.net> wrote:
:> : George Reese wrote:
:> :> Nonsense.  It is actually a really easily testable hypothesis.
:> 
:> : O.k., it was a dangling hypothesis, i.e. one provided sans support.
:> 
:> It is not one that requires support.

: Fine; but what are we to think when you offer a hypothesis
: in answer to a call to "back that up"?  It's one idle claim
: thrown after another.

The hypothesis was the claim.  The formal version of the hypothesis
was offered as a measure for testing the claim.

:> I am certainly open to the possibility something out
:> there exists for which Perl is better suited than Python.  But I think
:> it should be a hollow victory unless you can go beyond my mandate and
:> show that Perl is significantly better suited to the task in
:> question.

: You talk of "better" as if it were based upon universally accepted
: principles.  But of course different stakeholders (developer,
: employer, customer, etc.) have different needs that color their
: valuation of language choice.  I find Perl "better" for my own use,
: generally; but my customer has other ideas...

: How can you and I agree what the basis should be, upon which Perl
: can be evaluated as possibly better than Python?

I think that 'better to the individual' is not a valid measure.  That
is mostly subjective and actually provides no real value when someone asks
honest questions like "I need to build an ecommerce site with XXX
requirements, what should I use to do that?"  

That question supposes first that more than one developer is involved
and second that it is a recommendation to be made to a third party.

:> Furthermore, in order for Perl to actually be 'a better
:> language' than Python, you would have to show that this (or any other
:> potential strengths) override the tremendous downside of the
:> design inconsistency, poor maintainability, shoddy object model of
:> Perl.

: Naturally.  In fact, showing that these characterizations of Perl
: are mythical would be a fundamental part of my approach.
: Where do you live?  Let's go have a beer.

Heh, in Minneapolis.  And it does not look like anyone in Minneapolis
is getting out of town any time soon :)

:> Since that is so difficult to prove,

: Impossible, in fact, for one of two reasons:
: 1. those characterizations are false;
: 2. they're entirely subjective.

Not difficult to prove.  You need to prove the accusation false.  The
accusations are not subjective.  Let's take the hexadecimal conversion
example.  I showed this to some people ignorant of both languages and
they could immediately tell what was up with the Python version--the
Perl version was a mystery to them because of the shift thing.

Now, it is not the function shift that is really the issue so much as
the perl symantics of implicit arguments and other such short cuts.  

:> :> : I *can* read and maintain Perl code.
:> :> : It's all a matter of what language(s) one already knows.
:> 
:> Not in the least.  

: Yes, in the least (at least), as you already said.
: Fact is, I know Perl; I can read Perl and I can maintain Perl.
: I don't know Python, I can't read Python, and I can't maintain
: Python.  This is nothing against Python, of course; it is
: merely a result of my language repertoire.

I guarantee that if I gave you a bit of Python code, you would be able
to read it--and probably even modify it.

:> And [OO] is where Perl is incredibly weak. 
:> Not only was an OO paradigm an afterthought,
:> it was a horribly hacked together afterthough.

: This demonstrates to me that your understanding of OO perl is 
: "incredibly weak" -- nothing else.
: I'm not saying Perl's OO doesn't have a minor problem or two;
: but its design dovetails very neatly into the rest of the
: language.  

Yes, it goes into the language semtantics well--but at the cost of
making any sense of its OO paradigm.

: It added one keyword, and one other keyword-like
: variable (used for declaring the parents of a class).
: It's very dynamic in nature, just like the rest of the language.
: Maybe that's why some people don't like it.  Perl tends to
: appeal (in this respect) more to ex-Lisp programmers than to
: ex-Fortran programmers.


:> Then there is the ability to read code.  Perl is the only language I
:> know of where an expert has to concentrate to read the code of another
:> expert.

: You don't get out enough.  Every language is like this, to some
: degree; only religious fanatics claim otherwise.  (Go read comp.lang.
: cobol for examples.)  

This is false.  One of the ways in which Python has been described is
as 'machine readable pseudo-code'.

: This is a straw man, anyway; what's wrong
: with concentrating?  I don't think a program should read like
: a novel, and experience shows that it would be a ridiculous
: expectation.

You should spend some time with Python.  Like I said, I bet I could
post some Python code and not only would you be able to read it, you
would be able to modify it without picking up a book or a Python
text.  That is how simple Python is.

:> God forbid you ask a newbie to maintain Perl code.

: You're right; that why God sent us Bill Gates: to make
: the world safe for newbies.

The need for newbies to be able to get in and code cheaply is an
important economic force.

:> You are misunderstanding the role of generalization. The truth value of
:> that proposition is completely independent of whether it happens to be
:> true of you in particular.

: No, I understand it o.k.  I understand that your generalization is
: false.  You're saying that Python is so natural-looking that
: people can understand it without learning it, and so the old
: paradigm that one must know a language in order to read and maintain
: it is obsolete.  I'm saying that is a delusion -- and a dangerous
: one, too.

: But let's be quite frank.  Your statement:
:> And you can actually read and maintain the Python code.
: was not meant so much as a positive statement of Python's
: character as a slam against Perl.  To wit:
:> You can't read nor maintain the Perl code.
: But I am a counterexample to this hypothesis.
: Whatever may be the truth about Python's readability,
: your statement about Perl's is not categorically true.

Whereas Python is often described as 'machine readable pseudo-code',
Perl is often described as 'human readable machine code'.  That is not
an accident.

:> People defending nasty languages
:> often claim that "nasty is in the eye of the beholder".

: Hm, not the tack I would have taken against that argument.
: I would have said, "o.k, so you have nasty in your eyes;
: obviously Perl would appeal to you, then."

: But as the creator of Perl has said (and forgive my
: brutish paraphrase), Perl was not designed to be beautiful,
: it was designed to get things done.  It's a mule, not a
: Lipizaner.

Which is fine as a tool for complex system administration tasks--the
task for which Perl was designed.  The problem is that when it comes
to building large web sites or, god forbid, large business
applications, Perl is way out of its league.

And today, Python handles those sysadmin tasks admirably.

:> But the proof is in the pudding. 
:> Most people will find python code much more
:> readable than Perl code for most applications. 
:> Not everyone, but a good portion.

: Proof by popularity is no proof at all.
: Or do you really think MS Windows is a Great Operating System?

For readability of code, yeah, popularity is a good measure.  

-- 
George Reese (borg@imaginary.com)       http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
   "Keep Ted Turner and his goddamned Crayolas away from my movie."
			    -Orson Welles


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

Date: Fri, 11 Sep 1998 00:51:50 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <Gu_J1.792$E9.2626893@ptah.visi.com>

In comp.lang.java.programmer Matt Knecht <hex@voicenet.com> wrote:
: George Reese <borg@imaginary.com> wrote:

:>:     python -c 'import sys; import string; \
:>:         print string.atoi(sys.argv[1], 16)' 40
:>
:>:     perl -e 'print hex shift' 40
:>
:>Actually, I just did a test and showed both to people who know neither
:>language (IMHO, the best judges in a case like this).  The funny thing
:>to mee is that both seem like 6 and 1/2 dozen.  Which is why I find it
:>funny anyone would even bring this up as an example.  But the
:>non-experienced in python and perl to whom I showed this seemed to
:>have a serious problem with 'hex shift' and found the python version
:>more straight forward.

: Were you showing these to programmers or non-programmers?  If so, did
: they understand the meaning of sys.argv?  Could they understand what
: that 16 is refering to?  I can guess that atoi (And a guess it is, as
: atoi is a C function to me) is converting the argument to base 16.  Why
: you need to import anything to deal with arguments is beyond me.  Did
: the people you showed this to wonder that as well?  Did they know what
: the sys library was and did?

Object-oriented programmers, which certainly does affect the reading.
I think both versions would prove to be junk to non-programmers (the
whole hex thing is just a difficult concept for non-programmers to
begin with).

:>I find that interesting.  Nevertheless, either way, I think this
:>example shows nothing except that the two languages do things
:>differently. 

: Isn't that your whole point?  They do things differently, and you think
: Python does them 'better'.  The same could be said of any language
: comparing to any other!  At any rate, we'll chalk this one up to
: differene of opinion.

No, my point is that Python and Perl are roughly identical in
functionality but that Python produces some of the easiest to maintain
and extend code on earth while Perl is its polar opposite--some of the
hardest to maintain and extend code on earth.

I thought my little test was interesting, but not meaningful.  Because
you cannot tell anything about extensibility or maintainability from
one line of code.

:>Can't the "I love perl" crowd come up with some meaningful functional
:>benefit of perl?

: Hrm.  I'll ignore the slight intended by the '"I love perl" crowd'
: remark.

: But, I must wonder at why the onus is on the Perl crowd.  This thread
: started as a comparison of Java and Perl.  It continued on that path
: until you posted about Perl being a terrible language (I'm paraphrasing,
: but that's how I perceive your posts here).  You then said that "Python
: is better than Perl at everything" (Again, paraphrasing) and demanded an
: example to prove otherwise.  I don't understand why you don't take
: matters into your own hands, and show the Perl community why Python is
: better.  In fact, I ask you to do this!

You need to read more carefully, because you have meaningfully
mis-paraphrased me on both counts and followed it up with a summary of
something I did not ask.

I asked "Can't the 'I love perl' crowd come up with some meaningful
functional benefit of perl?"  I have not made the claim that Python
has a meaningful functional benefit over Perl.  I have said it results
in seriously more easily maintaineable and extensible code.  The
conclusion is that all things being equal, you should go for
maintainability and extensibility.

Thus, if you are not going to argue my points of extensibility and
maintainability, you need to provide a functional benefit where "all
things won't be equal".

: But, you did ask, and I'll give you a non-trivial example.  I have a few
: "Intro to Python" pages bookmarked.  I won't post the Python code,
: because it's far too long (And I'm afraid that without a better
: knowledge of Python, I'll ruin the indenting and make the code invalid).
: Here's the URL to a program that converts tabs to 4 spaces:

: http://www.strout.net/python/tidbits.html#tabfix

: It's quite a large, and suprisingly complicated program for such a
: simple operation.  Here's a line from the perl FAQ:

: 1 while $string =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;

: The literal 8 can be substituted with any number you'd like to convert
: your tabs to.

: You may claim that this looks like line noise, but I would counter that
: claim that the Python code looks like somebody grabbed random words from
: a dictionary and strung them together with colons and periods.  I'm
: relativly new to Perl, but it takes me about 10 seconds to parse that
: line.  If you don't care for the special variables $& and $`, you can
: always use their English names (Although, the only thing they are good
: for is letting a very novice user remember things more easily.  IMHO
: they hamper readability.) "$PREMATCH" and "$POSTMATCH".  In contrast it
: took me a full minute just to *read* the Python code, let alone trying
: to figure out what was going on.

I think you just hit the nail on the head.  Your example is line
noise. The Python example you point out (which has a lot of whitespace
and comments) is encapsulated in a nice function to make it reusable.

I think all I hear constantly from Perl supporters is how few
keystrokes than can accomplish a task in.  Sorry, but I consider that
a defacto sign of a lack of maintainability.

And note, both languages are able to perform the task admirably.  So
that is not even a functional difference.

: Oh, and there's an even simpler Perl solution to the tab problem.  Use a
: builtin module:

: use Text::Tabs;
: @expanded_lines = expand(@lines_with_tabs);

: It doesn't get much easier than that.  A **LOT** can be trivially
: accomplished in Perl with the use of modules.  I invite you to check out
: your nearest CPAN.

Well, shit, I can do that with Python:

import tabfix;

expanded_lines = tabfix.fixTabs(line_with_tabs);

-- 
George Reese (borg@imaginary.com)       http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
   "Keep Ted Turner and his goddamned Crayolas away from my movie."
			    -Orson Welles


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

Date: Thu, 10 Sep 1998 15:21:03 -0400
From: Carl King <carlking@freewwweb.com>
Subject: Perl on Domino Go
Message-Id: <35F8269F.3E884E4E@freewwweb.com>

I can't get Perl script to execute from a browser URL on Domino Go. The
scripts are properly associated with perl as they will run on the
command line or just by double clicking. The URL template for request
routing is correct (I think). EXEC  /cgi-bin/*.pl  f:\emx\bin\perl.exe.
Does anyone have any experience with Domino?



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

Date: Thu, 10 Sep 1998 16:41:27 -0700
From: travis cox <travis.cox@itron.com>
Subject: printf,sprintf padding character
Message-Id: <35F863A7.2097@itron.com>

Is there a way to change the padding character for printf,sprintf,
for example printf("%d10",1234); prints 6 spaces followed by 1234
can I change the spaces to zero's so it prints 0000001234 instead?


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

Date: 11 Sep 1998 00:03:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: printf,sprintf padding character
Message-Id: <6t9pbk$nal$1@marina.cinenet.net>

travis cox (travis.cox@itron.com) wrote:
: Is there a way to change the padding character for printf,sprintf,
: for example printf("%d10",1234); prints 6 spaces followed by 1234
: can I change the spaces to zero's so it prints 0000001234 instead?

That should actually be "%10d", of course.

Doing it for an arbitrary fill character is slightly tougher, but for
zeroes, just put '0' before the desired width in the (s)printf format
string:

  printf '%010d', 1234;

---------------------------------------------------------------------
   |   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: 11 Sep 1998 00:18:50 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: printf,sprintf padding character
Message-Id: <6t9q9a$mb4$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, cberry@cinenet.net (Craig Berry) writes:
:Doing it for an arbitrary fill character is slightly tougher, but for
:zeroes, just put '0' before the desired width in the (s)printf format
:string:
:
:  printf '%010d', 1234;

Ah, but not too much harder.  Here's how to pad that puppy with a 
plus symbol:

    ($puppy = sprintf("%010d", 1234)) =~ s/\G0/+/g;

--tom
-- 
    Besides, REAL computers have a rename() system call.    :-)
                    --Larry Wall in <7937@jpl-devvax.JPL.NASA.GOV>


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

Date: 10 Sep 1998 23:06:19 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Regular Expression - substitution from lower to upper case...how?
Message-Id: <slrn6vgmr2.99.gabor@guava.vmunix.com>

In comp.lang.perl.misc, Jules <julius@clara.net> wrote :
# Dear all, please tell me how I could use the substitution expression to
# convert all lowercase characters to uppercase? I tried \U\E pair but won't
# work. My program is as follows:

You've several options.

tr/a-z/A-Z/;

$_ = uc $_;

s/(.+)/\U$1/;


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

Date: Thu, 10 Sep 1998 19:30:28 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Regular Expression - substitution from lower to upper case...how?
Message-Id: <alecler-1009981930280001@dialup-539.hip.cam.org>

In article <6t7cvs$ksa$1@wbnws01.ne.highway1.com>, "Todd B"
<NOTHANKStbeaulieu@mediaone.net> wrote:

> use the tr command.
> 
> i believe the syntax would be tr/a-z/A-z/
> 
> you can research the rest.


I believe the syntax would be tr/a-z/A-Z/.

But the locale-savvy uc() may be more appropriate.

Andre


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

Date: Thu, 10 Sep 1998 18:56:48 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: Using perl to write a passwd program...
Message-Id: <35F85930.DA67B415@sneex.fccj.org>

Stefan Adams wrote:
> 
> My RedHat Linux system came with passwd pre-installed.  But I can't find the
> source for it.  I've seen others, but they are all in C.  I prefer perl.
> Does anyone know where I can find a perl passwd?  Or how to make one?  It
> seems to me that I need to use expect, but even that isn't working the way
> I'd like.  Also, where can I find a passwd program for CGI for users to
> change their password on http?
> 
> Thanks a million!
> Please mail me at pinky@mail.usmo.com!
> You're the greatest!
> 
> Stefan Adams
> Borgia High School
> pinky@mail.usmo.com


I keep seeing these things, Hmmm, am I imagining it?

Try http://www.perl.com, search on Security, 
see WebPass (also search via DejaNews...)

Or, duplicate the passwd program completely in perl;
here is some starter code:

#!/usr/bin/perl -w

use strict;
use diagnostics;

# Digit Place...
my $first;
my $second;
my $pw = '';

# General Counters...
my $w = 0;
my $x;
my $y = '';
my $z = '';

# Test Password
$pw =  shift || rand(time); # Or user supplied...

# Program control...
while(1) {
  $first  = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));
  $second = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));

  last if ($x++ > (16*((2**31)-1))); # Loop millions...
  # print "$first $second\n";

  next unless chr($first)  =~ /[a-zA-Z0-9]/;
  next unless chr($second) =~ /[a-zA-Z0-9]/;
  $pw = chr($first) . substr(rand(time), 0, 6) . chr($second);

  # crypt w/two letter seed...
  $z = crypt($pw, ("".chr($first).chr($second).""));
  print " - Found match: $z - Total: ++$w" if (index($y, $z) > -1);
  $y .= " " . $z;
  print "\nLooking \@ Plain: $pw, Crypt: $z : Try: $x.";
}


Also, here is the passwd layout for your records:
usrID:cryptedPW:UIDNumer:GRPidNumber:Who They Are:/home/dir:shell

HTH,
-Sneex-  :]
__________________________________________________________________
Bill Jones | FCCJ Webmaster | http://webmaster.fccj.org/Webmaster
__________________________________________________________________
We are the CLPM... Lower your standards and surrender your code...
We will add your biological and technological distinctiveness to 
our own... Your thoughts will adapt to service us...
 ...Resistance is futile...


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

Date: Fri, 11 Sep 1998 20:58:46 GMT
From: burningboy@hotmail.com (James  Bond  098)
Subject: What is Robot in Perl?
Message-Id: <3156d020.10788524@news.au.ac.th>

"Robot", i've encountered this word many time in Perl, what does it's
means. etc. Robot Rules .... something like that!


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

Date: 10 Sep 1998 23:18:27 GMT
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Where to find CGI.PM for PerlW32 Build 316
Message-Id: <6t9mo3$r9b$1@lennon.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

vdielman@debis.com <vdielman@debis.com> wrote:
>
>I'm looking for the Module CGI.PM ready to use with Perl for Win32, build 316.
>Can anybody tell me where to find it or Send it per Mail?

The standard CGI.pm works fine with Perl for Win32. The Activestate version
does not include Makemaker, so you must manually put the module into the
correct directory. 

--
Danny Aldham             SCO Ace, MCSE, JAPH, DAD 
Field Service Manager    BCTel Systems Support
7000 Lougheed Hwy, Burnaby BC   (604) 444-8949


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

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

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