[10170] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3763 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 19 23:07:27 1998

Date: Sat, 19 Sep 98 20: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           Sat, 19 Sep 1998     Volume: 8 Number: 3763

Today's topics:
    Re: any way to encrypt my script? (Alastair)
    Re: any way to encrypt my script? <tchrist@mox.perl.com>
    Re: any way to encrypt my script? (Abigail)
    Re: copy a file? (Abigail)
    Re: downloading a file using perl... (Alastair)
    Re: downloading a file using perl... <rapruitt@inetconn.net>
    Re: downloading a file using perl... <adtech@aros.net>
    Re: downloading a file using perl... <samwang@freewwweb.com>
    Re: downloading a file using perl... <samwang@freewwweb.com>
    Re: Enumerating Properties and Methods (Abigail)
    Re: even/odd numbers <tchrist@mox.perl.com>
    Re: even/odd numbers <sneaker@sneex.fccj.org>
    Re: even/odd numbers (Abigail)
    Re: Help With Perl Beautification <rra@stanford.edu>
    Re: How to produce a compiled file (Abigail)
    Re: IO::Select Problems <edwin.ramirez@erols.com>
        Modification to read only value error in a place where  (David Formosa)
    Re: Perl & Java - differences and uses <rra@stanford.edu>
    Re: Perl & Java - differences and uses (Abigail)
    Re: Perl & Java - differences and uses <borg@imaginary.com>
    Re: Perl & Java - differences and uses <borg@imaginary.com>
    Re: script: scriptMangle! <merlyn@stonehenge.com>
    Re: Using templates... <tchrist@mox.perl.com>
    Re: What does the + in print statement do? (Abigail)
    Re: what's wrong with win32 perl ? (Nathan V. Patwardhan)
    Re: where is Date::Parse? (Abigail)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Sun, 20 Sep 1998 01:09:21 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: any way to encrypt my script?
Message-Id: <slrn708p56.52.alastair@calliope.demon.co.uk>

bitnut1@my-dejanews.com <bitnut1@my-dejanews.com> wrote:
>
> B.N.

Bitnut? Is that your real name?

At least 'GEMINI' now has an idea that 'hiding' code is not straightforward in
these parts. The only contribution you've made is by insult.

See you in /dev/null.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 20 Sep 1998 01:14:46 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: any way to encrypt my script?
Message-Id: <6u1ku6$7vb$2@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, bitnut1@my-dejanews.com flames me.

Who died and made you God, O Might Perl Programmer of Infinite
Prowess?  Who the hell do you think you are?  I know who I think 
you are: an idiot who can't read and can't admit it when
he's screwed up in public.

*PLONK*

--tom
-- 
    X-Windows: It could be worse, but it'll take time.
	--Jamie Zawinski


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

Date: 20 Sep 1998 02:09:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: any way to encrypt my script?
Message-Id: <6u1o3v$dhd$1@client3.news.psi.net>

bitnut1@my-dejanews.com (bitnut1@my-dejanews.com) wrote on MDCCCXLV
September MCMXCIII in <URL: news:6u0nmj$q0i$1@nnrp1.dejanews.com>:
++ 
++ > abigail@fnx.com wrote:
++ > What makes you think that Perl code isn't compiled before executed?
++ 
++ I have no choice but to recommend remedial reading lessons
++ and lessons in the distinction between a compiler and an
++ interpreter.


I know what an interpreter is. I know what a compiler is.
I also know how to read the Perl documentation. 

I know what perl does.

You don't.

Now, FOAD.


Abigail
-- 
perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
          for (??;(??)x??;??)
              {??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'


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

Date: 20 Sep 1998 02:30:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: copy a file?
Message-Id: <6u1pcq$dhd$5@client3.news.psi.net>

Jeff Pinyan (jeffp@crusoe.net) wrote on MDCCCXLV September MCMXCIII in
<URL: news:Pine.GSO.3.96.980919162604.25824A-100000@crusoe.crusoe.net>:
++ > I have been looking for how to copy a file in a perl 5.0 script, but
++ > haven't successed. Have tried to guess some commands like
++ > 
++ > copy("$existingfile", "$newfile");
++ > copy $existingfile $newfile; or
++ > cp  $existingfile $newfile;
++ > 
++ > etc, but it doesn't work and I can't find out the proper one. Maybe one
++ > can't do this? (I want to use a standard file (existing one) and write into
++ > its copy when it has been created)

