[25280] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7525 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 16 14:05:36 2004

Date: Thu, 16 Dec 2004 11:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 16 Dec 2004     Volume: 10 Number: 7525

Today's topics:
        [Q] $ARGV, <>, and command-line Perl <jkrugman345@yahbitoo.com>
    Re: [Q] $ARGV, <>, and command-line Perl <glex_nospam@qwest.invalid>
    Re: [Q] $ARGV, <>, and command-line Perl <1usa@llenroc.ude.invalid>
    Re: [Q] $ARGV, <>, and command-line Perl <karlUNDERSCOREkramsch@yahooPERIODcom.invalid>
    Re: [Q] $ARGV, <>, and command-line Perl <nobull@mail.com>
    Re: [Slightly OT] Perl interpreter (win32) single "thre <not@home.net>
    Re: [Slightly OT] Perl interpreter (win32) single "thre <1usa@llenroc.ude.invalid>
    Re: Can't get past 'use strict' :( <1usa@llenroc.ude.invalid>
    Re: Can't get past 'use strict' :( <1usa@llenroc.ude.invalid>
    Re: Can't get past 'use strict' :( <fabels@yahoo.com>
    Re: Can't get past 'use strict' :( <nobull@mail.com>
        EOF and reading /proc <Mark.Seger@hp.com>
        Found this and thought if was of Use ! <misymagicg@yahoo.com>
    Re: How to go to a link and save a page and email it ou <zhangd@tycoelectronics.com>
        Is there a field-data abstraction layer for DBI/MySQL? (Ole)
    Re: Is there a field-data abstraction layer for DBI/MyS <1usa@llenroc.ude.invalid>
    Re: Is there a field-data abstraction layer for DBI/MyS <nospam@bigpond.com>
    Re: Is there a field-data abstraction layer for DBI/MyS <aaraines@pobox.com>
    Re: Pattern Matching <matthew.garrish@sympatico.ca>
    Re: Pattern Matching <nospam@nospam.com>
    Re: Pattern Matching <mritty@gmail.com>
    Re: Pattern Matching <nospam@nospam.com>
    Re: Regarding ISA and Inheritance (Randal L. Schwartz)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 16 Dec 2004 17:43:47 +0000 (UTC)
From: J Krugman <jkrugman345@yahbitoo.com>
Subject: [Q] $ARGV, <>, and command-line Perl
Message-Id: <cpshgj$3ti$1@reader1.panix.com>





I've rtfm'd this to death, but I still don't get it.  If someone
can explain it to me (as opposed to tell me something like "man
perlfrotz"), I'd be very grateful.

The immediate problem that serves as the context of the question
is this: find all the files below /path/to/subdir (this is Linux)
that contain either of the strings "foo bar baz" or "quux frobozz",
and do this *from the command line* (i.e. I'm looking for a one-liner
here, not a longwinded affair using File::Find, etc.).

I tried

  % perl -e 'print "$ARGV\n" if grep /(foo bar baz|quux frobozz)/, <>' `find /path/to/subdir -type f` 

which failed to generate any output, even though I *know* that
there are files under /path/to/subdir that contain strings "foo
bar baz" and/or "quux frobozz".

Even if it had worked, the last alternative is not good, because
it can easily fail through choking the shell with an excessively
long arguments list.  There has to be a better way.

At any rate, I also tried

  % perl -e 'for (@ARGV) { print "$ARGV\n" if grep /(foo bar baz|quux frobozz)/, <> }' `find /path/to/subdir -type f`

which also failed.  In fact, even

  % perl -e 'for (@ARGV) { print "$ARGV\n" }' `find /path/to/subdir -type f`

failed: it generated a whole bunch of empty lines.  Clearly I have
*no clue* of what's going on.  What exactly is the relationship
between $ARGV and <>?  Is it possible to write a simple one-liner
that cycles through all the lines of *each* of the files in named
in @ARGV and prints the name of the file if at least one of its
lines meets a condition?

Any help would be much appreciated.

jill


-- 
To  s&e^n]d  me  m~a}i]l  r%e*m?o\v[e  bit from my a|d)d:r{e:s]s.



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

