[10344] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3938 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 9 18:07:13 1998

Date: Fri, 9 Oct 98 15:01:33 -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           Fri, 9 Oct 1998     Volume: 8 Number: 3938

Today's topics:
    Re: Proper Names and Mc etc. (Mark-Jason Dominus)
    Re: Proper Names and Mc etc. (Craig Berry)
    Re: Proper Names and Mc etc. (brian d foy)
    Re: Proper Names and Mc etc. <Mark_Rogers@UManitoba.CA>
    Re: Proper Names and Mc etc. <uri@camel.fastserv.com>
    Re: Q: Short-Circuit While ? <aqumsieh@tigre.matrox.com>
    Re: Q: Short-Circuit While ? <aqumsieh@tigre.matrox.com>
    Re: read subdirectories droby@copyright.com
        reg-exp: change < to &lt; but keep <I> <alex@kawo2.rwth-aachen.de>
    Re: reg-exp: change < to &lt; but keep <I> (Abigail)
    Re: regexp with variable substitution values (Charles DeRykus)
    Re: run a script Perl with a form droby@copyright.com
        symlinks and perl <dewitt@jlab.org>
    Re: using File::lockf (Charles DeRykus)
        WANTED: experienced web developers echiu@imservice.com
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 9 Oct 1998 14:17:22 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Proper Names and Mc etc.
Message-Id: <6vljvi$7rb$1@monet.op.net>

In article <361E30D3.787DAFB0@UManitoba.CA>,
Mark Rogers  <Mark_Rogers@UManitoba.CA> wrote:
>handle the McDonalds, deMoissacs etc.  

Look in the phone book for a minute, and you'll see that you're going
to lose.  If you have MACDONALD, there is no way to tell whether it
should be MacDonald or Macdonald.  If you have DEANGELIS, you can't
tell whether it was De Angelis, de Angelis, DeAngelis, or Deangelis.
Even if you know where the space is, it doesn't help.  

If you aren't discouraged yet, here are some samples from the
Philadelphia book:

	DeLaney
	Delaney
	De Lang
	DeLange
	Delange
	DeLaOsa
	Dela Pena
	DelaPena
	Delapena
	DeLapenha
	Delapenha
	DeLaRosa
	Delarosa
	de Laurentiis
	DeLaurentiis
	DelAurentiis
	Delaurentiis
	
The last straw: Richard A Delarso spells his name with one capital,
but his son, Richard A DeLarso Jr., uses two.

>I have need of such an algorithm or assistance in developing one.  

There isn't one.  Give up.


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

Date: 9 Oct 1998 18:29:02 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Proper Names and Mc etc.
Message-Id: <6vlkle$ke9$1@marina.cinenet.net>

Mark-Jason Dominus (mjd@op.net) wrote:
: In article <361E30D3.787DAFB0@UManitoba.CA>,
: Mark Rogers  <Mark_Rogers@UManitoba.CA> wrote:
: >handle the McDonalds, deMoissacs etc.  
: >I have need of such an algorithm or assistance in developing one.  
: 
: There isn't one.  Give up.

Or, alternatively, take an approach similar to the oft-discussed email
address validation problem.  Create a heuristic which does what you expect
to be the right thing most of the time (MACDONALD -> MacDonald, DEROSA ->
de Rosa {or whatever}), then allow individuals listed to correct their
entries if they wish.  This seems the ideal solution to me; most people
get the right listing automagically, and the few who don't fix the
problems for you.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Fri, 09 Oct 1998 15:05:31 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Proper Names and Mc etc.
Message-Id: <comdog-ya02408000R0910981505310001@news.panix.com>
Keywords: from just another new york perl hacker

In article <361E30D3.787DAFB0@UManitoba.CA>, Mark_Rogers@UManitoba.CA posted:

>I am sure that I have seen messages suggesting that
>someone might have done some work on the formatting
>of mixed case names from, say, all upper names to
>handle the McDonalds, deMoissacs etc.

some names don't have mixed case :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers needs volunteers! <URL:http://www.pm.org/to-do.html>


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

Date: Fri, 09 Oct 1998 14:14:31 -0500
From: Mark Rogers <Mark_Rogers@UManitoba.CA>
Subject: Re: Proper Names and Mc etc.
Message-Id: <361E6097.5741A86@UManitoba.CA>

Hi,