Define "doesn't work". What's the value of $!?

++ If you read perldoc perlfunc, you'll find:
++ rename(EXPR, EXPR);

And if *you* read perlfunc, you'll find that rename doesn't copy.
It, *gasp* renames the file!



Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: Sun, 20 Sep 1998 01:12:58 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: downloading a file using perl...
Message-Id: <slrn708pbv.52.alastair@calliope.demon.co.uk>

Mark Hulka <adtech@aros.net> wrote:
>Here's my problem. I have some files that I want people to be able to
>download from my web site. They are binary files, but when I download
>one of the files using Netscape it comes across as plain text, making
>the file unusable.

Getting Netscape to work might be easiest (from naive user point of view). A
shift-click on a link should download a file 'as is' (save to disk).

Failing that - FTP should be straightforward.

Perl has FTP and HTTP modules as well - check CPAN (http://www.cpan.org)

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Sat, 19 Sep 1998 21:26:22 -0400
From: "Andy" <rapruitt@inetconn.net>
Subject: Re: downloading a file using perl...
Message-Id: <6u1lu3$92n$1@news.dn.net>


>Here's my question, I can use a PERL script to allow users to download
>the files fine. But when the file is downloaded the filename is set to
>the name of the PERL script. Does anyone know of a way to set the
>filename?


Here's how I do it for zipfiles.  The trick is in the headers; I believe
that different versions of IE and netscape require different headers.

sub PrintZipFile
{
 my $file = shift;
 my $binout;
 open (ZIP, $file) or die "Content-Type: text/html\n\n Can't open $file\n";
 binmode ZIP;
 print "Content-Type: application/zip; name=ZipFile.zip\n";
 print "Content-Disposition: attachment; filename=ZipFile.zip\n\n";
 { local $/; print scalar <ZIP> }
 close (ZIP);
 return;
}


>
>Here's my code:
>
> open (FILE,"test.foo") || die "Can't Open test.foo: $!\n";
> @CONTENTS=<FILE>;
> close(FILE);
>
> print "Content-type: application/octet-stream\n\n";
> print @CONTENTS;
>
>Any ideas would be greatly appreciated,
>
>Mark
>




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

Date: Sat, 19 Sep 1998 19:26:34 -0600
From: Mark Hulka <adtech@aros.net>
Subject: Re: downloading a file using perl...
Message-Id: <360459CA.79E2A27D@aros.net>

Thank you! That worked great!

Mark

Andy wrote:

> >Here's my question, I can use a PERL script to allow users to download
> >the files fine. But when the file is downloaded the filename is set to
> >the name of the PERL script. Does anyone know of a way to set the
> >filename?
>
> Here's how I do it for zipfiles.  The trick is in the headers; I believe
> that different versions of IE and netscape require different headers.
>
> sub PrintZipFile
> {
>  my $file = shift;
>  my $binout;
>  open (ZIP, $file) or die "Content-Type: text/html\n\n Can't open $file\n";
>  binmode ZIP;
>  print "Content-Type: application/zip; name=ZipFile.zip\n";
>  print "Content-Disposition: attachment; filename=ZipFile.zip\n\n";
>  { local $/; print scalar <ZIP> }
>  close (ZIP);
>  return;
> }
>
> >
> >Here's my code:
> >
> > open (FILE,"test.foo") || die "Can't Open test.foo: $!\n";
> > @CONTENTS=<FILE>;
> > close(FILE);
> >
> > print "Content-type: application/octet-stream\n\n";
> > print @CONTENTS;
> >
> >Any ideas would be greatly appreciated,
> >
> >Mark
> >





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

Date: Sat, 19 Sep 1998 20:43:15 -0500
From: Sam Wang <samwang@freewwweb.com>
Subject: Re: downloading a file using perl...
Message-Id: <36045DB3.CE92D84B@freewwweb.com>

speaking of which, do you know of any place that lists all the headers mozilla
accepts?



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

Date: Sat, 19 Sep 1998 20:32:56 -0500
From: Sam Wang <samwang@freewwweb.com>
Subject: Re: downloading a file using perl...
Message-Id: <36045B48.46D0C7F4@freewwweb.com>

perhaps a symbolic link to the perl script. and downloading from the link.
don't know if IIS will let you do this though.

Mark Hulka wrote:

> Here's my problem. I have some files that I want people to be able to
> download from my web site. They are binary files, but when I download
> one of the files using Netscape it comes across as plain text, making
> the file unusable.
>
> Here's my question, I can use a PERL script to allow users to download
> the files fine. But when the file is downloaded the filename is set to
> the name of the PERL script. Does anyone know of a way to set the
> filename?
>
> Here's my code:
>
>  open (FILE,"test.foo") || die "Can't Open test.foo: $!\n";
>  @CONTENTS=<FILE>;
>  close(FILE);
>
>  print "Content-type: application/octet-stream\n\n";
>  print @CONTENTS;
>
> Any ideas would be greatly appreciated,
>
> Mark



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

Date: 20 Sep 1998 02:34:29 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Enumerating Properties and Methods
Message-Id: <6u1pjl$dhd$6@client3.news.psi.net>

Jay Guerette (JayGuerette@pobox.com) wrote on MDCCCXLV September MCMXCIII
in <URL: news:6u15ic$ifu@news-central.tiac.net>:
++ 
++ This _is_ what I'm really trying to accomplish. I could tell you that I'm
++ trying to find out what methods and properties are available from
++ '$window->document' under PerlScript, but I hesitate to do that because
++ everybody says: "Well, that's PerlSCRIPT and not PERL; we can't help you."
++ Of course, people don't understand that PerlScript is simply a wrapper for
++ Perl; and for that reason IS Perl. There is NO documentation for client-side
++ PerlScript.


If it's simple a wrapper for Perl, read the documentation of Perl. ;)
(Of course, why wouldn't you use Perl then?)

But you cannot know what's available or not. A method might spring
into existence only at the same moment you call it.



Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'


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

Date: 20 Sep 1998 01:08:15 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: even/odd numbers
Message-Id: <6u1khv$7vb$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, sstark@informix.com (Scott Stark) writes:
:BUT, call me stupid, yes *I KNOW* that if a number is divisible by 2 it's even, 
:but how do I say that in perl? 

Do you really not know what the division operator is in Perl?  Honest?
Have you looked in the perlop manpage?

:If $num divided by 2 contains the string ".5" 
:it's odd, else it's even? Is there some math function in perl to determine if 
:the result of division is a whole number?

Good good good!  That's what I was looking for: the process in your
brain that finds answers to things like this.  And in fact, you've come
up with a solution on your very own.

    my($odd, $even);
    if ( ($integer / 2) =~ /\.5$/) {
	$odd  = 1;
    } else {
	$even = 1;
    } 

A slightly seasoned perl programmer might even write that as

    ((($integer / 2) =~ /\.5$/) ? $odd : $even ) = 1;

Since we're thinking about strings, consider this: an integer
whose last digit is odd is itself odd.  Therefore, any integer
ending in 1, 3, 5, 7, or 9 must be odd.  This leaves us
with the following solution:

    if ($integer =~ /[13579]$/) { 
	$odd  = 1;
    } else {
	$even = 1;
    } 

But you don't need to use strings.  Let's stick with numbers.

    if (int($integer / 2) * 2 == $integer) {
	$even = 1;
    } else {
	$odd = 1;
    } 

However, that's still too much work.  As a child of C, Perl has a
remainder operator built-in to it.  If you defined a integer N by a
integer F and the result produces a remainder of 0, then F is a factor
of N.  The remainder operator, usually referred to as the ``modulus
operator'', is a single % sign, just as it is in so many other langauges.
We wouldn't want to surprise you, after all. :-)

"Odd" and "even" are just the common way of asking whether an 
integer has 2 as a factor.  

    if ($N % $F == 0) {
	print "$F divides into $N without a remainder\n";
    } 

Or even 

    unless ($N % $F) {
	print "$F divides into $N without a remainder\n";
    } 

So in the case of $F == 2, 

    if ($N % 2 == 0) {
	$even = 1;
    } else {
	$odd = 1;
    } 

Or simply:

    ( ($N % 2) ? $odd : $even ) = 1;

Or perhaps

    $is_odd  = ($N % 2) == 1;
    $is_even = ($N % 2) == 0;

Or maybe

    $is_odd  =   $N % 2;
    $is_even = !($N % 2);

If you are something of a computer hardware kind of guy, you might
realize that a number is stored in binary, not decimal.  So there's no
reason to check whether the last digit is a 1, 3, 5, 7, 9, since all
digits in binary are either 0 or 1.  But this makes it all the easier.

    $is_odd  = ($N & 1) == 1;
    $is_even = ($N & 1) == 0;

or just

    ( ($N & 1) ? $odd : $even ) = 1;

Now, what part of this were you missing?  The regular expression
matching syntax?  The arithmetic division and multiplication operators?
The integer modulus operator?  The bitwise and operator?

I really, really want to understand why people keep asking this
question day in or day out.  Right now, I am mystified at their mystery.
Please help me out here.

--tom
-- 
    X-Windows: It was hard to write; it should be hard to use.
	--Jamie Zawinski


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

Date: Sat, 19 Sep 1998 22:13:44 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: even/odd numbers
Message-Id: <360464D8.DCF7F98E@sneex.fccj.org>

Scott Stark wrote:
> 
> Hi, does anyone know a way for perl to determine if a number is even or odd?
> 
> thanks
> 
> Scott Stark
> sstark@informix.com


Pretty weird, but try "%" (modulus) operator, like:

#!/usr/bin/perl -w

use strict;
use diagnostics;

my $number = 1;

while (1) {
  print "\n$number is";
  ($number % 2) ? print " Odd " : print " Even ";
  last if ($number++ > 50);
}

1;


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: 20 Sep 1998 02:24:58 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: even/odd numbers
Message-Id: <6u1p1q$dhd$3@client3.news.psi.net>

Scott Stark (sstark@informix.com) wrote on MDCCCXLV September MCMXCIII in
<URL: news:6u1ckv$re21@webint.na.informix.com>:
++ Hi, does anyone know a way for perl to determine if a number is even or odd?
++ 


I always use:

  is_even {
     my $candidate = shift;
     return is_even -$candidate if $candidate < 0;
     return $candidate ? is_odd  -- $candidate : !$candidate;
  }

  is_odd  {
     my $candidate = shift;
     return is_odd  -$candidate if $candidate < 0;
     return $candidate ? is_even -- $candidate :  $candidate;
  }



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: 19 Sep 1998 18:19:55 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Help With Perl Beautification
Message-Id: <yl67ejpolg.fsf@windlord.stanford.edu>

In comp.lang.perl.misc, Steven M O'Neill <steveo@panix.com> writes:

> panix7:~>cat ee
> s e(b\eho)(ld\er)e'E'.$1.'Y'.$2.'E'ee;
> panix7:~>perl5 ee

windlord:~> cat > ee
s e(b\eho)(ld\er)e'E'.$1.'Y'.$2.'E'ee;
windlord:~> echo "beholder" | perl -p ee 
EbehoYlderE

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 20 Sep 1998 02:26:17 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to produce a compiled file
Message-Id: <6u1p49$dhd$4@client3.news.psi.net>

Marco Orlandi (marooo@tin.it) wrote on MDCCCXLII September MCMXCIII in
<URL: news:360027BE.3E6401D9@tin.it>:
++ I would like to avoid the Perl interpreter overhead, so I would like to
++ know how I can SAFELY compile my scripts and produce an executable file.


Since Perl isn't an interpreter, the overhead of interpretation is 0.



Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


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

Date: Sat, 19 Sep 1998 22:01:07 -0400
From: "Edwin S. Ramirez" <edwin.ramirez@erols.com>
Subject: Re: IO::Select Problems
Message-Id: <360461E2.524C9C96@erols.com>

Jim Brewer wrote:

> "Edwin S. Ramirez" <edwin.ramirez@erols.com> writes:
>
> >
> >     I have a network app which uses IO::Socket and IO::Select to listen
> > for connections and incomming messages.  The problem is that when the
> > program receives multiple lines, how do I find out how many lines of
> > data are awaiting on the socket?
> >
>
> Why do you need to know how many lines of data are available? Just
> read x bytes from the socket and then go back to select. If there is
> more data to be read, then select will let you know and you read x
> bytes again. This process continues until the socket is no longer
> ready for reading. select will then block until the socket is ready to
> read or write or has an error depending on how you've set up your
> select.
>
> Put the data you've read into a buffer and examine the buffer to
> determine how many lines there are. The job of select is to simply
> advise when a socket is ready to read or write or has an error. Not to
> advise the quantity or quality of that data.
> --
> Jim Brewer
> e-mailed courtesy copies are unappreciated, please refrain.

    What you describe is basically what I was doing.  I would read a single
line from the socket and then return to the select statement.  However, if
there are multiple lines waiting in the socket, once I read a single line
from the socket, select does not return any sockets from the can_read
statement.  It does not realize that there is data already in the socket and
it does not return when new data arrives.

Any ideas?

-ESR-



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

Date: 20 Sep 1998 12:22:17 +1000
From: dformosa@zeta.org.au (David Formosa)
Subject: Modification to read only value error in a place where it isn't.
Message-Id: <6u1osp$ju5$1@godzilla.zeta.org.au>

I'm getting a very odd error with perl5.005_51

sub SetDefaultValue ( $$ ) {

    my $field=shift;
    my $value=shift;
    
    lock default;
    lock default->{$field};

    $default->{$field}=$value;
}

In this in am getting a "Modification of a read-only value attempted" error
at the lock default->{$field} line.  Can someone tell me what this error is
being generated by.


    



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

Date: 19 Sep 1998 18:55:40 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl & Java - differences and uses
Message-Id: <yl3e9npmxv.fsf@windlord.stanford.edu>

In comp.lang.perl.misc, George Reese <borg@imaginary.com> writes:

> The freedom you talk about is why software engineering is such a voodoo
> practice that results in gobs of absolute crap being produced.  Design
> and naming things should be the result of a repeatable and structured
> process.  That is what OO methodologies are.  Formatting is a function
> of standard programming practices, or, better yet, a well structured
> language like python.  Algorithms should be the result of proven design
> patterns.

> Otherwise, you are just talking voodoo.

It sounds to me like you're arguing in favor of programming as a strict
engineering discipline.  One has a set of pieces, and one builds things
using them in a consistent and reproducible manner according to a strict
set of plans.

I treat programming like an art form.  Finding a new way to express
something in a programming language is, to me, as much of a pleasure as a
well-chosen turn of phrase in something that I'm writing.  I take pleasure
in being succinct, and I take pleasure in being exact, and I like a
language that can give me the flexibility to do things like that.

And to write things like my sig, which to me are to programming what poems
like "Jabberwocky" are to the English language.

Perhaps you're right, perhaps without the ability to write art, structured
programming projects would be easier.  They'd certainly be a little less
like trying to herd cats.  But see, without that aspect of programming,
I'm not sure I'd program at all, so I have to question whether it would
result in more code being written.

I think it would certainly result in fewer programmers.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 20 Sep 1998 02:19:04 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl & Java - differences and uses
Message-Id: <6u1omo$dhd$2@client3.news.psi.net>

George Reese (borg@imaginary.com) wrote on MDCCCXLV September MCMXCIII in
<URL: news:7ARM1.876$Ge.2267862@ptah.visi.com>:
++ 
++ Vanishingly few programmers actually have the skill to know what they want to
++ optimize for in a manner inconsistent with structured language
++ design.  I certainly cannot think of a meaningful exception.


Don't take yourself as a benchmark for the average programmer.


Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: Sun, 20 Sep 1998 02:25:34 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <yIZM1.942$Ge.2549906@ptah.visi.com>

In comp.lang.java.programmer Uri Guttman <uri@sysarch.com> wrote:
:>>>>> "GR" == George Reese <borg@imaginary.com> writes:

:   GR> In comp.lang.java.programmer Uri Guttman <uri@sysarch.com> wrote:
:   GR> :>>>>> "GR" == George Reese <borg@imaginary.com> writes:

:   GR> :   GR> I have already stated that freedom has no place in programming.
:   GR> :   GR> Now you may disagree with it, and I have certainly provided
:   GR> :   GR> support for that assertion.  It therefore makes no sense to come
:   GR> :   GR> back with freedom to counter that argument.  You may want to try
:   GR> :   GR> explaining why a programmer should have freedom.

:   GR> : ok, then use just cobol for all you programs. and only insertion
:   GR> : sorts. no regexes since you can write parsers by hand. no hashes since
:   GR> : you can do linear lookups. this is what no freedom in programming is
:   GR> : about.

:   GR> This is plain stupid.  Functionality and freedom are not synonymous.
:   GR> Get that equivalence out of your head.

: functionality give the programmer the freedom and artistic license to
: choose which function to use to solve a coding problem. i was just
: pointing out your mistaken assumption about limiting freedom of
: programmers. 

Functionality is NOT freedom--at least not freedom in the sense being
talked about in this thread.  This thread is (now) basically about the OO
structure enforced by python and perl vs. the lack of structure in
perl.  Perl and python are functionally similar languages.  Perl,
however, allows a variety of ways of expression.  Python, on the other
hand, forces an OO expression in a very strict syntax.

The premise being discussed in this branch of this thread is my
statement that 'freedom has no place in programming' (or something of
that nature, I don't have the exact quote before me).  Now, there are
unstated assumptions that go along with that.  Clauses like 'in a
large-scale, multi-developer system'.  For your own uses, anything
that works works.  But just because it works for you personally does
not mean it translates well to group development.

:   GR> The freedom you talk about is why software engineering is such a
:   GR> voodoo practice that results in gobs of absolute crap being produced.

: let's compare creative programmers with freedom and your hive of drones
: coding to fixed format and corporate specifications. i have seen the
: results and it is the crap you speak of. a smaller team of creatuve
: programmers with freedom will beat their pants off easily in both
: quality and quantity of code.

This statement would of course require some sort of real world test
neither you nor I are prepared to do here.  So it is just an
unsupported claim as it stands.

But look at it this way.  Let's give two people a crossword puzzle.  I
give one an algorithm--a trial-and-error algorithm somewhat like long
division--and the other uses their creative wits.  Furthermore, the
one given the algorithm is any average person off the street.  The one
with "freedom" is a genius.

Who do you think will solve the puzzle first?

My money is on the "drone" armed with the algorithm.

:   GR> Design and naming things should be the result of a repeatable and
:   GR> structured process.  That is what OO methodologies are.

: bullshit. selecting a name is the most human ascpect of programming. the
: machine doesn't give a crap about the name of something. a name is purely
: a human attribute that is totally akin to writing anything in a natural
: language. you have the freedom to create a word, phrase or some wierd
: combo that carries meaning to another human being. this is NOT a repeatable
: process for any person of group of persons. it cannot be structured of
: methodologized of OO'd or anything. a better programmer will pick better
: names no matter what the underlying programming language or
: methodology. it is pure freedom and you can't remove it. 

Names are hugely important and are very much a result of the OO A&D
process.  Specifically, the names are determined at design time before
any programmer gets involved based upon what those terms mean in the
business for which those names have real world referents.

:   GR> Algorithms should be the result of proven design patterns.

: which algorithm you dolt! how many search and sort algorithms are there?
: how many have you programmed? do you use the same one for EVERY program?
: then i surely won't hire you nor will any intelligent manager. pointy
: haired boss likes you since he can automate you! "use a linear search
: for the database, since it is company policy to do things linearly".

: sounds like choosing an algorith has a fair amount of programming
: freedom.

You are again confusing functionality with freedom.  And you are also
making assumptions about me personally which you are not qualified to
make.  Try supporting your arguments on their merits and not based on
personal attacks on me.

Multiple search algorithms are about multiple kinds of functionality,
not multiple means of expression.

:   GR> You have a real problem with identity of things.  No freedom is not
:   GR> the same thing as being automatically generatable.

: you talk as if the methodology is the answer. methodologies are
: structured. structured designs are repeatable. sounds like automation
: somewhere around here. OO theories say you design like this. well a
: moron could follow those rules and generate crap since he didn't
: understand the freedoms he was given and should exercise. independent
: thought is always better than groupspeak.

I do not talk as if methodology is THE answer.  It is an important
part of the answer.  There are many parts of the answer, some of which
are still clearly missing.  First of all, I have stated a goal of OO
methodologies--to make software engineering a repeatable process.
While it helps, it does not make the process completely mindless.
However, it does largley take away for the need of any creativity at
the programmer level.  Most creativity is required at the
architecture, A&D, and UI design levels.

:   GR> You don't even know what freedom is.

: i am free to laugh at your religious stance behind the OO shield. 

It is a good rhetorical device to take a belief which I will affirm
(that OO is important) and then dismiss that belief as religious.
After all, a religious belief is one without reason behind it.
Unfortunately, you have not in any way demonstrated that my belief in
OO lacks coherent reasoning.

: OO is
: no better than anything before since the average OO programmer still
: doesn't think about the important things, like names. and designing an
: OO project is no more than designing an API and look how many bad public
: API's there are. so OO will not make things more reusable. reusable code
: make more things reusable. the API is what is reused, object or no object.

The world has not arrived at OO software engineering yet, so I fail to
see how you can dismiss it as failed.

:   GR> You need to go back and learn what a structured process is. 

: funny, my first programming course was "structured programming in
: PL/I". and i don't like structures, they are too structured. :-)

This is irrelevant.  PL/I has NOTHING to do with this thread.

-- 
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: Sun, 20 Sep 1998 02:35:22 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <KRZM1.943$Ge.2549906@ptah.visi.com>

In comp.lang.java.programmer Russ Allbery <rra@stanford.edu> wrote:
: In comp.lang.perl.misc, George Reese <borg@imaginary.com> writes:

:> The freedom you talk about is why software engineering is such a voodoo
:> practice that results in gobs of absolute crap being produced.  Design
:> and naming things should be the result of a repeatable and structured
:> process.  That is what OO methodologies are.  Formatting is a function
:> of standard programming practices, or, better yet, a well structured
:> language like python.  Algorithms should be the result of proven design
:> patterns.

:> Otherwise, you are just talking voodoo.

: It sounds to me like you're arguing in favor of programming as a strict
: engineering discipline.  One has a set of pieces, and one builds things
: using them in a consistent and reproducible manner according to a strict
: set of plans.

: I treat programming like an art form.  Finding a new way to express
: something in a programming language is, to me, as much of a pleasure as a
: well-chosen turn of phrase in something that I'm writing.  I take pleasure
: in being succinct, and I take pleasure in being exact, and I like a
: language that can give me the flexibility to do things like that.

>From a *personal* point of view, both positions are equally valid.
Unfortunately, programming is not a solitary task like art where
beauty matters and functionality does not (that Tolstoy quote Larry
Wall mentioned now suddenly comes to mind).  Programming is about
constructing tools for other people to use (yes, people do write
programs for their own personal use, but I am clearly not referring to
that Vast minority).  As such, people want predictable behaviour.
They do not care how beautifully expressive the source code is.

: And to write things like my sig, which to me are to programming what poems
: like "Jabberwocky" are to the English language.

I certainly disagree with this :)  But one man's trash is another man's
art, eh? :) Like I said above, it is perfectly valid for you or anyone
else to derive their pleasure in coding from treating it as an art.
While that may be valid from the standpoint of your personal
motivation, it is not the reason that programming exists as a
profession today.  People pay you to deliver functionality, not code-art.

: Perhaps you're right, perhaps without the ability to write art, structured
: programming projects would be easier.  They'd certainly be a little less
: like trying to herd cats.  But see, without that aspect of programming,
: I'm not sure I'd program at all, so I have to question whether it would
: result in more code being written.

: I think it would certainly result in fewer programmers.

I disagree.  I would bet that the number of people who program for
this reason is rather small.  Whether or not that is true, there is
too much money in programming for the numbers to vanish simply because
the process is more like engineering than art.  Just look to the
industrial revolution for an example of how such things change.

-- 
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: Sun, 20 Sep 1998 02:18:15 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: script: scriptMangle!
Message-Id: <8clnnfcysu.fsf@gadget.cscaper.com>

>>>>> "Craig" == Craig Berry <cberry@cinenet.net> writes:

Craig> Ah, well.  The ultimate response when rational discussion
Craig> fails.  Fellow citizens of clpm, take note that I've done
Craig> nothing but ask Tom to clarify his moral, ethical, and
Craig> philosophical position on the free software question, in the
Craig> face of his vicious attacks on all other options.  Apparently,
Craig> he doesn't want to play that game.  So it goes...

Here's a simpler version of Tom's argument, using short words.

I have had to curse all too often at broken software on my client's
machines for which NO source was available, to help you make your
software hidden.

I just refuse to help you.  It's that simple.  If you're gonna do it,
don't let me know, and hope that I never have to cross paths with you
in a dark alley if I have to maintain mangled code you leave behind.

Bleh.

Code-hiding is painful for those of us that make a living helping
people in sometimes desperate situations.  Therefore, I can only
deduce that you are not interested in helping people.  That makes you
"evil" in my book.  <sigh>

Code-hiding also spits in the face of those people that brought you
Perl in the first place.  If it wasn't for open software, you wouldn't
be USING Perl.  How tough is that to figure out?

Tom has done a huge amount for the Perl community.  You are spitting
in his face, and yet you still want him to act civil.  Again, I hope I
never cross paths with you in a dark alley. :)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 20 Sep 1998 00:51:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Using templates...
Message-Id: <6u1jhm$71m$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, Wyatt Draggoo <phraktyl@home.com> writes:
:Mark-Jason Dominus wrote:
:> Why don't you look inside one of those modules and see how it is done?
:> 
:> That will tell you what is going on inside the module, and it will
:> also answer your question of how it can be done.
:
:Easier said than done - I've already tried it.  There were very few - if
:any - comments in the modules I looked at, and they were done with a lot
:of Perl-ish oddities.  The first one I looked at used about a 9 line
:regex with a lot of code inbetween that wasn't intuitive at all, and the
:others weren't much better.
:
:I know I could just use the code, but if I did that I might as well
:blindly use the module.

