[28760] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 7 09:05:47 2007

Date: Sun, 7 Jan 2007 06:05:04 -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           Sun, 7 Jan 2007     Volume: 11 Number: 4

Today's topics:
    Re: $r not work in mod_perl 2 jason.yfho@gmail.com
    Re: $r not work in mod_perl 2 <no@email.com>
        comparing large number of data <perl.lover@nospam.com>
    Re: comparing large number of data <nospam@somewhere.com>
    Re: comparing large number of data <nobull67@gmail.com>
    Re: comparing large number of data <perl.lover@nospam.com>
    Re: Elegant equivalent to this regex? <sherifffruitfly@gmail.com>
    Re: Elegant equivalent to this regex? <jurgenex@hotmail.com>
    Re: join array elements into a string <perl.lover@nospam.com>
        new CPAN modules on Sun Jan  7 2007 (Randal Schwartz)
    Re: regex <abigail@abigail.be>
    Re: stalling server client program <DJStunks@gmail.com>
    Re: stalling server client program <deadpickle@gmail.com>
    Re: substitutions in a large file <m@remove.this.part.rtij.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 7 Jan 2007 02:00:43 -0800
From: jason.yfho@gmail.com
Subject: Re: $r not work in mod_perl 2
Message-Id: <1168164043.378869.259410@s80g2000cwa.googlegroups.com>

Dear Brian,

Thank you for your reply.

When I set "SetHandler perl-script", the script cannot be run and the
browser ask me whether to download the "test1.pl" file.

I found that my Apachectl start error_log:
Apache/2.2.3 (Unix) mod_perl/2.0.3 Perl/v5.8.8 configured

I see the http://perl.apache.org 's installation manual, it's Apache
error_log don't have the "Perl/v5.8.8" configured. Is that "Perl" is
not needed and just "mod_perl" should be used with Apache? i.e. my .pl
script should not be interpreted as by Perl but by mod_perl??

Thank you!

Jason

Brian McCauley wrote:
> jason.yfho@gmail.com wrote:
>
> > I installed mod_perl 2 (static mod) in my linux, however, seems the
> > perl script cannot invoke the mod_perl's function. anyone can give me
> > some ideaa on the problem? My purpose of using mod_perl is the get the
> > full header of all HTTP request to Apache. Thank you so much! Below is
> > the scenario:
> >
> >
> > System:
> > - Fedora 3
> > - Apache 2.2.3
> > - Perl 5.8.8
> >
> >
> > I added the following in httpd.conf:
> > PerlModule Apache2::Registry
> > <Directory "/usr/local/apache2/htdocs">
> > ......
> >       Options Indexes FollowSymLinks ExecCGI
> >       PerlHandler Apache2::Registry
> >       PerlSendHeader On
> > ......
> > </Directory>
>
> My Apache2+mod_perl2 is a bit rusty but shouldn't there be a
> "SetHandler perl-script" in there?
>
> Wasn't Apache2::Registry renamed ModPerl::Registry?
>
> > The following error in error_log:
> > [Sat Jan 06 18:44:32 2007] [error] [client 192.168.1.35] Can't call
> > method "print" on an undefined value at
> > /usr/local/apache2/htdocs/test1.pl line 8.
>
> I'd suggest printing out __PACKAGE__. If it says "main" then your
> script is being executed via CGI not mod_perl.



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

Date: Sun, 07 Jan 2007 10:16:45 +0000
From: Brian Wakem <no@email.com>
Subject: Re: $r not work in mod_perl 2
Message-Id: <50bvjlF1f92iuU1@mid.individual.net>

jason.yfho@gmail.com wrote:

> Dear Brian,
> 
> Thank you for your reply.
> 
> When I set "SetHandler perl-script", the script cannot be run and the
> browser ask me whether to download the "test1.pl" file.


Either you do not have that directory configured for execution or, more
likely, you are not printing the correct headers.



-- 
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png


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

Date: Sat, 6 Jan 2007 22:52:53 -0500
From: "Perl Lover" <perl.lover@nospam.com>
Subject: comparing large number of data
Message-Id: <45a06e94$0$97264$892e7fe2@authen.yellow.readfreenews.net>

I am writing a generic tool in perl DBD to compare data between
two tables and sync them up. The tables are guranteed to have
a primary key or unique index. One table is designated as the
base table and the other table as the target table where changes
from the base table will be applied.

