[11139] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4739 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 25 00:07:26 1999

Date: Sun, 24 Jan 99 21:00:15 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 24 Jan 1999     Volume: 8 Number: 4739

Today's topics:
        Book: Perl Power! (shameless plug) (Michael Schilli)
        CGI.pm ? How can i install CGI.pm to my Unix server ..t <kspenta@netcom.ca>
        Date actions using flatfile database <me@me.com>
    Re: File Upload (Again :-) ) <eugene@snailgem.org>
    Re: Help - file output problem <uri@home.sysarch.com>
    Re: How long would the Unixes last without Perl? <eugene@snailgem.org>
    Re: How to sort (brian d foy)
    Re: installation of Perl on Digital Unix scraig@my-dejanews.com
        installing perl <garry@avnet-pacific.com>
    Re: Newbie question: writing file <chester@ma.ultranet.com>
    Re: package context in evals/subrefs (Sean McAfee)
    Re: Perl Criticism topmind@technologist.com
    Re: Perl Criticism topmind@technologist.com
    Re: Perl Criticism topmind@technologist.com
    Re: Perl Criticism topmind@technologist.com
    Re: Perl Criticism topmind@technologist.com
        Spell checking form...Win95 bryf128@my-dejanews.com
        wierd headers in html <dave@northnet.com.au>
    Re: Writing files (Larry Rosler)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 25 Jan 1999 04:55:57 GMT
From: schilli@tep.e-technik.tu-muenchen.de. (Michael Schilli)
Subject: Book: Perl Power! (shameless plug)
Message-Id: <78gtgt$756$1@sparcserver.lrz-muenchen.de>

Hi all,

just wanted to let everyone know that my new book hit the shelves:
"Perl Power -- A JumpStart Guide to Programming with Perl 5"
published by Addison-Wesley 1999.

My approach is to jump-start readers on Perl basics, then moving on
quickly to object-oriented programming, explaining common recipes to
real-world problems. Excercises with full solutions along the way!

And, then, here it comes:

* Internet programming! Both sides, 

  - web clients (how to get your usenet news automatically, check if 
                 web pages have changed, get FTP data, extract links
                 from HTML pages) and
  - web server applications (CGI-programming: shopping carts, a 
                             email registration system) 
  are covered in detail.

* A chapter on popular modules shows how to tackle common calendar
  problems, charting, tar-archives, text wrapping, and command option
  wrangling.

* A full chapter on quickly spicing up your scripts with graphical
  user interfaces using Perl/Tk.

I tought, I'd let you guys know this ... and I really apologize for
the shameless plug :), but I really think it's worth checking out:
http://perlpower.com if you're interested.

Enjoy, and let me know what you think!

-- Michael

--------------------------------------------------------------------------
  Michael Schilli                     More Info:   http://perlmeister.com
--------------------------------------------------------------------------


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

Date: Sun, 24 Jan 1999 22:22:20 -0800
From: "Penta kathir" <kspenta@netcom.ca>
Subject: CGI.pm ? How can i install CGI.pm to my Unix server ..t hank
Message-Id: <ijRq2.489$134.5335@tor-nn1.netcom.ca>

Hi there
I would like to install cgi.pm to my unix server ..could you please tell me
how can i do it .. thanks in advance ..
sutha





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

Date: Mon, 25 Jan 1999 03:15:10 -0000
From: "Steve" <me@me.com>
Subject: Date actions using flatfile database
Message-Id: <78gnku$au2$1@news4.svr.pol.co.uk>

Hi,

I have setup a flatfile database for a shopping cart script. For each item
in the database, I have added the release date of the item in the format
DDMMYY (European). I have read all the help files and manual pages but they
don't seem to helpful for what I need to do.

The date entry of DDMMYY is defined as $releasedate.

The two things I need to do is:

1. Print the date in the format: DD/MM/YY (with the forward slashes) - how
can I do this?

2. Compare the date in the database with the current system date. If the
date in the database has passed already, I want it to print "available now",
if it hasn't arrived yet I want it to say "coming soon". And if the date has
passed in the last 14 days, I want it to say "new release". Anyone know how
I can do this?


I'm not that experienced with perl, but if anyone can write some code for me
I would really appreciate it.

Thanks.





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

Date: Sun, 24 Jan 1999 23:31:31 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
Subject: Re: File Upload (Again :-) )
Message-Id: <36ABF3A3.D2138D33@snailgem.org>