Personally, I tend to use this:

    sub template {
	my ($filename, $fillings) = @_;
	my $text;
	local $/;                   # slurp mode (undef)
	local *F;                   # create local filehandle
	open(F, "< $filename")      || return;
	$text = <F>;                # read whole file
	close(F);                   # ignore retval
	# replace quoted words with value in %$fillings hash
	$text =~ s{ %% ( .*? ) %% }
		  { exists( $fillings->{$1} )
			  ? $fillings->{$1}
			  : ""
		  }gsex;
	return $text;
    }

    <!-- simple.template for internal template() function -->
    <HTML><HEAD><TITLE>Report for %%username%%</TITLE></HEAD>
    <BODY><H1>Report for %%username%%</H1>
    %%username%% logged in %%count%% times, for a total of %%total%% minutes.

Pinched from the online code spoilers for PCB. :-)

--tom
-- 
: 1.  What is the possibility of this being added in the future?
In the near future, the probability is close to zero.  In the distant
future, I'll be dead, and posterity can do whatever they like...  :-) --lwall


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

Date: 20 Sep 1998 02:39:00 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: What does the + in print statement do?
Message-Id: <6u1ps4$dhd$7@client3.news.psi.net>

MS (webmaster@hubeicorp.com) wrote on MDCCCXLV September MCMXCIII in
<URL: news:36033029.2F0B1E6F@hubeicorp.com>:
++ 
++ I can't find that + sign mentioned in any of the books I have,