The logic I am following is to select all rows from the base table
and pick its primary key, row by row. Then do a select on the
target table based on the primary key and compare the result
of the two rows (one from base table and the other from the target
table).

Can I make it faster by any other method. 




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

Date: Sun, 7 Jan 2007 02:06:40 -0500
From: "Thrill5" <nospam@somewhere.com>
Subject: Re: comparing large number of data
Message-Id: <PsWdnQjJ38GcAT3YnZ2dnUVZ_qarnZ2d@comcast.com>


"Perl Lover" <perl.lover@nospam.com> wrote in message 
news:45a06e94$0$97264$892e7fe2@authen.yellow.readfreenews.net...
>I am writing a generic tool in perl DBD to compare data between
> two tables and sync them up. The tables are guranteed to have
> a primary key or unique index. One table is designated as the
> base table and the other table as the target table where changes
> from the base table will be applied.
>
> The logic I am following is to select all rows from the base table
> and pick its primary key, row by row. Then do a select on the
> target table based on the primary key and compare the result
> of the two rows (one from base table and the other from the target
> table).
>
> Can I make it faster by any other method.
>

Most of the heavy lifting could be done using SQL commands

#Returns a list of primary_keys from basetable that are not in target
SELECT basetable.primary_key EXCEPT SELECT target.primary_key

