Sat. Jan 18th, 2025

Introduction

In the last article I discussed the fundamentals of moving your own application framework since the structure, setup and layout of these a method as well as covered templating. In the following paragraphs we’ll add juicy features for example database handling, getting together with remote internet sites via Soapy email functionality. Database handling The key to handling databases inside a web atmosphere would be to ensure strict clean code, e.g. making certain database and statement handles and knowledge structures are opened up and closed correctly. It’s very common for database and statement handles to left open by developers while using the time tested copy manner of building their application. How frequently have you ever written a script and didn’t remember to close() on the method? Obviously persistence is essential when confronted with databases for that web, thankfully mod_perl enables with this quite nicely by extending the conventional DBI class with Apache::DBI. You might have noted partly 1 that the global var was declared to carry the database handle, this solves the persistence issue. Wish to consider describe a method that are responsible for just one database and/or any otherOrseveral databases. Within our Base.pm class the constructor opens an association towards the database, here you go:

sub new unless of course ( defined($dbh) && $dbh ) to connect with MASTER DB!’ )

$self->[DB_ERROR] = ‘Unable to connect with DB!’

return $self

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *