[13415] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 825 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 16 23:07:33 1999

Date: Thu, 16 Sep 1999 20:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <937537507-v9-i825@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 16 Sep 1999     Volume: 9 Number: 825

Today's topics:
        A question about some functions from CGI.pm. <zzhang@bayou.uh.edu>
    Re: better soundex/metaphone? (Eric Bohlman)
    Re: can i get a witness? (Eric Bohlman)
    Re: CGI cannot open relative path (Kragen Sitaker)
    Re: CONTEST: Range Searching (Benjamin Franz)
    Re: CONTEST: Range Searching (Benjamin Franz)
    Re: ENOWORD: Referer <sjs@yorku.ca>
    Re: Help needed about SENDMAIL! <2bunnyhop@home.com>
    Re: Help needed about SENDMAIL! <makkulka@cisco.com>
    Re: Help needed about SENDMAIL! (Kragen Sitaker)
    Re: How can I know if string have points? (Kragen Sitaker)
    Re: how to mkdir on NT with Perl <2bunnyhop@home.com>
    Re: how to mkdir on NT with Perl (Martien Verbruggen)
        Looking for a certain guestbook which contains the foll <rhanson@artschool.com>
    Re: Looking for tools. <craigo3@home.com>
    Re: Making and using a DB. (Help!!!) (Eric Bohlman)
    Re: NDBM_File problem. (Leslie Mikesell)
    Re: NDBM_File problem. (Leslie Mikesell)
    Re: Parsing Tab Delimited File (Kragen Sitaker)
    Re: PERL (cgi) and Databases -> How To? <madebeer@igc.apc.org>
    Re: Reading files from other systems <2bunnyhop@home.com>
    Re: script to dynamically produce standard calender (Eric Bohlman)
    Re: Splitting a line and honoring "strings" (Abigail)
    Re: trimming spaces from a string (Kragen Sitaker)
    Re: Two dimensional array <bie@connect.ab.ca>
        What happens with this slice? <alex@kawo2.rwth-aachen.de>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 16 Sep 1999 21:04:41 -0500
From: "zzhang" <zzhang@bayou.uh.edu>
Subject: A question about some functions from CGI.pm.
Message-Id: <7rs7hd$hgg$1@Masala.CC.UH.EDU>

When use the CGI.pm, is there a way to change the font, font size, font
color, etc of  the captions of a  radio group, check box and such? Or they
are controlled only by the browser? Thanks.

zz
zzhang@bayou.uh.edu






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

Date: 17 Sep 1999 01:45:18 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: better soundex/metaphone?
Message-Id: <7rs6fe$b24@dfw-ixnews6.ix.netcom.com>

Dheera (dheera@usa.net) wrote:
: Here's what I want to do:
: walk,walking,walked should have exactly the same code; it should cut
: out any suffixes or endings such as ing,ed,er, etc. After this I could
: pipe it into metaphone or whatever.

The technical term for what you want is 'stemming.'  In addition to 
Lingua::EN::Inflect, there's a module called Porter.pm (named after the 
author of the particular stemming algorithm it implements) floating 
around somewhere, quite possibly on CPAN.



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

Date: 17 Sep 1999 02:10:18 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: can i get a witness?
Message-Id: <7rs7ua$b24@dfw-ixnews6.ix.netcom.com>

Jonathan Cooper Weiss (jcweiss@cats.ucsc.edu) wrote:
: anyway, i have since left the project (due to previous time commitments)
: only to be informed by my past employers that their potential new guy
: seems to think that PERL is a bad choice for such systems. memory issues
: notwithstanding (i figured it was worth a little RAM for the performance
: benifits of the preloaded code and DB connections), i find it hard to
: believe that a C solution (which is the only "superior" alternative i can
: imagine he was talking about) would be incomparably better. not having a

Oftentimes when people argue that "Perl" is a bad choice for a 
generate-everything-dynamically Web site, they really mean "Perl programs 
run in a traditional CGI new-interpreter-process-per-hit manner."  They 
usually propose ASP with VBScript or Java Servlets as the "superior" 
alternative.  Either they don't understand the difference between a 
language and a deployment mode, or they deliberately try to confuse the 
issue.



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

Date: Fri, 17 Sep 1999 01:19:40 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: CGI cannot open relative path
Message-Id: <MGgE3.15315$N77.1149349@typ11.nn.bcandid.com>