#Returns all the records in basetable that are not identical to the records 
in target
SELECT basetable.* WHERE  NOT EXISTS (SELECT target.* WHERE
   (basetable.field1 = target.field1 AND
   basetable.field2 = target.field2  AND
  ...)

You could further optimize to INSERT the new records or perform the UPDATE 
instead of just finding them.

Scott




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

Date: 7 Jan 2007 04:16:45 -0800
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: comparing large number of data
Message-Id: <1168172205.577065.323060@51g2000cwl.googlegroups.com>



On Jan 7, 7:06 am, "Thrill5" <nos...@somewhere.com> wrote:
> "Perl Lover" <perl.lo...@nospam.com> wrote in messagenews:45a06e94$0$97264$892e7fe2@authen.yellow.readfreenews.net...
>
> >I am writing a generic tool in perl DBD to compare data between
> > two tables and sync them up. The tables are guranteed to have
> > a primary key or unique index. One table is designated as the
> > base table and the other table as the target table where changes
> > from the base table will be applied.
>
> > The logic I am following is to select all rows from the base table
> > and pick its primary key, row by row. Then do a select on the
> > target table based on the primary key and compare the result
> > of the two rows (one from base table and the other from the target
> > table).
>
> > Can I make it faster by any other method.Most of the heavy lifting could be done using SQL commands
>
> #Returns a list of primary_keys from basetable that are not in target
> SELECT basetable.primary_key EXCEPT SELECT target.primary_key
>
> #Returns all the records in basetable that are not identical to the records
> in target
> SELECT basetable.* WHERE  NOT EXISTS (SELECT target.* WHERE
>    (basetable.field1 = target.field1 AND
>    basetable.field2 = target.field2  AND
>   ...)

That's quite a challenge for the the SQL optomiser. I prefer to do it
with outer joins...

#Returns a list of primary_keys from basetable that are not in target
SELECT basetable.primary_key
FROM basetable
          LEFT OUTER JOIN target
          ON basetable.primary_key = target.primary_key
WHERE target.primary_key IS NULL

# Returns all the records in basetable that are not identical
# to the records in target

SELECT basetable.*
FROM basetable
          LEFT OUTER JOIN target
          ON basetable.field1 = target.field1 AND
               basetable.field2 = target.field2  AND
               ...
WHERE target.primary_key IS NULL

This, of course, has nothing to do with Perl.



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

Date: Sun, 7 Jan 2007 08:51:20 -0500
From: "Perl Lover" <perl.lover@nospam.com>
Subject: Re: comparing large number of data
Message-Id: <45a0fad5$0$97219$892e7fe2@authen.yellow.readfreenews.net>

>> #Returns a list of primary_keys from basetable that are not in target
>> SELECT basetable.primary_key EXCEPT SELECT target.primary_key
>>
>> #Returns all the records in basetable that are not identical to the 
>> records
>> in target
>> SELECT basetable.* WHERE  NOT EXISTS (SELECT target.* WHERE
>>    (basetable.field1 = target.field1 AND
>>    basetable.field2 = target.field2  AND
>>   ...)
>
> That's quite a challenge for the the SQL optomiser. I prefer to do it
> with outer joins...
>
> #Returns a list of primary_keys from basetable that are not in target
> SELECT basetable.primary_key
> FROM basetable
>          LEFT OUTER JOIN target
>          ON basetable.primary_key = target.primary_key
> WHERE target.primary_key IS NULL
>
> # Returns all the records in basetable that are not identical
> # to the records in target
>
> SELECT basetable.*
> FROM basetable
>          LEFT OUTER JOIN target
>          ON basetable.field1 = target.field1 AND
>               basetable.field2 = target.field2  AND
>               ...
> WHERE target.primary_key IS NULL
>
> This, of course, has nothing to do with Perl.

this whole exercise started in Perl because doing it in SQL
just killed the RDBMS. Imagine doing it on a table with
30 million rows.





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

Date: 6 Jan 2007 22:53:03 -0800
From: "sherifffruitfly" <sherifffruitfly@gmail.com>
Subject: Re: Elegant equivalent to this regex?
Message-Id: <1168152783.232590.17750@v33g2000cwv.googlegroups.com>


J=FCrgen Exner wrote:

> >> If you just want to strip out the non-numerics why futz with regexps?

> > Because I want to use regex, please.

> please explain.
>
> jue

I'm afraid I don't understand what is to be explained. I asked for
merely an improved regex. You (above) questioned my use of regex. I
repeated that I was using regex. Then you ask me to explain. Explain
what, exactly?

If you (or anyone) wish to only answer questions *you* think I *should*
be asking, rather than questions I am *actually* asking, that's fine, I
suppose. I don't see how that requires any explanation from *me*,
however.

Didn't mean for this to become acrimonious - I just wanted a better
regex. I'll leave now.

Thanks anyway,

cdj



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

Date: Sun, 07 Jan 2007 09:44:01 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Elegant equivalent to this regex?
Message-Id: <Bh3oh.411$GL.47@trndny06>

sherifffruitfly wrote:
> Jürgen Exner wrote:
You snipped some vital parts of this discussion:
Someone (usenet@....) suggested:
    >>    (my $numbers = $original) =~ s/\D//g ;

You replied:
>>> Because I want to use regex, please.

To me this indicates that you are not satisfied with the suggested solution 
because it does not use a 'regex'.
Is this correct so far?

Then I replied
    /\D/ _is_ a regular expression. If you mean something else by 'regex' 
then
    please explain.

>> please explain.

> I'm afraid I don't understand what is to be explained.
> I asked for merely an improved regex. You (above) questioned my use of 
> regex. I
> repeated that I was using regex. Then you ask me to explain. Explain
> what, exactly?

'Regex' is not a word of the English language. However it is commonly used 
as an abbreviation of 'regular expression'.
Assuming that you are using 'regex' with this common meaning, too, then your 
comment about the suggested solution is non-sensical because the suggested 
solution does use a regular expression. /\D/ is a regular expression, 
therefore the solution meets your request for using regular expressions.
The other alternative is that you are _not_ using 'regex' in the common 
meaning of 'regular expression', in which case I asked you to please explain 
what do you mean with 'regex'.

> If you (or anyone) wish to only answer questions *you* think I
> *should* be asking, rather than questions I am *actually* asking,
> that's fine, I suppose.

But usenet@... was answering your question. He did suggest a solution that 
uses a regular expression.

> I don't see how that requires any explanation
> from *me*, however.

If the suggested solution does not satisfy your needs then you need to 
explain why not. It does use a regular expression which everyone assumed you 
were looking for. You are saying it doesn't use a 'regex'. So apparently we 
are at odds about the meaning of 'regex' and only _you_ can explain what 
_you_ meant with 'regex' because apparently it is not the normal meaning 
'regular expression'.

jue 




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

Date: Sat, 6 Jan 2007 18:08:07 -0500
From: "Perl Lover" <perl.lover@nospam.com>
Subject: Re: join array elements into a string
Message-Id: <45a02bd5$0$97234$892e7fe2@authen.yellow.readfreenews.net>

Thank you all for various suggestions.

regards.




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

Date: Sun, 7 Jan 2007 05:42:13 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Jan  7 2007
Message-Id: <JBHH6D.117t@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Apache-SWIT-0.19
http://search.cpan.org/~bosu/Apache-SWIT-0.19/
mod_perl based application server with integrated testing.
----
Audio-Musepack-0.7
http://search.cpan.org/~daniel/Audio-Musepack-0.7/
An object-oriented interface to Musepack file information and APE tag fields, implemented entirely in Perl.
----
Authen-GoogleAccount-0.01
http://search.cpan.org/~mahito/Authen-GoogleAccount-0.01/
Simple Authentication with Google Account
----
Convert-Cisco-0.03
http://search.cpan.org/~marko/Convert-Cisco-0.03/
Module for converting Cisco billing records
----
Crypt-Camellia_PP-0.02
http://search.cpan.org/~oyama/Crypt-Camellia_PP-0.02/
Pure Perl Camellia 128-bit block cipher module.
----
DateTime-Locale-0.33
http://search.cpan.org/~drolsky/DateTime-Locale-0.33/
Localization support for DateTime.pm
----
Error-TryCatch-0.06
http://search.cpan.org/~nilsonsfj/Error-TryCatch-0.06/
OO-ish Exception Handling through source filtering
----
IP-QQWry-v0.0.10
http://search.cpan.org/~sunnavy/IP-QQWry-v0.0.10/
a simple interface for QQWry IP database(file).
----
Konfidi-Client-1.0.3
http://search.cpan.org/~brondsem/Konfidi-Client-1.0.3/
Interact with a Konfidi TrustServer
----
Math-Random-Cauchy-0.01
http://search.cpan.org/~smueller/Math-Random-Cauchy-0.01/
Random numbers following a Cauchy PDF
----
Math-Random-Cauchy-0.02
http://search.cpan.org/~smueller/Math-Random-Cauchy-0.02/
Random numbers following a Cauchy PDF
----
Ogg-Vorbis-Decoder-0.7
http://search.cpan.org/~daniel/Ogg-Vorbis-Decoder-0.7/
An object-oriented Ogg Vorbis to decoder
----
PApp-1.2
http://search.cpan.org/~mlehmann/PApp-1.2/
multi-page-state-preserving web applications
----
POE-Component-Client-DNS-1.00
http://search.cpan.org/~rcaputo/POE-Component-Client-DNS-1.00/
non-blocking, concurrent DNS requests
----
Statistics-Test-RandomWalk-0.01
http://search.cpan.org/~smueller/Statistics-Test-RandomWalk-0.01/
Random Walk test for random numbers
----
TAPx-Parser-0.50_01
http://search.cpan.org/~ovid/TAPx-Parser-0.50_01/
Parse TAP output
----
TAPx-Parser-0.50_02
http://search.cpan.org/~ovid/TAPx-Parser-0.50_02/
Parse TAP output
----
Text-Match-FastAlternatives-0.04
http://search.cpan.org/~arc/Text-Match-FastAlternatives-0.04/
efficient search for many strings
----
Text-Password-Pronounceable-0.28
http://search.cpan.org/~clkao/Text-Password-Pronounceable-0.28/
Generate pronounceable passwords
----
XML-Table2XML-0.01
http://search.cpan.org/~rkapl/XML-Table2XML-0.01/
Generic conversion of tabular data to XML by reverting Excel's flattener methodology.
----
XML-Table2XML-0.02
http://search.cpan.org/~rkapl/XML-Table2XML-0.02/
Generic conversion of tabular data to XML by reverting Excel's flattener methodology.


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
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: 07 Jan 2007 10:46:00 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: regex
Message-Id: <slrneq1jr9.fg.abigail@alexandra.abigail.be>

lucas (lstouder@teksavvy.com) wrote on MMMMDCCCLXXVI September MCMXCIII
in <URL:news:28e3e$45a01650$cef8bf30$16302@TEKSAVVY.COM-Free>:
^^  I have this perl oneliner that I'm using to recognize certain file
^^  extentions in a url.  This works, but I was wondering if any of you know of
^^  a better way to write this.
^^  
^^  echo "http://fu.bar/test.jpg" | perl -ne 'print if((/\.jpg\n$/i)|
^^  (/\.bmp\n$/i)||(/\.png\n$/i));'


Yeah.

    echo "http://fu.bar/test.jpg"

is a lot simpler. 


Or did you want to ask how to grep? In that case, I'd use 'grep', not perl.


Abigail
-- 
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()


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

Date: 6 Jan 2007 15:19:24 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: stalling server client program
Message-Id: <1168125564.402694.197320@s34g2000cwa.googlegroups.com>


deadpickle wrote:
> DJ Stunks wrote:
> > deadpickle wrote:
> > > This program is designed to transfer a file to a client. When i go to
> > > run the program It sends the file once then sits there. The file that
> > > is sent is not closed and there fore conatins no data. I'm not sure
> > > what the problem is.
> > > <snip>
> >
> > There are dozens of modules out there to accomplish what you're trying
> > to do
> >
> > How about an IO::All solution?
>
> Your right this looks hugly simplified but, when I run a syntax check I
> get the error "Can't locate IO/All.pm in @INC (@INC contains:
> C:/Perl/site/lib C:/Perl/lib .) at serverAll.pl line 4." not sure what
> that means, any idea?

it means you need to install the IO::All module before you can use it.


refer to perldoc perlmodinstall

from cmd prompt type ppm3
you will probably have to add the trouchelle.com repository
  (from ppm prompt:  rep add trouchelle.com http://trouchelle.com/ppm/
)
from ppm prompt:  install IO::All

I'll leave you to it.

> also will this be able to transfer the file over
> and over every 5 seconds?

you can do anything your little heart desires.  This is Perl.

-jp



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

Date: 6 Jan 2007 18:17:39 -0800
From: "deadpickle" <deadpickle@gmail.com>
Subject: Re: stalling server client program
Message-Id: <1168136259.282733.320750@i15g2000cwa.googlegroups.com>


DJ Stunks wrote:
> deadpickle wrote:
> > DJ Stunks wrote:
> > > deadpickle wrote:
> > > > This program is designed to transfer a file to a client. When i go to
> > > > run the program It sends the file once then sits there. The file that
> > > > is sent is not closed and there fore conatins no data. I'm not sure
> > > > what the problem is.
> > > > <snip>
> > >
> > > There are dozens of modules out there to accomplish what you're trying
> > > to do
> > >
> > > How about an IO::All solution?
> >
> > Your right this looks hugly simplified but, when I run a syntax check I
> > get the error "Can't locate IO/All.pm in @INC (@INC contains:
> > C:/Perl/site/lib C:/Perl/lib .) at serverAll.pl line 4." not sure what
> > that means, any idea?
>
> it means you need to install the IO::All module before you can use it.
>
>
> refer to perldoc perlmodinstall
>
> from cmd prompt type ppm3
> you will probably have to add the trouchelle.com repository
>   (from ppm prompt:  rep add trouchelle.com http://trouchelle.com/ppm/
> )
> from ppm prompt:  install IO::All
>
> I'll leave you to it.
>
> > also will this be able to transfer the file over
> > and over every 5 seconds?
>
> you can do anything your little heart desires.  This is Perl.
>
> -jp

When I try to install the modules I recieve the error
"ERROR: Don't know how to unpack
http://trouchelle.com/ppm/MSWin32-x86-multi-thread-5.8/IO-All-0.36.zip"



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

Date: Sun, 07 Jan 2007 10:09:05 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: substitutions in a large file
Message-Id: <pan.2007.01.07.09.09.05.269936@remove.this.part.rtij.nl>

On Sat, 06 Jan 2007 19:10:03 +0000, Nospam wrote:

> Basically I have a local html file, called file1.html it has a series of
> links
> (with a particular domain name) in addition to the html code, I am trying to
> follow each of these links (based on the regular expression /on\.fe/) each
> of
> these links, in their content have a link to another page, (I would like to
> capture this particular page based on a regular expression /www\.arax/), and
> substitute for each link (with regular expression /on\.fe/)in file1.html
> with
> their corresponding link (with regular expression/www\.arax/) So far this is
> what I have come up with, and am a little stuck

Use unix and wget. This is one of those reasons I love *nix. You don't
have to reinvent the wheel every time.

M4
-- 
Redundancy is a great way to introduce more single points of failure.



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

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 V11 Issue 4
************************************


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