Date: Thu, 16 Dec 2004 11:53:51 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <QYjwd.25$I93.1155@news.uswest.net>

J Krugman wrote:
> I've rtfm'd this to death, but I still don't get it.  If someone
> can explain it to me (as opposed to tell me something like "man
> perlfrotz"), I'd be very grateful.
> 
> The immediate problem that serves as the context of the question
> is this: find all the files below /path/to/subdir (this is Linux)
> that contain either of the strings "foo bar baz" or "quux frobozz",
> and do this *from the command line* (i.e. I'm looking for a one-liner
> here, not a longwinded affair using File::Find, etc.).
> 
> I tried

Since you're on a real OS, why not simply use the shell?

find /path/to/subdir -exec egrep -l 'foo bar baz|quux frobozz' {} \;


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

Date: 16 Dec 2004 18:12:25 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <Xns95C18659C113Basu1cornelledu@132.236.56.8>

J Krugman <jkrugman345@yahbitoo.com> wrote in
news:cpshgj$3ti$1@reader1.panix.com: 

> The immediate problem that serves as the context of the question
> is this: find all the files below /path/to/subdir (this is Linux)
> that contain either of the strings "foo bar baz" or "quux frobozz",
> and do this *from the command line* (i.e. I'm looking for a one-liner
> here, not a longwinded affair using File::Find, etc.).

Hmmmm ...

> I tried
> 
>   % perl -e 'print "$ARGV\n" if grep /(foo bar baz|quux frobozz)/, <>'
>   `find /path/to/subdir -type f` 

Why? find, the command whose output you are processing, can take a regex 
to match against. Use that.

$ find . -regex '.*/z.*' -type f  -print
 ./Dload/fpTeX-0.7/package/zed-csp.tpm
 ./Dload/fpTeX-0.7/package/zed-csp.zip
 ./Dload/fpTeX-0.7/package/zefonts.tpm
 ./Dload/fpTeX-0.7/package/zefonts.zip
 ./z.pl
 ./zz.pl

Please consult

man find

>  % perl -e 'for (@ARGV) { print "$ARGV\n" if grep /(foo bar baz|quux
>  frobozz)/, <> }' `find /path/to/subdir -type f` 

You could also go the pure Perl route and use File::Find::Rule but that's 
going to get a little wordy.

I am not too well versed in various shell syntaxes but aren't you 
supposed to write the above as:

% find /path/to/subdir -type f | perl -e "print if /foo/"

But all this seems so unnecessary.

Sinan


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

Date: Thu, 16 Dec 2004 18:17:23 +0000 (UTC)
From: KKramsch <karlUNDERSCOREkramsch@yahooPERIODcom.invalid>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <cpsjfj$4j5$1@reader1.panix.com>

In <QYjwd.25$I93.1155@news.uswest.net> "J. Gleixner" <glex_nospam@qwest.invalid> writes:

