[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] dbh->quote error I can't see


On Mon, 29 Nov 2004 14:08:27 -0500, Cees Hek wrote:

Hi Cees, et al

> Create a class for your table:
>
> package MyDB::Authorize;
> use base qw(Class::DBI::mysql);
> __PACKAGE__->set_up_table('authorize');
> 1;
>
> And now for the code to update the database:
>
> unless ( $error ) {
> my $authorize = MyDB::Authorize->create({
> authcode => $authcode,
> username => $reqname,
> created_ip => $created_ip,
> }) or die "Could not create authorization record"; }
>
> Your values are automatically quoted for you, and you don't even
> have to write another INSERT or UPDATE statement...  Also, you
> don't need to pass $dbh around anymore, since Class::DBI worries
> about that for you...

Has this been put in a wiki of recipes anywhere?

> I seem to do a lot of redirecting, so I created a very simple
> redirect function that saves me from remembering how to do it in
> CGI::Application.
>
> sub redirect {
> my $self = shift;
> my $location = shift;
>
> $self->header_add(-location => $location);
> $self->header_type('redirect');
> return '';
> }
>
> Now in my runmodes I can just do:
>
> return $self->redirect('../cgi-bin/asep.cgi?rm=error');

And this?

-- 
Cheers
Ron Savage, suppressed on 1/12/2004
http://savage.net.au/index.html


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.