In article <37E1450D.DEC6F09C@ingress.com>,
Ethan H. Poole <ehpoole@ingress.com> wrote:
>Randal L. Schwartz wrote:
>> Ethan> executing script by examining $0 ($ zero).
>> This is merely a hint.  It's user-defined data,
>
>Actually it is user *definable* not user-defined.  At startup it contains
>the name of the script.

At startup on Unix platforms, it contains whatever was passed by the
program that invoked the script as argv[0] -- which can be anything.

I don't know about Win32 platforms.

>Yes, the user *can* change it (on some platforms only).  However, in most
>instances the 'user' is the script and the programmer has control over
>that possibility.

The programmer only has control over that possibility on Unix if they
keep anyone else from executing their script.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Fri, 17 Sep 1999 02:21:57 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: CONTEST: Range Searching
Message-Id: <9BhE3.630$Qx1.33081@typhoon01.swbell.net>

[reposted because my ISP doesn't have clp.moderated marked
 as a moderated group]

In article <37e1043e@cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>
>So here's the challenge: devise idiomatic solutions to the
>following problems.  
>
>    1) Write a "patfore" program that prints out up to N lines
>       before the match as well as the match itself.  Here's
>       the usage message:
>
>	    patfore [-B N] pattern [files ...]

Only have the free time for one of them.
Not as elegant as some of the others, but it works,
is fast, and is conservative with resources.

#!/usr/bin/perl -w

use strict;
use Getopt::Long;

my $opts = {};
GetOptions($opts,'B=i');
my $last_n = defined ($opts->{'B'}) ? $opts->{'B'} : 0;

my $pattern   = shift; 
if (not defined $pattern) {
	die <<"USAGE";
patfor [-B N] pattern [files ...]
USAGE
}

my @file_list = @ARGV;

if (0 == @file_list) {
	push (@file_list,'-')
}	
$last_n++;
while (my $file_name = shift @file_list) {
	my $open_name = $file_name;
	if ($file_name eq '-') {
		$open_name = "<&STDIN";
		$file_name = '';
	} else {
		$file_name .= ':';
	}	
	if (not open (THE_FILE,$open_name)) {
		warn("WARNING: Unable to open '$open_name' ($!) - skipping\n");
		next;
	}
	my @circular_buffer = ();
	my $buffer_pointer  = -1;
	my $buffer_n        = 0;
	my $last_line       = 0;
	while (<THE_FILE>) {
		chomp;
		$buffer_pointer++;
		$buffer_pointer %= $last_n;
		$circular_buffer[$buffer_pointer] = "$file_name\[$.] $_\n";
		$buffer_n++ if ($buffer_n != $last_n);
		if (m/$pattern/o) {
			my $buffer_offset = 1 - $buffer_n;
			if (($. + $buffer_offset) <= $last_line) {
				$buffer_offset = $last_line  - $. + 1;
			}
			my $start_at = $buffer_pointer + $buffer_offset;
			print join('',@circular_buffer[$start_at..$buffer_pointer]);
			$last_line = $.;
		}
	}
	close(THE_FILE) || die ("Failed to close handle for file '$open_name': $!\n");
}

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

The following is not runnable code - it just looks like it.
It is actually the test set data. The words 'TEST' and 'test'
are the targets. Their distribution allows the testing
of first occurance before buffer fill, adjecent lines, 
non-adjecent but overlapping ranges, first occurance
with buffer filled, second occurance with buffer fill,
second occurance before buffer full, etc. Running
 ./patfore -B test N < testfile and varying N from 0
to 8 is _very_ effective in finding broken edge cases.

#!/usr/bin/perl -w
use strict;
use Image::Size;

my $test_file = 'hibunny.jpg';
open (TESTFILE,$test_file) or die ("Unable to open '$test_file': $!\n");
$/ = undef;
binmode TESTFILE;
my $data = <TESTFILE>;
close (TESTFILE);

print _identify_data($data,$test_file),"\n";




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

Date: Fri, 17 Sep 1999 02:07:12 +0000 (GMT)
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: CONTEST: Range Searching
Message-Id: <knhE3.585$Qx1.32678@typhoon01.swbell.net>

