[23414] in Perl-Users-Digest
Perl-Users Digest, Issue: 5632 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 8 03:05:35 2003
Date: Wed, 8 Oct 2003 00: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)
Perl-Users Digest Wed, 8 Oct 2003 Volume: 10 Number: 5632
Today's topics:
Re: cgi,htaccess,mysql (Philip Lees)
mod_perl, OO and Globals <m2@nowhere.com>
Re: mod_perl, OO and Globals <m2@nowhere.com>
Newbie needs some help <kjohnson@wvr.net>
Re: Newbie needs some help <kaspREMOVE_CAPS@epatra.com>
Re: Perl module to clear pop mailbox? <dillon@SpamMinuSaccessdenied.darktech.org>
Problem With DBI - fetchrow_array <linux@fol.it>
Re: Problem With DBI - fetchrow_array <kaspREMOVE_CAPS@epatra.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 08 Oct 2003 05:55:10 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: cgi,htaccess,mysql
Message-Id: <3f83a5ef.60796156@news.grnet.gr>
On Tue, 07 Oct 2003 13:56:52 -0400, "Ryan Howe" <ryan@dctnet.net>
wrote:
>Basically what I have is a cgi script that I want protected by htaccess.
>Not a problem, but I want it to authenticate against a MySQL database.
Not exactly what you're asking, but if you install the
Apache::Htpasswd module you can keep Apache's password file
synchronised with the user names and passwords in your MySQL database.
In other words, do it the other way around.
Phil
--
Ignore coming events if you wish to send me e-mail
------------------------------
Date: Wed, 08 Oct 2003 05:19:23 GMT
From: "M2" <m2@nowhere.com>
Subject: mod_perl, OO and Globals
Message-Id: <v7Ngb.76$_z4.6584@news.optus.net.au>
Hi,
I'm looking for a way to store some common objects (e.g. a database handle)
in such a way that it may be accessed from anywhere within an OO based
mod_perl application.
My first attempt used the UNIVERSAL package to stash it but that felt
clunky, not to mention risky. For my second attempt I made all objects
inherit from a single object which returned them from a global. Of course
this has the potential for some dire issues under mod_perl even though
they're reset on each execution.
Outside of this I cannot seem to find a way to get the data accessible
without passing it around all over the place which I would dearly like to
avoid.
Am I missing something?
Matt.
------------------------------
Date: Wed, 08 Oct 2003 06:50:48 GMT
From: "M2" <m2@nowhere.com>
Subject: Re: mod_perl, OO and Globals
Message-Id: <ctOgb.82$_z4.6719@news.optus.net.au>
Post having written this I am pondering about the use of class variables. If
you have a class variable in an object that is inherited by all objects
would you have only a single instance of that variable? Would mod_perl cause
any issue?
"M2" <m2@nowhere.com> wrote in message
news:v7Ngb.76$_z4.6584@news.optus.net.au...
> Hi,
> I'm looking for a way to store some common objects (e.g. a database
handle)
> in such a way that it may be accessed from anywhere within an OO based
> mod_perl application.
>
> My first attempt used the UNIVERSAL package to stash it but that felt
> clunky, not to mention risky. For my second attempt I made all objects
> inherit from a single object which returned them from a global. Of course
> this has the potential for some dire issues under mod_perl even though
> they're reset on each execution.
>
> Outside of this I cannot seem to find a way to get the data accessible
> without passing it around all over the place which I would dearly like to
> avoid.
>
> Am I missing something?
>
> Matt.
>
>
------------------------------
Date: Wed, 08 Oct 2003 04:29:33 GMT
From: "Kenneth D. Johnson" <kjohnson@wvr.net>
Subject: Newbie needs some help
Message-Id: <NoMgb.6903$qK1.5489206@news2.news.adelphia.net>
Here is what I'm trying to do:
I have file1 that has:
100
200
300
etc.
I have file2 that has
XXX XX XXXXXX XXXX XXXX [100] AAA
XXX XX XXXXXX XXXX XXXX [200] BBB
XXX XX XXXXXX XXXX XXXX [225] CCC
XXX XX XXXXXX XXXX XXXX [250] DDD
XXX XX XXXXXX XXXX XXXX [300] EEE
etc.
I want to find the lines in file2 that contain the numbers in file1 so I can
write to a third file the A, B, C, D, E info that follows the numbers in
file2.
I will sure appreciate any help.
Thanks!
KDJ
--
------------------------------
Date: Wed, 8 Oct 2003 11:06:51 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Re: Newbie needs some help
Message-Id: <bm07vd$v0n$1@newsreader.mailgate.org>
Algorithm:
1. Scan File-1 having 100, 200 etc and read the first number. Say its
$number and its present value is100.
2. open the other File-2 and read one line at a time....
3. To check if it matches with the $number you need to use regular
expression
if( $line =~ m#\[$number\]\s+(\w+)#g ){
print $1; #this should have your AAA
}
Hope that helps.
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Wed, 08 Oct 2003 13:24:55 +0800
From: AcCeSsDeNiEd <dillon@SpamMinuSaccessdenied.darktech.org>
Subject: Re: Perl module to clear pop mailbox?
Message-Id: <6t77ovkmmm4hnosiircftpc8f0incdlqhk@4ax.com>
This works great Sisyphus!
Thanks.
Btw, regarding your concerns, it's actually ok because this 'third party' pop provider provides
forwarding features but not 'standard' as I have stated earlier. That means after forwarding the
email, they still retain a copy of it (which should be optional). So I will carry on using their
non-standard forwarding feature in conjunction with your script.
On Tue, 07 Oct 2003 13:53:27 +1000, Sisyphus <kalinaubears@iinet.net.au> wrote:
>AcCeSsDeNiEd wrote:
>> Hi folks,
>>
>> I'm attempting to automatically log into a pop account and clear/delete all the emails in it.
>> I know I can do this with some telnet routines, but if there is already a module out there, it would
>> safe me time.
>>
>> I need this because the pop provider does not use 'standard' forwarding features.
>> Once an email has been forwarded, there just leave it there and my users have to regularly go in to
>> clear up their mailboxes.
>>
>> Thanks
>>
>> To e-mail, remove the obvious
>
>I've been using such a module to parse the headers of the mail on my
>ISP's server and delete (from the server) the Swen virus emails (so I
>don't have to download them to clear the pile).
>
>To delete everything (untested):
>
>use strict;
>use warnings;
>use Mail::POP3Client;
>
>my $pop = new Mail::POP3Client
>( USER=> "username",
>PASSWORD=> "password",
>HOST=> "something_like_mail.host.com",
>#AUTH_MODE=> 'PASS', # perhaps not needed - see docs
>TIMEOUT => 60,
>DEBUG=> 0, # set to 1 to diagnose trouble
> ) or warn "cannot open: $!";
>
>my $c = $pop->Count();
>for (my $i = 1; $i <= $c; $i++) { $pop->Delete($i)}
>$pop->Close() or warn "Can't close: $!";
>__END__
>
>One (obvious) thing to keep in mind is that if some mail turns up after
>the user has performed a download, but before this script starts, then
>that user will never see that mail, and no-one will know about it.
>
>I think my preferred approach would be to apply standard forwarding
>procedure :-)
>
>Cheers,
>Rob
To e-mail, remove the obvious
------------------------------
Date: Wed, 8 Oct 2003 08:30:56 +0200
From: "Pisinho" <linux@fol.it>
Subject: Problem With DBI - fetchrow_array
Message-Id: <bm0atv$2qc$1@newsreader.mailgate.org>
I have thi script, but when I invoke this sub query i have the error:
DBD::mysql::st fetchrow_array failed:fetch() without execute() at
database.pl line 16, <FILE> line 42
sub init_db {
my $dsn =
"DBI:$database_driver:database=$database_name;host=$database_host;port=$data
base_port";
$db = DBI->connect($dsn,$database_user,$database_password) or return(0);
}
sub query {
my $query = shift;
$handle = $db->prepare($query) or return(0);
$handle->execute;
@row = $handle->fetchrow_array; # LINE 16
if ($handle->rows < 1) {
@row = ("");
}
$handle->finish;
return @row;
}
Where is the problem?
Thanks in advance
------------------------------
Date: Wed, 8 Oct 2003 12:30:41 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Re: Problem With DBI - fetchrow_array
Message-Id: <bm0cn3$5ca$1@newsreader.mailgate.org>
> sub query {
> my $query = shift;
> $handle = $db->prepare($query) or return(0);
> @row = $handle->fetchrow_array; # LINE 16
> if ($handle->rows < 1) {
> @row = ("");
> }
> $handle->finish;
> return @row;
> }
>
> Where is the problem?
In sub query.
You do:
$handle = $db->prepare($query) or return(0);
$handle->execute; ### __________What if this fails !!??!!__________
@row = $handle->fetchrow_array; # LINE 16
Instead do:
$handle->execute() or return 0;
HTH.
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
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.
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 5632
***************************************