I have created it with one Exported method (for example blog) which stores the object in the calling objects private hash ie:
--- snip ---
package Plugins::Blog;
use vars qw($VERSION @EXPORT @ISA);
use strict;
require Exporter;
$VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(blog);
sub blog {
my $app = shift;
if(!$app->{__PACKAGE__ . '__oBlog'}) {
# create the object for this module and store it in the app
my $blog = {};
bless $blog;
$app->{__PACKAGE__ . '__oBlog'} = $blog;
}
return $app->{__PACKAGE__ . '__oBlog'};
}
--- snip ---
Now - the question I have is (assuming cgiapp is the calling object) how
do I in a different method retrieve the database handle? ie
--- snip ---
sub getBlog {
# this is the object itself, not the cgiapp
$self = shift;
$dbh = $self->dbh; # ??? confused!
}
--- snip ---
Help would be much appreciated. I've tried this various ways (putting a
reference to the app's dbh method in the object), but can't figure it
out. I'm going wrong somewhere and have looked at other code, but can't
quite figure it out.
Thanks in advance.
Paul
---------------------------------------------------------------------
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.