In article <37e1043e@cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>So here's the challenge: devise idiomatic solutions to the
>following problems.  
>
>    1) Write a "patfore" program that prints out up to N lines
>       before the match as well as the match itself.  Here's
>       the usage message:
>
>	    patfore [-B N] pattern [files ...]

Sorry, only have time to solve one of them. Not as elegant
as some of the others, but it works and is conservative
with resources. It also collates ranges and processes
STDIN as an option.

#!/usr/bin/perl -w

use strict;
use Getopt::Long;

my $opts = {};
GetOptions($opts,'B=i');
my $last_n = defined ($opts->{'B'}) ? $opts->{'B'} : 0;

my $pattern   = shift; 
if (not defined $pattern) {
	die <<"USAGE";
patfor [-B N] pattern [files ...]
USAGE
}

my @file_list = @ARGV;

if (0 == @file_list) {
	push (@file_list,'-')
}	
$last_n++;
while (my $file_name = shift @file_list) {
	my $open_name = $file_name;
	if ($file_name eq '-') {
		$open_name = "<&STDIN";
		$file_name = '';
	} else {
		$file_name .= ':';
	}	
	if (not open (THE_FILE,$open_name)) {
		warn("WARNING: Unable to open '$open_name' ($!) - skipping\n");
		next;
	}
	my @circular_buffer = ();
	my $buffer_pointer  = -1;
	my $buffer_n        = 0;
	my $last_line       = 0;
	while (<THE_FILE>) {
		chomp;
		$buffer_pointer++;
		$buffer_pointer %= $last_n;
		$circular_buffer[$buffer_pointer] = "$file_name\[$.] $_\n";
		$buffer_n++ if ($buffer_n != $last_n);
		if (m/$pattern/o) {
			my $buffer_offset = 1 - $buffer_n;
			if (($. + $buffer_offset) <= $last_line) {
				$buffer_offset = $last_line  - $. + 1;
			}
			my $start_at = $buffer_pointer + $buffer_offset;
			print join('',@circular_buffer[$start_at..$buffer_pointer]);
			$last_line = $.;
		}
	}
	close(THE_FILE) || die ("Failed to close handle for file '$open_name': $!\n");
}

-- 
Benjamin Franz


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

Date: 16 Sep 1999 21:11:33 -0500
From: Steven Smolinski <sjs@yorku.ca>
Subject: Re: ENOWORD: Referer
Message-Id: <m3so4ei8x6.fsf@hank.yorku.ca>

abigail@delanet.com (Abigail) writes:

> Tom Christiansen (tchrist@mox.perl.com) wrote:

> == There is, of course, no word "referer" in English.  It's "referrer".
> == The illiterati strike again, but this time deep into the heart of the
> == standards docs.  Don't these people have proofreaders and spell checkers?
> 
> The professor [1] who taught me programming, would say something like:
> 
>     But it isn't English. It's just a token consisting of the characters
>     'H', 'T', 'T', 'P', '_', 'R', 'E', 'F', 'E', 'R', 'E', and 'R'.
> 
>     Resemblence with the English language is only a coincidence.

Your professor should be aware that tokens which are easy to link to 
the function of the token are better than those that are not.  Perhaps 
worse than an arbitrary token is one which is almost exactly -- but not 
quite entirely -- the same as a familiar word.  This way one's mind is 
constantly tempted to fill in the proper English spelling, thereby 
breaking the code.  It is also harder to find such errors by reading the 
code, as our minds do much of this filling-in automatically and by 
default.

Steve


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

Date: Fri, 17 Sep 1999 01:33:45 GMT
From: "Craig Vincent" <2bunnyhop@home.com>
Subject: Re: Help needed about SENDMAIL!
Message-Id: <ZTgE3.39190$kL1.464877@news2.rdc1.on.home.com>

You can't send attachments directly using sendmail.  You have to have Mime
support.

As such you need to use the Mime:Base64 or Mime:Lite (I prefer Mime:Lite)
module from CPAN

Craig Vincent

Young-Soo Roh <ysroh@chat.carleton.ca> wrote in message
news:37E14DFC.90363DA7@chat.carleton.ca...
> Hello everyone?
>
> Is anybody know how to attach the file(ex. postscript) using sendmail?
> I am trying to send email using sendmail in Perl.
> ex)
> open(MAIL, "|/usr/lib/sendmail -t");
> print MAIL "To: xxx";
> print MAIL "Subject:xxx";
>
> But I don't know how to attatch the file.
>
> Please help..
>
> Thanks in advance..
>




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