Try the Perl manual. It's there.



Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'


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

Date: Sun, 20 Sep 1998 01:41:02 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: what's wrong with win32 perl ?
Message-Id: <O2ZM1.312$_c5.2657845@news.shore.net>

Dan Nguyen (nguyend7@msu.edu) wrote:

: The problem is your compiler won't compile the C code that's required
: for XS based modules.  

XS seems to work okay with the recent Activestate port (when someone
uses a Microsoft C++ compiler).  Sarathy's "former" standard port
(5.004_02) had a working XS which could be utilized with a supported
compiler (VC++, Borland C++).

: Remember that Perl works best on Unix machines,
: but you can find free GNU C-compilers for win32's.

uwin: http://www.research.att.com/sw/tools/uwin/
gnuwin32/cygwin32: http://www.cygnus.com/gnu-win32
mingw32: see url above

--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>


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

Date: 20 Sep 1998 02:42:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: where is Date::Parse?
Message-Id: <6u1q27$dhd$8@client3.news.psi.net>

Russ Allbery (rra@stanford.edu) wrote on MDCCCXLV September MCMXCIII in
<URL: news:yld88sr202.fsf@windlord.stanford.edu>:
++ 
++ 
++ You have your tools, I have mine.  That's not one of mine.  I highly
++ dislike automated installation procedures, particularly ones that keep
++ their own databases and don't integrate well into the package management
++ schemes that I already have.  I suppose it rocks for people who like it;
++ I'm not one of those people.


I recently fixed my CPAN.pm:  rm -f CPAN CPAN.pm



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

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

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