>J Krugman wrote:
>> I've rtfm'd this to death, but I still don't get it.  If someone
>> can explain it to me (as opposed to tell me something like "man
>> perlfrotz"), I'd be very grateful.
>> 
>> The immediate problem that serves as the context of the question
>> is this: find all the files below /path/to/subdir (this is Linux)
>> that contain either of the strings "foo bar baz" or "quux frobozz",
>> and do this *from the command line* (i.e. I'm looking for a one-liner
>> here, not a longwinded affair using File::Find, etc.).
>> 
>> I tried

>Since you're on a real OS, why not simply use the shell?

>find /path/to/subdir -exec egrep -l 'foo bar baz|quux frobozz' {} \;


I wish there were a standard term for "answering something other
than what the OP asked."  I bet that this describes far more than
50% of the answers given to questions posted in the Usenet.

I can think of one reason why the OP didn't simply "use the shell"
and that is because there are times when one wants to use regexps
(perhaps coupled with other tests, e.g. such as this regexp must
happen in the file's first line) that are more sophisticated than
the ones that egrep can handle (clearly the "foo bar" regexp was
just a generic example).

To the OP, I can't answer the more theoretical aspects of your
question; I'll leave that to the experts.  But the following works
for me:

  $ find ~/ -type f | xargs perl -e 'for (@ARGV) { next unless -T; while (<>) { ++$found if /(foo bar baz|quux frobozz)/; if (eof && $found) { print "$ARGV\n"; $found = 0; }}}'

I'm sure there are less verbose and/or more efficient (e.g. not
reading *every* line) ways of doing the above in Perl; I look
forward to reading them.

	Karl
-- 
Sent from a spam-bucket account; I check it once in a blue moon.  If
you still want to e-mail me, cut out the extension from my address,
and make the obvious substitutions on what's left.


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

Date: Thu, 16 Dec 2004 18:39:31 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <cpskfc$m4q$1@sun3.bham.ac.uk>



J Krugman wrote:


> I tried
> 
>   % perl -e 'print "$ARGV\n" if grep /(foo bar baz|quux frobozz)/, <>' `find /path/to/subdir -type f` 
> 
> which failed to generate any output, even though I *know* that
> there are files under /path/to/subdir that contain strings "foo
> bar baz" and/or "quux frobozz".

Look at your code.   Your print is outside the loop.

You slurp all the lines from all the input files into a big list.  Then 
you count the number of of matching lines in the list.  Then, and only 
then, if that number is non-zero you print the name of the _current_ 
input file.  Of course at this point there is no current input file.

> Even if it had worked, the last alternative is not good, because
> it can easily fail through choking the shell with an excessively
> long arguments list.  There has to be a better way.
> 
> At any rate, I also tried
> 
>   % perl -e 'for (@ARGV) { print "$ARGV\n" if grep /(foo bar baz|quux frobozz)/, <> }' `find /path/to/subdir -type f`

Exacly the same problem as above.
> 
> which also failed.  In fact, even
> 
>   % perl -e 'for (@ARGV) { print "$ARGV\n" }' `find /path/to/subdir -type f`
> 
> failed: it generated a whole bunch of empty lines.  Clearly I have
> *no clue* of what's going on.  What exactly is the relationship
> between $ARGV and <>?

You problem is that you are failing to realise that in a list context <> 
slurps all the lines the input files into a single list.  The value of 
$ARGV is only meaningful if you are using <> in a scalar context.

>  Is it possible to write a simple one-liner
> that cycles through all the lines of *each* of the files in named
> in @ARGV and prints the name of the file if at least one of its
> lines meets a condition?

perl -ne 'print "$ARGV\n" if /whatever/ && !$seen{$ARGV}++'




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

Date: Thu, 16 Dec 2004 18:07:34 GMT
From: "JayEs" <not@home.net>
Subject: Re: [Slightly OT] Perl interpreter (win32) single "threaded"?
Message-Id: <G9kwd.365$wi2.248@newssvr11.news.prodigy.com>


> On the other hand, if your test produces the same results when run on a
> public server, you've done two things: You've eliminated server issues 
> from consideration as a possible cause, and at the same time produced a 
> simple test script that others can use to help you diagnose the problem.

Sherm, Thanks!
I tried that. Of course the script runs fine on the pub server, but sits 
around and doesn't when started multiple times.... Anywho, here is the 
"public script" I hacked together for the test.

#!/usr/bin/perl -w

  use WWW::Mechanize;
  my $agent = WWW::Mechanize->new();

  #Build the URL
  my $propertyID;  #= $ARGV[0];
   foreach (@ARGV) {
        $propertyID = "$_\n";
#}

    #= @ARGV[1];
  my $url = 
"http://www.redroof.com/reservations/inn_details.asp?innNumber=".$propertyID;

  #Navigate
  $agent->get($url);
  $agent->follow("Make a Reservation");

  #INIT THE FORM
  $agent->form_number(1);

  #FILL IN DATES (use hard coded for test)
  $agent->select("arrivalDay", "22");
  $agent->select("arrivalMonth", "December");
  $agent->select("departureDay", "24");
  $agent->select("departureMonth", "December");

  #CLICK THE SEARCH BUTTON
  $agent->click();

  # NO REAL OUTPUT THIS IS JUST A TEST
    my $test = $agent->{content};
    print "Searched  Hotel Number $propertyID \n";
    print "$test \n";
  #-------------------------------------------------




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

Date: 16 Dec 2004 19:04:23 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: [Slightly OT] Perl interpreter (win32) single "threaded"?
Message-Id: <Xns95C18F29343DEasu1cornelledu@132.236.56.8>

"JayEs" <not@home.net> wrote in
news:G9kwd.365$wi2.248@newssvr11.news.prodigy.com: 

> 
>> On the other hand, if your test produces the same results when run on
>> a public server, you've done two things: You've eliminated server
>> issues from consideration as a possible cause, and at the same time
>> produced a simple test script that others can use to help you
>> diagnose the problem. 
> 
> Sherm, Thanks!
> I tried that. Of course the script runs fine on the pub server, but
> sits around and doesn't when started multiple times.... Anywho, here
> is the "public script" I hacked together for the test.

>   #Build the URL
>   my $propertyID;  #= $ARGV[0];
>    foreach (@ARGV) {
>         $propertyID = "$_\n";

I don't have time to test the retst of your script right now, but what do 
you think this does?


Sinan.


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

Date: 16 Dec 2004 14:24:13 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Can't get past 'use strict' :(
Message-Id: <Xns95C15FA89CA0Fasu1cornelledu@132.236.56.8>

"Robin" <webmaster @ infusedlight.net> wrote in news:WY6dne9XT_dMyFzcRVn-
gg@comcast.com:

> 
> "Karlo Lozovina" <_karlo_@_mosor.net_> wrote in message 
> news:Xns95C0B356F954Bkarlomosornet@130.133.1.4...

>> while(my $line = <DIRLIST>) {
>>        my $dir_list[$i] = $line;
>>        chomp($dir_list[$i]);

 ...

>> syntax error at ./backup.pl line 24, near "$dir_list["

>> -- 
>> _______                                        Karlo Lozovina - Mosor
>> |   |   |.-----.-----.
>> |       ||  _  |  _  |  Na osami blizu mora, dok se sunce zemlji smije
>> |__|_|__||_____|_____|                  Balun gledat, za njin letit...
> 
> actually, your code looks pretty tight.
> -Robin 

For various values of tight.

How can something that is reported by perl to be a syntax error be 
considered "tight".

Oh, by the way, please take a look at the posting guidelines and definitely 
do not quote people's signatures.

Sinan.


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

Date: 16 Dec 2004 14:26:03 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Can't get past 'use strict' :(
Message-Id: <Xns95C15FF8BCDCasu1cornelledu@132.236.56.8>

"Peter Wyzl" <wyzelli@yahoo.com> wrote in
news:ayewd.74895$K7.45851@news-server.bigpond.net.au: 

> "Karlo Lozovina" <_karlo_@_mosor.net_> wrote in message 
> news:Xns95C0B356F954Bkarlomosornet@130.133.1.4...
>: Here I go again: the following code:
>:
>: while(my $line = <DIRLIST>) {
>:        my $dir_list[$i] = $line;
>:        chomp($dir_list[$i]);
>:        $i++;
>: }
> 
> It won't compile even without 'use strict'.  You can't declare a slice
> of an array like that, you need to declare the whole array and then
> assign to the slices.  

Minor correction: $dir_list[$i] is not a slice but an array element.

Sinan


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

Date: Thu, 16 Dec 2004 16:57:41 +0100
From: frans abels <fabels@yahoo.com>
Subject: Re: Can't get past 'use strict' :(
Message-Id: <pan.2004.12.16.16.57.41.664309.986@yahoo.com>

On Thu, 16 Dec 2004 10:31:12 +0100, Robin wrote:


> "Karlo Lozovina" <_karlo_@_mosor.net_> wrote in message
> news:Xns95C0B356F954Bkarlomosornet@130.133.1.4...
>> Here I go again: the following code:
>>
>> while(my $line = <DIRLIST>) {
>>        my $dir_list[$i] = $line;
>>        chomp($dir_list[$i]);
>>        $i++;
>> }
>>
>> produces this error:
>>
>> syntax error at ./backup.pl line 24, near "$dir_list["
>>

> actually, your code looks pretty tight. -Robin

I don't know what that means,
but it has a syntax error...
my is not allowed with array-element assignments.
If you want to code this way and not the most efficient way
it should be:

my @dir_list;
while(my $line = <DIRLIST>) {
       $dir_list[$i] = $line;
       chomp($dir_list[$i]);
       $i++;
}


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

Date: Thu, 16 Dec 2004 17:47:18 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Can't get past 'use strict' :(
Message-Id: <cpshdg$kk1$1@sun3.bham.ac.uk>



A. Sinan Unur wrote:

> "Robin" <webmaster @ infusedlight.net> wrote in news:WY6dne9XT_dMyFzcRVn-
> gg@comcast.com:
>>
>>actually, your code looks pretty tight.
> 
> For various values of tight.

The only one I think he means is is meaning #6 as defined in 
Merriam-Webster Online dictionary. :-)



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

Date: Thu, 16 Dec 2004 13:53:44 -0500
From: Mark Seger <Mark.Seger@hp.com>
Subject: EOF and reading /proc
Message-Id: <41c1dcb8@usenet01.boi.hp.com>

I have a script I've been running for some time that reads process data 
from /proc/pid/stat.  My outer loop open /proc and reads each entry with 
   readdir, opening that appropriate stat file and reading though it in 
an inner loop as follow - the reason for the '99' is the same routine is 
used to read other /proc structures beside process data:

   for ($i=0; $i<99; $i++)
   {
     last    if !($line=<PROC>);
     print $line;
   }
   close PROC;

In any event, this should (and does) read a single line and then fall 
through the loop.  However, if I run this for a long time, it 
occasionaly reads a second record which is not right!  the contents of 
that partial line look like the end of 'stat':

Opened /proc/8887/stat
8887 (sshd) R 1761 1761 1761 0 -1 64 153 54 231 43 19 62 0 0 15 0 0 0 
484375023 6979584 449 4294967295 134512640 134784984 3221221808 
3221202756 4294959106 0 0 4096 73728 0 0 0 17 0 0 0 19 62 0 0
9 62 0 0

thoughts?

-mark



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

Date: 16 Dec 2004 06:23:14 -0800
From: "globalbid" <misymagicg@yahoo.com>
Subject: Found this and thought if was of Use !
Message-Id: <1103206994.844937.103140@f14g2000cwb.googlegroups.com>

Project Manager & Freelancer
Make History With Outsourced
Project at Lowest Fee Ever

Come See the New Way Projects Get Done

It could happen to you. You could get your project done at the cheapest
bottom-line solution available. It could happen, only if you use
GlobalFreelance.com.

Maybe you're thinking that's a pretty big boast for an online
company. It would be, if we didn't back our low fees up with personal
support for all projects. Yes, you read it right. Personal support.

There's no sign-up fee, no monthly fee, and you only pay for the
projects you bid on. Where else can you get listing fees for as low as
$5 a project? No where on earth, except GlobalFreelance.com.

So, do you want low fees & one on one service with a real human? Then
you want GlobalFreelance.com!

Outsourcing is the smart choice for the new way of keeping the cost of
business low. Take a look at all of the areas GlobalFreelance.com
offers for posting and bidding -

<a href="http://www.GlobalFreelance.com" >Click Here Now</a>

GlobalFreelance.com is the best place to get your project done at the
lowest price. Period. End of discussion. Forget the other online
outsource connection websites. Go to our website and get it all.

Get the world at GlobalFreelance.com!
Copyright 2004 GlobalFreelance.com. All rights reserved.



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

Date: 16 Dec 2004 08:02:23 -0800
From: "dale" <zhangd@tycoelectronics.com>
Subject: Re: How to go to a link and save a page and email it out?
Message-Id: <1103212942.979224.38800@c13g2000cwb.googlegroups.com>

Thank you all for the helps. I have found the solution by using
WWW::Mechanize. It is really cool.

-Dale



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

Date: Thu, 16 Dec 2004 14:37:37 GMT
From: Ole.Johansson@kilo.sunet.se (Ole)
Subject: Is there a field-data abstraction layer for DBI/MySQL?
Message-Id: <41c19cf7.866000@news.rz.uni-duesseldorf.de>

Hi there!

I'm currently looking for a kind of "field-data abstraction layer for
DBI/MySQL". It should solve the issues of table layout and data
access.
Now I try to find out if there is a module availalble of if I need to
breed my own.

some pseudo code to illustrate what I mean:

at the moment I need to do this

- do some SQL query
- @row = handle->fetchrow_array
- access data-field by $data-in-field = $row[4]

here I need to know what the table layout is.
And I can't hardly change the table layout after I introduced a
specific layout into my code

I should be like this:
access sql and fetch data-field in one step:
-$data-in-field = $table-$row{id}-$field{name}

this should solve all my problems, as I don't really care about table
layout and efficiently accessing sql, everything should be done in the
background.
This should make it possible to build tree like data structures into a
sql table

Is there such a solution?
Thanks!




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

Date: 16 Dec 2004 14:57:43 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Is there a field-data abstraction layer for DBI/MySQL?
Message-Id: <Xns95C1655727212asu1cornelledu@132.236.56.8>

Ole.Johansson@kilo.sunet.se (Ole) wrote in news:41c19cf7.866000
@news.rz.uni-duesseldorf.de:

> Hi there!
> 
> I'm currently looking for a kind of "field-data abstraction layer for
> DBI/MySQL". It should solve the issues of table layout and data
> access.

 ...

> This should make it possible to build tree like data structures into a
> sql table

I am not sure what you are really asking for, but do you think Class::DBI 
might help?

http://search.cpan.org/~tmtm/Class-DBI-0.96/

Sinan


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

Date: Fri, 17 Dec 2004 01:23:13 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Is there a field-data abstraction layer for DBI/MySQL?
Message-Id: <32dnj5F3l4o6lU1@individual.net>

Ole wrote:

> Hi there!
> 
> I'm currently looking for a kind of "field-data abstraction layer for
> DBI/MySQL". It should solve the issues of table layout and data
> access.
> Now I try to find out if there is a module availalble of if I need to
> breed my own.
> 
> some pseudo code to illustrate what I mean:
> 
> at the moment I need to do this
> 
> - do some SQL query
> - @row = handle->fetchrow_array
> - access data-field by $data-in-field = $row[4]
> 
> here I need to know what the table layout is.
> And I can't hardly change the table layout after I introduced a
> specific layout into my code
> 
> I should be like this:
> access sql and fetch data-field in one step:
> -$data-in-field = $table-$row{id}-$field{name}
> 
> this should solve all my problems, as I don't really care about table
> layout and efficiently accessing sql, everything should be done in the
> background.
> This should make it possible to build tree like data structures into a
> sql table
> 
> Is there such a solution?
> Thanks!

You are VERY confused. Read a good database book (Date or Ullman).

Your select statement will give you the row names, bases on tables/joins.
You can use aliases to assist Perl with name bindings
eg  select max(x) * min(y) as myresult from table
You can then use myresult as a field.


mysql does not support hierarchical queries directly. Oracle does support
this with "connect by" and "start" keywords.

There is a workaround for mysql - storing the 'path' to a node & using it as
a sort key. I've used it here -   http://www.pchq.com.au/cat_all.htm

gtoomey


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

Date: Thu, 16 Dec 2004 10:01:14 -0600
From: "Andrew A. Raines" <aaraines@pobox.com>
Subject: Re: Is there a field-data abstraction layer for DBI/MySQL?
Message-Id: <87y8fyz0z9.fsf@mid.packer.its.vanderbilt.edu>

Ole.Johansson@kilo.sunet.se (Ole) writes:

[...]

> I should be like this:
> access sql and fetch data-field in one step:
> -$data-in-field = $table-$row{id}-$field{name}

Will not DBI::fetchall_hashref() do what you want?

-- 
    aaraines@pobox.com (Andrew A. Raines)


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

Date: Thu, 16 Dec 2004 09:21:27 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Pattern Matching
Message-Id: <ARgwd.14661$pb.1003590@news20.bellglobal.com>


"daniel kaplan" <nospam@nospam.com> wrote in message 
news:1103165983.431377@nntp.acecape.com...
> "Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
> news:wa5wd.12375$pb.879697@news20.bellglobal.com...
>
>> You're under the mistaken impression that there's a huge need to check 
>> the
>> validity of last names.
>
> my line of thought was that with a gazillion websites out there, that ask
> for registration, "yes."
>

But the usefulness of the input field should determine what lengths you go 
to to validate it. The worst thing you can do is get it wrong and have 
someone not be able to register because you didn't consider something in 
their last name.

This is a good case of a situation where you should only be considering what 
you want to exclude. In other words, if it were up to me I'd probably only 
check that the field isn't blank and that there are no "<" characters in it 
(i.e., no attempts to add html or a malicious javascript in the hopes that 
the last name will be displayed on a world-viewable page), and leave the 
more thorough checks for email/password/credit card fields, etc.

Matt 




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

Date: Thu, 16 Dec 2004 09:46:39 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Pattern Matching
Message-Id: <1103208369.583432@nntp.acecape.com>

"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
news:ARgwd.14661$pb.1003590@news20.bellglobal.com...


> This is a good case of a situation where you should only be considering
what
> you want to exclude. In other words, if it were up to me I'd probably only
> check that the field isn't blank and that there are no "<" characters in
it
> (i.e., no attempts to add html or a malicious javascript in the hopes that
> the last name will be displayed on a world-viewable page), and leave the
> more thorough checks for email/password/credit card fields, etc.

in the end, i am just building the prototype, so i think am more than safe
with

/[^\w`\']|_|\s|[0-9]/


but thank you for all your thoughts...i appreciate them very much!

daniel




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

Date: Thu, 16 Dec 2004 15:45:21 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Pattern Matching
Message-Id: <l4iwd.1178$5m3.710@trndny04>


"daniel kaplan" <nospam@nospam.com> wrote in message
news:1103208369.583432@nntp.acecape.com...
> "Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
> news:ARgwd.14661$pb.1003590@news20.bellglobal.com...
>
>
> in the end, i am just building the prototype, so i think am more than
safe
> with
>
> /[^\w`\']|_|\s|[0-9]/

Ignoring for the moment that you've ignored everyone's point about other
characters that can be legitamite in a surname, this regexp just looks
weird.  It says to match:

1) anything that's not a (letter, digit, underscore, backtick, or
apostrophe) OR
2) an underscore OR
3) a space OR
4) a digit