Date: Thu, 16 Sep 1999 18:44:01 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Help needed about SENDMAIL!
Message-Id: <37E19CE0.160683DB@cisco.com>

[ Craig Vincent wrote:

> You can't send attachments directly using sendmail.  You have to have Mime
> support.

You can.
--



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

Date: Fri, 17 Sep 1999 03:02:38 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Help needed about SENDMAIL!
Message-Id: <ibiE3.15581$N77.1162681@typ11.nn.bcandid.com>

In article <37E19CE0.160683DB@cisco.com>,
Makarand Kulkarni  <makkulka@cisco.com> wrote:
>[ Craig Vincent wrote:
>
>> You can't send attachments directly using sendmail.  You have to have Mime
>> support.
>
>You can.

Yes, you just have to roll your own MIME or uuencode support :)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Fri, 17 Sep 1999 01:06:18 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How can I know if string have points?
Message-Id: <eugE3.15268$N77.1147278@typ11.nn.bcandid.com>

In article <37E162E8.6B57EE98@mail.cor.epa.gov>,
David Cassell  <cassell@mail.cor.epa.gov> wrote:
>Kragen Sitaker wrote:
>> _Picking Up Perl_, on the Web at http://www.ebb.org/PickingUpPerl/,
>
>Ummm Kragen, I just took a quick glance, and the first thing I
>noticed is that the author refers to the construct <STDIN> as
>a filehandle, rather than an operator working on a filehandle.
>I stopped reading at that point.

Yow.  I didn't read that far :)

>Maybe you'll want to proofread this for said author.

Yes.  Dunno if I'm really qualified, but I'd've noticed that.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Fri, 17 Sep 1999 01:20:05 GMT
From: "Craig Vincent" <2bunnyhop@home.com>
Subject: Re: how to mkdir on NT with Perl
Message-Id: <9HgE3.39181$kL1.463360@news2.rdc1.on.home.com>

Actually it's really really simple to do mkdir or any other dos command on
NT with perl...

If you wish to execute regular "dos" commands simply do this:

$ex = `mkdir c:\\directory`;

Note the ` is the apostrophe under the tilly (next the the 1 digit above the
character keys.

You can use ANY system command here.  It also works with unix commands too
:)
These commands include copy, move, rmdir etc...

A little trick I learnt a few months back...

Sincerely,

Craig Vincent

Martien Verbruggen <mgjv@comdyn.com.au> wrote in message
news:8EiD3.119$Wz1.8975@nsw.nnrp.telstra.net...
> In article <37d8ac10.92012574@news.dowco.com>,
> randys@dowco.com (Randy) writes:
> > I would like to know if there is a way i could create
>
> # perldoc -f mkdir
>
> >                                                       or edit
> > directories in NT with Perl?
>
> open the directory in the hex editor of your choice and go for it. I
> don't really know whether NT allows this... Maybe you should work on
> the raw disk blocks.
>
> Other, less direct methods include creating, removing, or altering the
> sizes of files in that directory. Even modifying the file without
> changing its size will change your directory.
>
> What exactly do you mean by 'editing' a directory?
>
> Martien
> --
> Martien Verbruggen                  |
> Interactive Media Division          | Useful Statistic: 75% of the people
> Commercial Dynamics Pty. Ltd.       | make up 3/4 of the population.
> NSW, Australia                      |




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

Date: Fri, 17 Sep 1999 01:42:36 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: how to mkdir on NT with Perl
Message-Id: <g0hE3.137$je2.9244@nsw.nnrp.telstra.net>

In article <9HgE3.39181$kL1.463360@news2.rdc1.on.home.com>,
	"Craig Vincent" <2bunnyhop@home.com> writes:
> Actually it's really really simple to do mkdir or any other dos command on
> NT with perl...

And why would you want to do that when perl has a builtin mkdir, which
is likely to be much more efficient, fast, and easier to check for
errors? And the builtin will work everywhere. Executing external
programs will not.

> If you wish to execute regular "dos" commands simply do this:
> 
> $ex = `mkdir c:\\directory`;

Yes, indeed. If you _wish_ to use external commands, use qx(),
system(), or backticks, but the matter here is that you should not
_wish_ to run an external mkdir. 

> You can use ANY system command here.  It also works with unix commands too
>:)
> These commands include copy, move, rmdir etc...

The File::Copy module has decent implementations of copy and move.
Perl has a builtin rmdir. Again: you should try to avoid using this
sort of approach whenever possible if you want to write portable fast
code. Only if the effort of using perl internals far outweighs the
horror of making unnecessary external program calls, go ahead. Or of
course if you can't duplicate the functionality of the external
program in perl. 

Especially when the translation of the external program to the
internal perl functionality is one-to-one you should not shell out.

# perldoc -f mkdir
# perldoc -f rmdir
# perldoc File::Copy
# perldoc -f rename
# perldoc -f unlink

Perl is much more than sh, csh or bash. Use it. Or do you use cat or
type to create new files from perl?

> A little trick I learnt a few months back...

Please, unlearn it. For your own sake.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd.       | password?
NSW, Australia                      | 


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

Date: Fri, 17 Sep 1999 01:19:22 GMT
From: Carmanah <rhanson@artschool.com>
Subject: Looking for a certain guestbook which contains the following...
Message-Id: <7rs4uf$a70$1@nnrp1.deja.com>

I'm working on a guestbook for a course of mine. We're basically
supposed to *find* a premade guestbook from a cgi-library site, making
sure all of the following subroutines exist in the guestbook's cgi
script. If they *don't* exist, we have to put them in ourselves.

So far I've been able to find a guestbook with2 or 3 of the following
subroutines, but perhaps anyone here might know of a place where I can
find more of what I'm looking for. I'm looking for a specific guestbook
which contains the following:

 - Database to store entries (new entries are written to a flatfile
database and the guestbook itself is generated by reading the database
and formatting the output)

- File upload capability (restricted to .jpg or .gif below 60K in
size); the URL of the picture should be a field in the database...

- E-mail confirmation of entry

- Smut (sweat word) filter

- Verification of e-mail and any other field (hacker proof ode)

- Required fields for guest book (if you don't have all the fields
filled out, it won't allow you to carry on without filling everyone out
first)

 Thanks!

- Robyn Hanson rhanson@artschool.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 17 Sep 1999 02:38:11 GMT
From: "Ben Craigo" <craigo3@home.com>
Subject: Re: Looking for tools.
Message-Id: <nQhE3.749$GZ2.16308@news.rdc1.pa.home.com>


>> >What are the best enviroment and tools for PERL's programming?
>> I'm personnally having a rather passionate love affair with Edit Plus,
>
>Hmmm.  Maybe you need to get away from the computer a little.
>Meet some new people.  :-)


I can kinda see his point (although there are boundaries).  The best tool is
one you never think about as you use it and rarely have to leave it to get
the job done.

>list of editors for win32 in the ActivePerl FAQ which comes
>with win32 installs.  These two lists should be enough to


From use in the trenches, I gotta throw in a plug for TextPad.  I use it
daily for SQL, Perl, JavaScript, Java and *cough* ASP *cough* and love it.
Simple editor that has a lot of punch.  Before replying to this I wanted to
check out their site to get a proper url (www.textpad.com) and found that
it's at version 4.0!  I've been using 3.2.5 for a while now and thought
development on this was dead.  Glad to see it's still moving ahead.

Cheers.

Ben




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

Date: 17 Sep 1999 02:30:42 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Making and using a DB. (Help!!!)
Message-Id: <7rs94i$b24@dfw-ixnews6.ix.netcom.com>

Matt King (mattking@techie.com) wrote:
: It was once recomended that I use DB_File as the DB, but the Win32 version
: of both Active Perl and PERL for Win32 do not come with it. So the SDBM_File
: method was (and still is being) used. Since it apears that the SDBM_File

DB_File is available for ActivePerl and can be installed with PPM.



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

Date: 16 Sep 1999 21:11:32 -0500
From: les@Jupiter.mcs.net (Leslie Mikesell)
Subject: Re: NDBM_File problem.
Message-Id: <7rs80k$hch$1@Jupiter.mcs.net>

In article <diverdi-1509990019380001@lulu.xtrsystems.com>,
Joseph A. DiVerdi <diverdi@XTRsystems.com> wrote:
>>
>>I have some databases that need NDBM_File module to access them but the
>>version of Perl that came with RH Linux 6.0 doesn't seem to have it or let
>>my CGI access it.
>>I am trying to install a new Perl but getting errors when trying to load
>>NDBM_File.
>>
>>Has anyone had problems with this module and have any suggestions?
>>
>>Thanks in advance, please also respond to my email.
>
>I hav experienced the same problem with v6.0 in accessing NDBM files.
>
>I use DBM authentication with an Apache web server and also use
>the data contained in the password files (in NDBM format) for other
>operations. Prior to my ISP's upgrading to v6.0 the scripts operated
>correctly. After the update, the scripts fail indicating that the
>NDBM file that is being accessed "doesn't exist".

Redhat has always made libndbm* a link to libdb* to use the
Berkeley libraries instead of gdbm which can also emulate ndbm.

RedHat 5.2 used the 1.85 version of the db libraries, 6.0 seems
to have switched to the file-incompatible 2.x series.  This is
surprising both for incompatibility problems and licensing issues
and it seems odd that so few people have noticed.

One way to work around it is to copy the static library and
matching header file from a 5.2 distribution (follow the symlinks
to find the real thing) and compile apache (and maybe perl)
against that.  If you try to switch out the shared libs you will
probably screw up sendmail and anything else with databases in
the new format.

   Les Mikesell
    les@mcs.com


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

Date: 16 Sep 1999 21:13:50 -0500
From: les@Jupiter.mcs.net (Leslie Mikesell)
Subject: Re: NDBM_File problem.
Message-Id: <7rs84u$hdt$1@Jupiter.mcs.net>

In article <diverdi-1609991515290001@lulu.xtrsystems.com>,
Joseph A. DiVerdi <diverdi@XTRsystems.com> wrote:
>
>I agree with your thinking. My ISP's sys admin has been looking
>into the problem and has been looking in the direction of glibc
>also. We still don't have a fix and I would appreciate from others
>with the same or related problems.

The *db libraries are standalone, not part of glibc.
  
  Les Mikesell
   les@mcs.com


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

Date: Fri, 17 Sep 1999 01:12:06 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Parsing Tab Delimited File
Message-Id: <GzgE3.15286$N77.1148204@typ11.nn.bcandid.com>

In article <slrn7u2kj1.vd4.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Bullocks. If a split would suffice, the format is too restrictive. CSV files
>aren't there to satisfy the programmer. They are there for the user. And if
>a programmer complains it's too hard to parse them - boohoo, fire him, and 
>get a better programmer.

Most cases I've seen CSV used, it's been for transfer from one program
to another -- not human entry or human reading.

Agreed, though, that programmers program to serve users.

>Too make them useful. Other techniques could have been used as well, but
>then you still won't be able to parse them with just a split.

Perhaps you have a simpler method of parsing Tom's "evil" format than
the long regex I posted on this thread?  IMHO, Tom's for/split is
*much* simpler, and likely more robust.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Thu, 16 Sep 1999 17:12:49 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: PERL (cgi) and Databases -> How To?
Message-Id: <APC&1'0'50775db1'331@igc.apc.org>

Jon wrote:
>given the immense numbers of FAQs, I haven't been able to find this 
>one yet.

on your linux box, type 
man perldoc
  and then 
perldoc -q module

The question 'How do I keep my own module/library directory?' is
most useful.

-Michael


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

Date: Fri, 17 Sep 1999 01:22:53 GMT
From: "Craig Vincent" <2bunnyhop@home.com>
Subject: Re: Reading files from other systems
Message-Id: <NJgE3.39183$kL1.463330@news2.rdc1.on.home.com>

No no...that won't work.

Take a look at the libwww module at CPAN.  That will do everything for you
really easily.

Craig Vincent

<armadilloman@my-deja.com> wrote in message
news:7rrqft$2pc$1@nnrp1.deja.com...
> Is there a way for a script to read .html files
> from other sites?  I have a bunch of sites that I
> want to all put in the same search engine type
> thing.  I have everything done, except I can't
> open files from other websites.
> $page = "http://mysite.host.net/index.html";
> open(FILE, "$page") || die $!;
> doesn't work and returns a 500 Internal Server
> error.  I do not have access to all of the
> directories on my host (specifically, the
> directory where perl is stored).
> If this is impossible (at least without full
> access to the system, since I have seen scripts do
> this before), please tell me so I can stop
> searching :P.
>
> Thanks for your time and any help you can give me
> :)
> -Matt
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.




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

Date: 17 Sep 1999 01:05:53 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: script to dynamically produce standard calender
Message-Id: <7rs45h$b24@dfw-ixnews6.ix.netcom.com>

Kragen Sitaker (kragen@dnaco.net) wrote:
: 
: ><HTML>
: >  <BODY>
: 
: No DTD specified, and no <head>.  Against my preference.  I like my web
: pages to validate.

Well, the <head> can be omitted (it's inferrable) but the <title> can't.

: 
: All upper-case also violates my preference.
: 
: >  <P ALIGN=CENTER>
: >  <TABLE BORDER=0 WIDTH=75%>
: >    <TR WIDTH=75%>
: >       <TD WIDTH=25% ALIGN=left>
: >         <A
: >HREF=$me?month=$yesterday[1]&year=$yesterday[0]&day=$yesterday[2]&type=detail>
: 
: No quotes on attribute containing funky chars.  Bad for validation.

Furthermore, percentages for width attributes in <td>s are invalid, and
those browsers that do accept them don't agree on what they mean (one
major browser family treats them as percentages of the table width while
another treats them as percentages of the browsing-window width).  Thus
even if you're willing to use "proprietary extensions," you'll get
dramatically-varying results if your table's width is anything other than
100%. 



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

Date: 16 Sep 1999 20:10:35 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Splitting a line and honoring "strings"
Message-Id: <slrn7u35da.vd4.abigail@alexandra.delanet.com>

Kragen Sitaker (kragen@dnaco.net) wrote on MMCCVII September MCMXCIII in
<URL:news:rI5E3.14398$N77.1061424@typ11.nn.bcandid.com>:
{} In article <slrn7u1dur.95k.scarblac-spamtrap@flits104-37.flits.rug.nl>,
{} Remco Gerlich <scarblac-rt@pino.selwerd.cx> wrote:
{}
{} print $1, "\n" while $str =~ /
{} 	([^\ "'\\]+|
{} 	"(?:\\"|[^\\"]|\\\\)*"|
{} 	'(?:\\'|[^\\']|\\\\)*')/gx;

Well, you can improve a bit on that, by performing "unrolling" techniques.
Furthermore, your expression doesn't parse:  "fo\o", as you require a
backwack to be followed by either a quote, or another backwack.

For a double quoted string, you would get:

        "(?:[^\\"]+|\\.)*"



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 17 Sep 1999 03:01:32 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: trimming spaces from a string
Message-Id: <gaiE3.15578$N77.1165604@typ11.nn.bcandid.com>

In article <7rrhb2$5g8$1@info2.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>In article <X6bE3.14819$N77.1100736@typ11.nn.bcandid.com>,
>	kragen@dnaco.net (Kragen Sitaker) writes:
>: If I were writing Unicode, I'd be miffed if \s didn't match the various
>: non-ASCII spaces in Unicode.
>
>Such as?

From the Unicode Standard 2.0 (ISBN 0-201-48345-9):

Table 4-4. Bidirectional Character Types.
Neutrals: WS: Whitespace: Space:          U+0020  (this is ASCII space)
                          No-Break Space: U+00A0  (this is from ISO-8859-1)
                          General Punctuation Spaces:
                                          U+2000 --> U+2006, 
                                          U+2008 --> U+200B,
                                          U+3000, U+FEFF

(tab is a "Separator", not a "Neutral": a "Segment Separator".  Line
Separator and Paragraph Separator are also kinds of "Separator": "Block
Separator"s.)

U+2000 is EN QUAD.  U+2001 is EM QUAD.  U+2002 is EN SPACE.  U+2003 is
EM SPACE.  U+2000 is marked as identical to U+2002, and U+2001 is
marked as identical to U+2003.  U+2004 is THREE-PER-EM SPACE.  U+2005
is FOUR-PER-EM SPACE.  U+2006 is SIX-PER-EM SPACE.  U+2007 (not
mentioned as a "General Punctuation Space") is FIGURE SPACE, commented
as being similar to a non-breaking version of U+0020 (ASCII space).
U+2008 is PUNCTUATION SPACE.  U+2009 is THIN SPACE.  U+200A is HAIR
SPACE.  U+200B is ZERO WIDTH SPACE -- I'm not really sure if that
should be a \s at all :)

U+3000 is IDEOGRAPHIC SPACE.  It's with the CJK punctuation symbols.

U+FEFF is funny; it's ZERO-WIDTH NO-BREAK SPACE, but is also BYTE ORDER
MARK or BOM.  It's supposed to be the latter at the beginning of a
file, but the former inside a file.

There are also things like ZERO-WIDTH NON-JOINER, which are strange
things too.  If you put them in the middle of (say) an Arabic or
Devanagari word, my understanding is that you'd end up with something
that looked like two separate words (from the way characters were
joined) with no space between them.

Hope this is interesting :)

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Thu Sep 16 1999
53 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Thu, 16 Sep 1999 12:53:18 -0600
From: Tim <bie@connect.ab.ca>
Subject: Re: Two dimensional array
Message-Id: <37E13C9E.53D8@connect.ab.ca>

I wasn't sure, I was offering a thought.
You people are so picky about what gets posted in here, u post more
about what not to post then you do quality posts.





Abigail wrote:
> 
> Tim (bie@connect.ab.ca) wrote on MMCCVII September MCMXCIII in
> <URL:news:37E039C3.103D@connect.ab.ca>:
> %% Like a Hash? (%)
> 
> No, hashes have nothing to do with multi-dimensional arrays.
> 
> And don't post Jeopardy style. That's rude. And so is quoting
> signatures. That's rude too. You were rude twice.
> 
> Go away.
> 
> %% Scott D. Wells wrote:
> %% >
> %% > Does PERL have any kind of implimentation of two dimensional arrays?
> %% > IE... like arrays in BASIC $junk(x,y).
> 
> Abigail
> --
> perl -wlpe '}{$_=$.' file  # Count the number of lines.
> 
>   -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
>    http://www.newsfeeds.com       The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----

-- 

-------------------------------------------------------
| TBE: http://tbe.virtualave.net                      |
| * 3:2 Ratio + 100 Free credits! *                   |
| Tim's Chat Doors: http://www.connect.ab.ca/~mundy/  |
-------------------------------------------------------


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

Date: Fri, 17 Sep 1999 03:02:22 +0200
From: Alex Farber <alex@kawo2.rwth-aachen.de>
Subject: What happens with this slice?
Message-Id: <37E1931E.E002C974@kawo2.rwth-aachen.de>

Dear friends,

I have a list of hashes @loh. One of the keys in those hashes is called
'day'. Now I would like only 10 entries with the highest value of 'day'
and assign a 'rank' (see below). So I try following:

for $href ((sort {$a -> {day} <=> $b -> {day}} @loh)[0..9]) # take top 10
{
    $href -> {rank} = ++$rank;
}

However I get the following error: 
Modification of a read-only value attempted at ./print-gazeti.pl line 97.

When I change the code to:

for $href (sort {$a -> {day} <=> $b -> {day}} @loh)
{
    $href -> {rank} = ++$rank;
    last if $rank == 10;
}

everything seems to work fine. But I wonder, why doesn't the first approach
work? Don't I get a list of 10 hash references inside of  for $href (...) ?
They point then to the hashes somewhere in mem, why can't I modify the hashes?

Regards
Alex

-- 
Ich studiere  Elektrotechnik (Technische  Informatik) an der RWTH Aachen
und bin ein guter Perl-Programmierer (arbeite seit 4 Jahren als Intranet-
Entwickler). Kann auch C, Java, SQL, JavaScript und HTML, CGI und TCP/IP.
Ich suche eine gut bezahlte  Diplomstelle in Koeln, Aachen oder Umgebung.


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

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

NOTE: The mail to news gateway, and thus the ability to submit articles
through this service to the newsgroup, has been removed. I do not have
time to individually vet each article to make sure that you aren't
abusing the service, and I no longer have any desire to waste my time
dealing with the campus admins when some fool complains to them about an
article that has come through the gateway instead of complaining
to the source.

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.

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 V9 Issue 825
*************************************


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