Nima Mortazavi wrote:
> 
> Hi
> 
> Has some one here try file upload function in Cgi.pm
> with BINARY file in IIS/NT inviroment ?
> 
> My code works fine with text file, but not with any other binary format :
> 
> =====================
> use CGI ;
> use CGI::Carp qw/fatalsToBrowser/;
> 
> $query = new CGI;
> $file_name = $query->param('filer');
> 
> binmode FH;
> open (OUTFILE,">/temp/nima.exe");
> 
> undef $BytesRead;
> undef $Buffer;
> while ($Bytes = read($file_name,$Buffer,1024)) {
>   $BytesRead += $Bytes;
>   print OUTFILE $Buffer;
> }
> close($file_name);
> close(OUTFILE);
> exit ;
> =============================

Why are you using CGI::Carp qw/fatalsToBrowser/ if you're not checking
return values?

-- 

Eugene

 "I have an Apache Web Server that uses CGI forms written in COBOL."
 							Post in clpm


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

Date: 24 Jan 1999 22:24:53 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Help - file output problem
Message-Id: <x7iudwt4oq.fsf@home.sysarch.com>

>>>>> "DS" == Dale Sutcliffe <dales@enhanced-performance.com> writes:

  >> 
  >> open(FILE, "+< $secfile") || die "Error cannot
  DS> open $secfile: $!\n";
  >> while (<FILE>) {
  >> 
  >> >    print FILE
  DS> $LoL[$i][0],"|",$LoL[$i][1],"|1|\n";
  >> ^
  >> Is that the "extra" | of which you speak?------'

  DS> No, there are several extra |
  DS> I use the | as deliminators and what results is
  DS> several extra | although
  DS> the program should just be going through the array
  DS> and printing out what
  DS> was put in.  It is almost as if the program is
  DS> flushing before closing.

first off, johnathon was right about your code using improvements. not
only do you have extra braces and such, why do you loop again to scan
for the input when you can do it during the read loop.

but asto your extra |'s, it seems you are writing out less data than you
are reading in.

these are the 2 print statements and the first is the new record and the
second is the original (right?). if so, then you are not truncating the
file before you write to it so the trailing data from the old version is
still there.

        print FILE $LoL[$i][0],"|",$LoL[$i][1],"|1|\n";

        print FILE $LoL[$i][0],"|",$LoL[$i][1],"|",$LoL[$i][2],"|\n";

there are several ways to fix this. one is to write to a temp file and
rename it to the old. or you could truncate to 0 (truncate function) the
file after the reading is done (which is risky if the program crashes
then, you lose the file), and then do the writing. or you could truncate
to the new size after you are done writing (use stat or seek to get the
new file size.

i prefer the temp file and rename as it is much safer.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Sun, 24 Jan 1999 23:20:47 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <36ABF11F.C0F8A4B1@snailgem.org>

Clay Irving wrote:
> 
> In <78b40v$pkn$2@client2.news.psi.net> abigail@fnx.com (Abigail) writes:
> 
> >Doesn't HP ship perl4 by default? And doesn't RedHat come with some
> >form of Perl?
> 
> RedHat does come with a perl5 distribution...

RedHat does indeed install Perl.
The problem with RH, however, is that they grab whatever looks like the
latest Perl distro and blindly rpm it for distribution.
After upgrading to RH 5.2, for example, here's what I have:
perl -V 
 . . . . .
Locally applied patches:
        MAINT_TRIAL_4 - 5.004_05 maintenance trial 4
 . . . . . .

They have also distributed an rpm that installs Perl with threads
enabled ;----(

-- 

Eugene

 "I have an Apache Web Server that uses CGI forms written in COBOL."
 							Post in clpm


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

Date: Sun, 24 Jan 1999 22:09:36 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to sort
Message-Id: <comdog-ya02408000R2401992209360001@news.panix.com>

In article <36ABD928.3287@netins.net>, johkar@netins.net posted:

> I want to modify a Free for All Links Script that I got off a perl
> site.  It works great except that it puts all the new links on the
> bottom of the list instead of the top. The perl file stores the links in
> a flat text file and assigns a unique $id to each row added.

just read the created list backwards.  the smallest change to the 
script may involve using reverse() in front of something.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Mon, 25 Jan 1999 04:22:42 GMT
From: scraig@my-dejanews.com
Subject: Re: installation of Perl on Digital Unix
Message-Id: <78grib$rml$1@nnrp1.dejanews.com>

In article <7899ef$sd66@inet6.citec.com.au>,
  "David Ahrens" <david.ahrens@dnr.qld.gov.au> wrote:
> Trying to install the latest version of Perl on Digital Unix system
> results in the following error (half way through make process.
>
> AutoSplitting perl library
>
> ./miniperl -Ilib -e 'use AutoSplit; autosplit_lib_modules(@ARGV)' lib/*.pm
> lib/*/*.pm
>
> Package Getopt::Long (Getopt/Long.pm) does not match filename
> lib/getopt/long.pm at
>
> lib/AutoSplit.pm line 244, <IN> chunk 58289.
>

I looked in AutoSplit.pm and the line that matches this error message is:

 die "Package $package ($modpname.pm) does not match filename $filename"
            unless ($filename =~ m/\Q$modpname.pm\E$/ # or other stuff
                    )

The failure is because AutoSplit expects the file to be called Getopt/Long.pm,
not getopt/long.pm.  It is in mixed case on my system.  Maybe try changing the
filename to mixed case.


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 25 Jan 1999 15:03:18 +1100
From: "Garry Baker" <garry@avnet-pacific.com>
Subject: installing perl
Message-Id: <36abee7e.0@news.iprolink.co.nz>

i wish to install perl on my sco box but the install script needs to use
"make" which my machine does not have. can i get around this someway???




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

Date: Sun, 24 Jan 1999 22:19:29 -0600
From: "Kevin D. Chester" <chester@ma.ultranet.com>
To: scott.craig@moh.hnet.bc.ca
Subject: Re: Newbie question: writing file
Message-Id: <36ABF0CF.50BB5457@ma.ultranet.com>

Hello Again,

I guess maybe I have not furnished enough info. Here is the tokens dir.
permissions:

drw-rw-rw-  2 beanbag  wheel     512 Jan 23 02:36 tokens

Perl script:
#! /usr/local/bin/perl5.003
require 5.000;
$|=1;       ## Don't buffer output
print "Content-type: text/html\n";
$curr_dir = '';
$use_cookies = 'yes';
$server_address  = 'beanbag.web2010.com';
$cgi_directory  = '/cgibin/shop';
$token_directory   = $curr_dir . 'tokens';
$company_email  = 'info@bag.com';
$action = $input{'ACTION'};
if ( (uc substr($action,0,5) eq 'ENTER') ||
             (uc substr($action,0,5) eq 'GO TO') ||
             (   substr($action,0,2) eq '->')    ||
             (   substr($action,0,1) eq '[')  ) {

             if ($input{'ORDER_ID'} eq '!ORDERID!')
                      {
                      $token_exists = 0;

                      if ((lc $use_cookies eq 'yes') &&
(defined($ENV{'HTTP_COOKIE'})) )
                                   {
                                   ### RETRIEVE COOKIE HERE AND CHECK IF TOKEN &
TEMP_ORDER
                                   ### STILL EXISTS AND ASK IF USER WANTS TO
CONTINUE OLD ORDER
                                   %Cookies = map split (/=/), split (/;
/,$ENV{HTTP_COOKIE});
                                   $unique_id = $Cookies{'orderid'};
                                   if ( $unique_id !~ /\d{$id_length}?/ )
                                            {&Transmission_error(0);}

                                   $token_file_name =
"$token_directory/$unique_id";
                                   $order_file_name =
"$temp_orders_directory/$unique_id";
                                   $customer_file_name =
"$temp_customers_directory/$unique_id";

                                   if (-e $token_file_name) {
                                            $token_exists = 1;
                                            if (-e $order_file_name) {
                                                     unlink $customer_file_name;
                                                     print "\n";
                                                    ##This area just prints out
an HTML page
                                                     exit;
                                            } #order file exists
                                   } # token file exists

                          } ##using cookies and have a cookie

                          if ($token_exists == 0) {
                                   srand(time() ^ ($$ + ($$ << 15)));
                                   $rand_len = '9' x ($id_length - 3);

                                   do                {
                                                       $unique_id =
&zero_fill(abs($$),3) . &zero_fill(int(rand($rand_len)),$id_length - 3);
                                                       $token_file_name =
"$token_directory/$unique_id";
                                                       }
                                   until (! (-e $token_file_name)); ### Now check
if really unique (i.e. does it already exist?)

                                   ### Create a random token to use with SHA
signature
                                   $token = int(rand(1000000));

                                   open(token_file, ">$token_file_name") ||
&err_trap("Cannot open $token_file_name for writing: $!\n");
                                   print(token_file "$token\n");
                                   close token_file;
                          }

                          if (lc $use_cookies eq 'yes')
                                   {
                                   &create_cookie('orderid', $unique_id,
$cookie_expire_days);
                                   print "\n";
                                   }
             }
             else
                         {&Transmission_error(1);}
}
##More of the sript follows
sub  err_trap {

 my $errmsg  = $_[0];

 print "\n\n<center><b>A serious error has occured.<br>Please contact: <a
HREF=\"mailto:$company_email\">$company_email</a> and tell them ";
 print "the error message below, and the exact sequence of events that led to the
error.<br>Thank you.<br><br><i>$errmsg</i></b></center>";
 exit;
}
sub  error_trap {err_trap(@_)}

And this is the end of the script. When I attempt to run/enter the HTML page that
starts the script I get the following error message:

A serious error has occured.
  Please contact: info@bag.com and tell them the error message below, and the
                   exact sequence of events that led to the error.
                                 Thank you.

            Cannot open tokens/135578410 for writing: Permission denied

I believe that the number"135578410" is the random number the script created. Is
my problem the script or the server that I'm tring to run it on?

Thanks for all you help!

Kevin



scott.craig@moh.hnet.bc.ca wrote:

> Are you sure tokens is an existing directory under the current working
> directory? Do you have permission to write to it? If file 262805729 already
> exists there, do you have permission to overwrite?
>
> You may have to create the tokens directory with mkdir, or change permissions
> with chmod.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own





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

Date: Mon, 25 Jan 1999 04:56:37 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: package context in evals/subrefs
Message-Id: <9QSq2.3715$Ge3.16443595@news.itd.umich.edu>

In article <78dpcb$ng6$1@nntp6.u.washington.edu>,
Brad Fitzpatrick <bradfitz@bradfitz.com> wrote:
>I'm doing exactly that, as I was before, but the $sucked_in_code doesn't
>seem to be running in the foreign package.  It can see a bunch of variables
>that are declared in the package that I run the eval from.  This seems to be
>closure-like behavior.

>How can I *disable* closures?  I want evals and anonymous subs to run from
>the context at which I call them.

For eval:

{ package Foo; eval '$x = 10' }
print $Foo::x;  # prints "10"

For anonymous subs or closures, this won't work, as the package that
unqualified global variables refer to is fixed at compile time.  If you
know ahead of time which global variables are going to be accessed by the
sub, you can alias them before calling the sub, like so:

$sub = sub { print ++$x };
$x = 10;
$Foo::x = 20;
&$sub;  # prints "11"

# Now I want the global "x" in the above subroutine to refer to the "x" in
# package Foo:
{ local *x = \$Foo::x; &$sub; }  # prints "21"

But if you *don't* know ahead of time, then the best you can is to alias
the other package's entire symbol table:

my $sub = sub { print ++$x };
$x = 10;
$Foo::x = 20;

my @symbols = grep {
	!/\W/  # weed out most Perl builtin globals
	&& !/^std(?:in|out|err)$/i  # don't alias standard in/out/err streams
	# and so on, for every other builtin Perl global variable (to be safe)
} keys %main::;
my $str = join("; ", map { "local *$_ = *Foo::$_" } @symbols) . '; &$sub';
eval $str;  # prints "21"

But even this nasty bit of skulduggery isn't guaranteed to always work,
thanks to Perl's dynamic nature; replace "$sub = sub { print ++$x }"
above with "$sub = eval 'sub { print ++$x }'" and eliminate the "$x = 10"
line, and it breaks.

I suppose a Perl Guru could write a C extension that would traverse an
anonymous subroutine's opcode tree and produce a duplicate subroutine in
which the package of all global variables is replaced with another, but it
would hardly be worth the effort.

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Mon, 25 Jan 1999 03:36:07 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <78gor6$pvb$1@nnrp1.dejanews.com>

In article <36aba8a7.291102@news.skynet.be>,
  bart.lateur@skynet.be (Bart Lateur) wrote:
> Gregory Snow wrote:
>
> >Here is my answer to your challange:
>
> >  open(IN, "myfile.dat") || die "unable to open myfile.dat: $!\n";
>
> >Your alternative would be something like:
>
> >  if( !open(IN, "myfile.dat") ){
> >    die "unable to open myfile.dat: $!\n";
> >  }
>
> >Correct?  (ignoring how you might phrase the error differently).
>
> This is one of my favorite examples too. The second solution (let's call
> it "the C-like version") feels patricularily awkward, because it puts
> the stress on the "if". The fact that it opens a file, is a mere side
> effect which could just a well be ignored. Well, that what it looks
> like.
>

How do you measure where the "stress" is?

IF statements are very important to program flow.
I also think it is a mistake to put an 'end program'
to the far right.

Anyhow, I prefer that OPEN *return* a file handle, which
is negative if error. Example:

  handle = open(filename)
  if handle < 0
    die "Problem opening file $filename$"
  endif


> The short-circuit version says to me: "Let's open a file, and if that
> fails, die." The code agrees with this thought sequence. In contrast,
> the C-like version looks turned inside-out.
>
> 	Bart.
>


I still don't buy your justification for ||
It has too many faults and alternatives.

But, at least you are focusing on ideas instead of
witchhunts and background checks. Kudos to you for that.

-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 25 Jan 1999 03:44:28 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <78gpaq$qa9$1@nnrp1.dejanews.com>

In article <78g76e$16sq$1@nntp6.u.washington.edu>,
  snow@biostat.washington.edu (Gregory Snow) wrote:
> In article <783lia$b21$1@nnrp1.dejanews.com>,
>  <topmind@technologist.com> wrote:
> >In article <x767a3g6h3.fsf@home.sysarch.com>,
> >  Uri Guttman <uri@home.sysarch.com> wrote:
>
> >
> >I asked for examples from yous of indespensable Perl cryptology
> >and nobody showed any. Unless you produce some Uri, you are
> >a hypocrite.
>
> But Uri has posted code (specificaly as a follow-up extension to one
> of my posts) and is not a hypocrite.
>
> Let's look at your challenge, I think I can answer it with 1 line of
> Perl code, but first I want to make sure that we understand the true
> challange (I don't work for the NSA and know little about true
> cryptology).
>
> There seem to be 2 main points to your posts and challange:
>
> 1.  Maintainability, especcialy by someone else, is the most
> important, i.e. given 2 pieces of code that instruct the computer to
> do the same thing, the better code is the one that someone other than
> the author has an easier time understanding.
>


Note the MOST important, but certainly important.



> Am I correct there?  Is that a fair comparison for determining the
> best code?  Can something be considered indespensible if removing
> makes the code harder for a second person to easily read/understand
> it?
>
> 2.  Your main complaint against Perl seems to be that there is more
> than one way to do something, and you especcialy dislike using
> shortcut boolean operators in place of conditionals.


"Shortcut" I think not. My language suggestions provide for:


If not open(handle,filename) do die "Cant open $filename$"

Which is not significantly different. "Do" means one
statement on the same line as a control statement.
(It was a suggestion, not a instantance.)


>
> Am I correct?
>
> Here is my answer to your challange:
>
>   open(IN, "myfile.dat") || die "unable to open myfile.dat: $!\n";
>
> (this should have you cringing if my #2 above was correct)
>
> Your alternative would be something like:
>
>   if( !open(IN, "myfile.dat") ){
>     die "unable to open myfile.dat: $!\n";
>   }
>
> Correct?  (ignoring how you might phrase the error differently).
>
> Let's compare the 2 based on the readability criterion above (note
> that since we are talking about a 2nd person reading the code, saving
> keystrokes is irrelivant).
> [snip]



Please see my reply to Bart's statement about your example.



-------------------------------------------------------------------------------
>      Gregory L. Snow         | MATZ'S RULE REGARDING MEDICATIONS:
>      (Greg)                  |   A drug is that substance which, when injected
> snow@biostat.washington.edu  |   into a rat, will produce a scientific report.
>

-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 25 Jan 1999 03:53:50 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <78gpsb$qfq$1@nnrp1.dejanews.com>

In article <fl_aggie-2401991223510001@aggie.coaps.fsu.edu>,
  fl_aggie@thepentagon.com (I R A Aggie) wrote:
> In article <78bb49$p3$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>
> + In article <78a4cl$h97$2@newshost.oracle.co.uk>,
> +   dherriot@uk.oracle.com (Des Herriott) wrote:
>
> + > It's possible to write unmaintainable code in any language.
> +
> + If I hear this flippen' MYTH
>
> Proof, please.


Mathematical?


>
> + stated one more time, I am going to
> + have Norton classify Perl as a virus.
> +
> + ALL
> + LANGUAGES
> + ARE
> + NOT
> + EQUALLY
> + ABUSABLE
> + !!!!!!!
>
> I believe the claim is "unmaintainable code", which is the ultimate
> abuse.
>
> + I am not going to explain it again.
>
> Show me a language that makes the programmer use _useful_ variable names.
> Show me a language that makes the programmer use subroutines and functions.
> Show me a language that makes the programmer write comments as he goes along.
> Show me a language that makes the programmer write a manual.
>


These are only SOME of the total different ways to abuse
a language.

Although I am not much of a Java fan, Java is much tougher to abuse than
Perl. There are no pointers and it is easy to tell what is
a function, a variable, an assignment, etc. There is also
less "hidden communication" between operations.

Pascal has similar properties.

(I am not promoting Java and Pascal, only pointing to them
to help compare.)

How about somebody take that cryptical signiture that
somebody here keeps posting at the bottom and turn it
into Pascal or Java. Let's see if they can make it
equally confusing to reverse engineer.


> James
>

-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 25 Jan 1999 03:59:16 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <78gq6h$qq2$1@nnrp1.dejanews.com>

In article <fl_aggie-2401991214540001@aggie.coaps.fsu.edu>,
  fl_aggie@thepentagon.com (I R A Aggie) wrote:
> In article <slrn7aisnh.pa1.dformosa@godzilla.zeta.org.au>,
> dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:
>
> + In article <78b8n4$uo3$1@nnrp1.dejanews.com>, topmind@technologist.com
wrote:
> + [...]
> +
> + >I am only pointing out it's flaws as a general-purpose language.
> + >I would rather see a new language than a fixed Perl.
> + >
> + >BTW, why is it so important to have "more than one way"
> + >to write an IF statement? Variety || die?
> +
> + Because we are not all the same people, because people like to express
> + things in diffrent ways.  Because they wish to emphasise diffrent points.
>
> Because it allows you to express beauty in your code? topmind would likely
> ban Perl Poetry.



"express beauty in your code?"  Exactly what is that?
Is that a selling point in your Perl brochure?

"How will that help my bottom line?" a manager may ask.

I am not for banning, BTW. You are trying to paint me as
an Orwellian villian.

(Again, I am middle of the road with regard to maintainability
and readability. There are groups far more extream than me.
To them, any scripting {loosely typed} language is evil.)



>
> James
>

-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 25 Jan 1999 04:19:57 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <78grd7$rkb$1@nnrp1.dejanews.com>

In article <slrn7aij5v.9ar.sholden@pgrad.cs.usyd.edu.au>,
  sholden@cs.usyd.edu.au wrote:
> On Sat, 23 Jan 1999 02:11:27 GMT, topmind@technologist.com wrote:
> >> It's possible to write unmaintainable code in any language.
> >
> >If I hear this flippen' MYTH stated one more time, I am going to
> >have Norton classify Perl as a virus.
>
> OK back that up, what language is it impossible to write unmaintainable code
> in. Point me to a freely available interpreter/compiler and the language
> docs and I'm willing to have a crack at the impossible and write some
> unmaintainable code.
>


You are missing my point. I already had this discussion.
However....


> >
> >ALL
> >LANGUAGES
> >ARE
> >NOT
> >EQUALLY
> >ABUSABLE
> >!!!!!!!
>
> That is not what the post claimed, that is irrelevant.
>
> All that should matter is 'does the language make it hard to write
maintainable
> code'. If so then don't use the damn language for 'real' code.
>
> >I am not going to explain it again.
>
> Could you please post a reference to your first explanation... since I
> for one missed it (this thread is huge and I haven't attempted to read
> everything in it - thankfully).


It has gotten too huge for me also.
I don't really know of a solution
Other than fancy software.


>
> >> I've
> >> written plenty Perl in my time, and haven't had a complaint about
> >> maintainability from my colleagues yet, because in 'production' code, I
> >> make a considerable effort to avoid obfuscation.
> >>
> >
> >
> >Extrapolation Alert!
>
> But if someone doesn't make an effort to avoid obfuscation (that's the wrong
> phrase really, should be something along the lines write readable code - the
> positive not negative version) then they should not be employed as a
> programmer.
>



"Should not", yes. "Do not", no.


Again, I am middle of the read with regard to readability
and maintainability. Perlers are to the far right on this.



> It's perfectly possible to burn down a house by attempting to rewire it.
> That's why people that can't do it safely shouldn't be employed as
> electricians.
>
> The tool (programming language in this case) shouldn't strive to make it
> impossible to do all bad things. It should strive to make it easy to do
> good things.
>
> Perl does prevent you from doing some 'bad things' (unless you use another
> langauge to write an extension but that is out of perl's hands), just as
> a crushing machine s designed to try to prevent the operator from falling
> in. Perl does not stop you from doing all bad things, just as the crushing
> machine doesn't prevent someone from throwing someone else into it (since
> you might very well want to crush a person sized box or whatever).
>
> I'm sure if you try hard enough you can work around perl's attempt to stop
> you doing some bad things (overwriting the memory space of the interpreter
> itself for example), just as if the operator really wants to, he can get
> himself crushed by the machine.
>
> I think you are barking up the wrong tree. Make the good easy to do and you
> won't have to worry about people doing the bad...


One is a "top-end" problem and one is a "bottom-end" problem.
I see them as relatively independant issues.


>
> --
> Sam
>
> Even if you aren't in doubt, consider the mental welfare of the person
> who has to maintain the code after you, and who will probably put parens
> in the wrong place.	--Larry Wall
>

-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 25 Jan 1999 03:05:24 GMT
From: bryf128@my-dejanews.com
Subject: Spell checking form...Win95
Message-Id: <78gn1f$ooi$1@nnrp1.dejanews.com>

Greetings all.

I need to come up with a way to spell check a form's text area.  Something
similar to dejanews post page.  I looked at ispell but that appears to be unix
specific.

Any suggestions?

Thanks,
Brian

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 25 Jan 1999 14:28:39 +1100
From: David Nillesen <dave@northnet.com.au>
Subject: wierd headers in html
Message-Id: <36ABE4E7.CF749801@northnet.com.au>

I have been happily using CGI.pm and the "print headers" method to print
my headers for the html, however now i need to print it by hand. 
So i just go print "content/type etc etc" ( i copied it exactly from the
CGI.pm output, same number of newlines and all) but it keeps getting
sent to my brwoser as a saveable file.
Is there some invisible ctrl charachters at the start or something or
tricky?

OR just point me at the appropriate faq etc etc

thanks very much.
-- 
David Nillesen
dave@northnet.com.au 
Northnet Internet Services (02)67749300


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

Date: Sun, 24 Jan 1999 20:52:34 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Writing files
Message-Id: <MPG.11159864dd88f75f9899bb@nntp.hpl.hp.com>

In article <36AA7807.D79A0418@snailgem.org> on Sat, 23 Jan 1999 20:31:51 
-0500, Eugene Sotirescu <eugene@snailgem.org> says...
> R. Alcazar wrote:
> > All I wanna do is open a file (thus, creating a new file) inside of a
> > directory store in my webserver.  However, it fails and returns an error:
> > permission denied.  Such that:
> > 
> >     open(SOMEFILE, "/somedirectory/somefile.txt") || die "$!\n";
> 
> Your line probably is:
> 
> open(SOMEFILE, ">/somedirectory/somefile.txt") || die "$!\n";
> 
> i.e. you're creating a file by opening it for writing.
> 
> But WHO's actually trying to do the writing? Well, it's your script. And
> who is the user of that script? If you're running it as a CGI script,
> the user is your server, usually designated as user 'nobody', a user
> with low privilges. Of course it can't write to a file unless that file
> is owned by 'nobody' or has world write permissions . . .

The issue is not only permissions on the file, but first of all on the 
directory in which the file is being created.  The way to allow the user 
account under which the webserver is running to create a file in a 
diretory that you own -- without it being 'world-writeable' (0777) -- is 
to use the group permissions (0775 or 0770).

Ask your system administrator to make your user account and the 
webserver user account be members of the same group (perhaps a new group 
created specificaly to facilitate this sharing of write-permission).  Of 
course, anyone else who can install a CGI program on the server can now 
write in or delete from 'your' directory, but there's no way around 
that.  Anyone with that capability should be a trusted user.

As for the files created, you can either chmod them to 664 or 660 after 
they are created or execute a umask statement in your own CGI program 
before they are created.

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


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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