A space (3) is already covered by (1), so that's pointless.
A digit (4) overrides the seletion of not-digit in (1)
An underscore (2) overrides the selection of not-underscore in (1).
A single quote is not special in a regexp (nor in a character class, so
there's no reason to escape it.

So can you explain why you're doing this instead of:
/[^a-zA-Z`']/

Paul Lalli




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

Date: Thu, 16 Dec 2004 11:24:48 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Pattern Matching
Message-Id: <1103214260.229843@nntp.acecape.com>

"Paul Lalli" <mritty@gmail.com> wrote in message
news:l4iwd.1178$5m3.710@trndny04...
>
> Ignoring for the moment that you've ignored everyone's point about other
> characters that can be legitamite in a surname, this regexp just looks
> weird.  It says to match:


> So can you explain why you're doing this instead of:
> /[^a-zA-Z`']/

i was trying to cover as many bases as possible....hoping my version would
allow ALT 0193 for instance (an accented letter)  but it did not.....since i
came to realize it would not, but did cover my ass (english wise) i just
left it and moved on....like i said, prototype, making thin pieces of each
section rather than building the entire framework completly....

thanks for the thuoghts tho




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

Date: 16 Dec 2004 07:59:08 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Regarding ISA and Inheritance
Message-Id: <1103213007.7d378e68888f14e9f447aa04334dd175@teranews>

>>>>> "Sherm" == Sherm Pendley <spamtrap@dot-app.org> writes:

Sherm> In the simplest case, where the classes are named "base" and
Sherm> "derived", @derived::ISA might be declared in "derived.pm" like this:

Sherm>      package derived;
Sherm>      our @ISA = qw(base);

And keep in mind that lowercase package names are reserved, especially
the one called "base", which already does most of what you're looking for:

        package Derived;
        use base qw(Base);

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V10 Issue 7525
***************************************


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