brian d foy wrote:

> In article <361E30D3.787DAFB0@UManitoba.CA>, Mark_Rogers@UManitoba.CA posted:
>
> >I am sure that I have seen messages suggesting that
> >someone might have done some work on the formatting
> >of mixed case names from, say, all upper names to
> >handle the McDonalds, deMoissacs etc.
>
> some names don't have mixed case :)

Let me try to ask a slightly simpler question then.  If I wanted
to convert all of the Mcdonald's to McDonald, how could
I do that.  I am assuming that there is a regexe that will do
that in a generic way ... i.e. one that would work for any
selected prefix that I wanted to be followed by a CAP.

Mark.



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

Date: 09 Oct 1998 15:29:19 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Proper Names and Mc etc.
Message-Id: <sarvhltr0ts.fsf@camel.fastserv.com>

>>>>> "MR" == Mark Rogers <Mark_Rogers@UManitoba.CA> writes:


  MR> Let me try to ask a slightly simpler question then.  If I wanted
  MR> to convert all of the Mcdonald's to McDonald, how could
  MR> I do that.  I am assuming that there is a regexe that will do
  MR> that in a generic way ... i.e. one that would work for any
  MR> selected prefix that I wanted to be followed by a CAP.

here is a very basic way for just Mc (tested). you can make a table of
possible prefixes and build up a set of regexes using eval for speed. or
you can use 5.005 and the qr// operator to make regexes objects.

s/\b(Mc)([a-z])/$1\U$2/

if you know the range of letters following the prefix then you could
simplify this and maybe make it more accurate but as someone in my
office says, almost any name could have a Mc prefix since it means 'son of'

s/\b(Mc)([dg])/$1\U$2/

this would work (slowly) for multiple prefixes

foreach $prefix ( 'Mc', 'Mac' ) {

	s/\b($prefix)([a-z])/$1\U$2/
}

it still gets complicated with ones like 'De' which is a common plain
prefix and even 'Mac' can be a plain prefix in 'Mack'. you don't want
MacK!

this is a big can o'worms you are opening. even a half-assed solution is
worse than none!

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 09 Oct 1998 12:49:35 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Q: Short-Circuit While ?
Message-Id: <x3y67dtk7ds.fsf@tigre.matrox.com>


Ala Qumsieh <aqumsieh@tigre.matrox.com> writes:

> $n=0;
> while ($n <10) {
> 	next unless $n % 2;
> 	print "$n is odd\n";
> }

That was just an example you know :) I would argue that it is a good
one although it does absolutely nothing and just hangs your terminal!!

maybe that should've been:

$n=0;
while ($n < 10) {
	next unless $n % 2;
	print "$n is odd\n";
} continue {
	$n++;
}

-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)


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

Date: 09 Oct 1998 12:46:40 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Q: Short-Circuit While ?
Message-Id: <x3y7ly9k7in.fsf@tigre.matrox.com>


echao@interaccess.com (Eisen Chao) writes:

> 
> 
> To All:
> 
> I know that in a foreach... loop, you can put
> in a condition to skip to the next foreach:

<snip>

> according to an example given in O'Reilly's *very*
> excellent 'Perl Cookbook', but is there a way to do
> the same thing for a while loop:
> 
>   while (such-n-such) {
>     
>      blah-blah
> 
>      }
> 
> 
> without putting in big, fat, ugly, honking if..then else blocks ?

$n=0;
while ($n <10) {
	next unless $n % 2;
	print "$n is odd\n";
}

You can use the exact same things you use for foreach loops.

> 
> I always scr*w up and fail to match the {} braces properly!

That's not a valid excuse. Proper code indentation, along with using
the proper tools, will eliminate this problem.

PS. If you use a REAL editor (i.e vi) try using your % key. Also emacs
(as close to REAL as you can get) can be configured very easily to
highlight matching parentheses.

(require 'paren)

Hope this helps,
-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)


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

Date: Fri, 09 Oct 1998 20:10:45 GMT
From: droby@copyright.com
Subject: Re: read subdirectories
Message-Id: <6vlqk4$dup$1@nnrp1.dejanews.com>

In article <slrn71q00c.e1.sitaram@diac.com>,
  sitaram@iac.com (Sitaram Chamarty) wrote:
> On Wed, 07 Oct 1998 18:55:57 GMT, droby@copyright.com
> <droby@copyright.com> wrote:
> >In article <Y3wJ4PA$WlG2EwBS@connected.demon.co.uk>,
> >  Jerry Pank <jerryp.usenet@connected.demon.co.uk> wrote:
> >> In <comp.lang.perl.misc>
> >> John Porter <jdporter@min.net>, writes:
> >> >Pete Ratzlaff wrote:
> >> >>
> >> >> Here's one I wrote up in a hurry which recursively prints all
> >> >> subdirectories of a given directory. Modify to suit your own needs:
> >> >
> >> >I sure do wonder what people have against using standard, robust,
> >> >portable modules like File::Find.
> >> >
> >> <PEDANT> It's not Taint friendly </PEDANT>  :-)
> >
> >But you want to define %ENV yourself if you're using -T anyway, don't you?
>
> Not enough.  Last time I checked, it fails on the chdir itself
> (approx line 181 of the version that came with Perl 5.00501),
> IIRC.  chdir is an internal function that is not related to %ENV.
>

Yes indeed.  I made a little script that fixed all the ENV stuff and did a
find and saw a chdir error a little while after sending that message, and
after the script ran for quite awhile happily.

Guess I won't use File::Find in any of MY setuid CGI scripts ;-)

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


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

Date: Fri, 09 Oct 1998 17:11:13 +0000
From: Alex Farber <alex@kawo2.rwth-aachen.de>
Subject: reg-exp: change < to &lt; but keep <I>
Message-Id: <361E43B1.CCD2F3D5@kawo2.rwth-aachen.de>

Hi guys,

I am thankful to all who helped me with my previous
reg. exp. question and would like to ask one more:

the typical way not to let people use HTML-tags 
in a webboard is to   s/</&lt;/g and s/>/&gt;/g  

But how do you still allow people using <I>, </I>,
<A HREF=""> and </A> ? I guess it is probably done
somehow with (!=...)

Thanks in advance!
Alex

--
http://www.simplex.ru/pref.html


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

Date: 9 Oct 1998 21:39:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: reg-exp: change < to &lt; but keep <I>
Message-Id: <6vlvqp$qeo$1@client3.news.psi.net>

Alex Farber (alex@kawo2.rwth-aachen.de) wrote on MDCCCLXV September
MCMXCIII in <URL:news:361E43B1.CCD2F3D5@kawo2.rwth-aachen.de>:
++ 
++ 
++ But how do you still allow people using <I>, </I>,
++ <A HREF=""> and </A> ? I guess it is probably done
++ somehow with (!=...)

No, because there are way too many cases you would like to consider.

use HTML::Parser;



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


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

Date: Fri, 9 Oct 1998 18:55:02 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: regexp with variable substitution values
Message-Id: <F0Kpvq.7I1@news.boeing.com>

In article <6vdt71$lm0$1@nnrp1.dejanews.com>,  <jcoffey@connectnet.com> wrote:
>I'm not sure if that title makes any sense, but it's the best I can think
>of...
>
>Anyway, I'm stumped on a problem, and was wondering if anybody had any ideas
>on this.  I've got a string that has multiple values I would like to append
>to, from an array of values.  Here's kind of the idea...
>
># this is stored in an array, because there will be a varying number of
>elements # to substitue into the string
>
>@array = ( "value1",
>	   "value2",
>	   "value3",
>	   "value4"
>	);
>
>$string =~ s/subtag/$array[$i]/g;
>
># where $i is some sort of counter for the number of times matched.
>
>First of all, does that make any sense?  Secondly, is it possible?  Thirdly,
>should I have read that regexp section in the Camel book more thoroughly?
>

Kinda, sorta.  Something like this, perhaps: 

  my $string = 'foosubtag bar baz foosubtag bar baz ...';
  my $match;
  $string =~ s/subtag/$array[$match++]/g;


which leaves:

 $string = 'foovalue1 bar baz foovalue2 bar baz ...';


hth,
--
Charles DeRykus


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

Date: Fri, 09 Oct 1998 19:32:29 GMT
From: droby@copyright.com
Subject: Re: run a script Perl with a form
Message-Id: <6vlocd$ahr$1@nnrp1.dejanews.com>

In article <83d882glzs.fsf@vcpc.univie.ac.at>,
  Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> wrote:
> Re: run a script Perl with a form, isabellec
> <isabellec@my-dejanews.com> said:
>
> isabellec> Hello, I want to run a script Perl (which is in
>
> Why the RPN?  "perl script"
>

This isn't reverse polish, it's English with a French accent.  If we were to
respond in French, it would probably be equally odd.  I'd try it, but Randal
gets upset.  ;-)

> isabellec> the cgi-bin repertory) from a form.  If it works,
> isabellec> I will have some results to be written in a
> isabellec> hidden file. But I have an Internal error of
> isabellec> misconfiguration. Maybe some access rights are
> isabellec> not good.
>
> isabellec> Can someone tell me the steps I have to follow to
> isabellec> run my program ?
>
> No, because you gave us no information about what the script
> does, what it looks like, what the error message is...
>

I would suspect from Isabel's description that it is the famous "Internal
Server Error", which unfortunately still gives us no real information.

However, we can give clues of next steps.

Check the server logs.
Try the program from the command-line.
Consult various on-line aids:


    The Idiot's Guide to Solving Perl/CGI Problems, by Tom Christiansen
        http://www.perl.com/perl/faq/idiots-guide.html

    Frequently Asked Questions about CGI Programming, by Nick Kew
        ftp://rtfm.mit.edu/pub/usenet/news.answers/www/cgi-faq
        http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml

    Perl/CGI programming FAQ, by Shishir Gundavaram and Tom Christiansen
        http://www.perl.com/perl/faq/perl-cgi-faq.html

    The WWW Security FAQ, by Lincoln Stein
        http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html

    World Wide Web FAQ, by Thomas Boutell
        http://www.boutell.com/faq/

I wonder if any of these have been translated into other languages...

--
Don Roby

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


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

Date: Fri, 09 Oct 1998 16:50:15 -0400
From: Shane Dewitt <dewitt@jlab.org>
Subject: symlinks and perl
Message-Id: <361E7707.57E3@jlab.org>

hi, this is my first time posting and i still new to perl.

my problem is that i have a html form that calls a symlink in
/usr/csite5/WebServer/httpd/cgi-bin/TestPlans/TestPlan.pl (symlink is
called TestPlan.pl) which points to
/usr/csite5/WebServer/httpd/cgi-bin/TestPlans/1-0/TestPlan.pl

which works but the reall TestPlan.pl still thinks its in the symlink
dir and cannot
find it required files which are in the 1-0/. directory.

please cc replay to dewitt@cebaf.gov


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

Date: Fri, 9 Oct 1998 19:21:22 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: using File::lockf
Message-Id: <F0Kr3M.9xC@news.boeing.com>

In article <vuyaqq7toq.fsf@otis.arraycomm.com>,
Farhad Farzaneh  <ff@otis.arraycomm.com> wrote:
>
>I'm trying to use File::lockf (version 0.20) but am doing something very
>simple very wrong.  Here's a simple program:
>
>#!/bin/perl -w
>
>use strict;
>use File::lockf;
>
>open F, "<foo" or die "Unable to open foo\n";
>my $err = File::lockf::lock(\*F);
>print "Error = $err\n";
>
>It prints 'Error = 9';
>

You're only opening the file for reading. Here's the relevant 
section for lockf:

 int lockf(int fildes, int function, long size);
 
     fildes is an open file descriptor.  The file descriptor must
     have  O_WRONLY  or  O_RDWR  permission in order to establish
     locks with this function call.


hth,
--
Charles DeRykus


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

Date: Fri, 09 Oct 1998 19:39:53 GMT
From: echiu@imservice.com
Subject: WANTED: experienced web developers
Message-Id: <6vloq9$b8u$1@nnrp1.dejanews.com>



Direct job candidates only, no agencies please.
Internet Media Services
http://www.imservice.com

Web Application Engineers / Programmers / Developers Job Code #DEV-001: The
backbone of any software product is solid technology used creatively. IMS is
constantly pushing the envelope of what can be done with the existing
technology while thinking of our clients needs first. We are looking for
outstanding engineers, programmers and developers who want to solve business
problems never solved before.

Required Experience:
Application development and testing, interface elements organization and
creation, front end database development.
HTML, Java Script, code/project management, Active Server Page, enterprise
database connectivity, Intranet/Internet database connectivity.
Desired: CGI (Perl), C++, Java, MS SQL Server, Oracle, MS Access.




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


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

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

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