Hello, Monks! I'm humbly seeking some guidance in order to find some peace...
I'm developing my own nuts-n-bolts CMS-like software for a few intranet applications. The issue I'm encountering is that when I try to use a module I've written via one of my Mason pages I'm getting a "Can't locate object method 'foo' via package 'bar'..."
This works just fine, mind you in external scripts. I can guess it's something with the way I'm blessing the reference? I don't know. My 'new' sub works and it returns a reference.
However...If I call another routine in the module I get the error mentioned above. Where oh where am I going wrong? Here's the Mason code (I'm declaring the database handle as a global in the autohandler):
There is litterally nothing else in this file but a paragraph tag at the bottom with the word "testing" in it.... <%once> use lib '/var/www/nlt/libs'; use CMS::Users; my $u = CMS::Users->new(); $u->SetDBH($mysql_db_handle); print $u->GetUserList(); </%once> ...
Here's some code I threw together to troubleshoot the problem:
Strangely enough the SetDBH routine works without incident. While GetUserList produces the error. What gives? I'm losing my mind and can't seem to figure out why it's not working. Thank you all in advance for reading through this (if you are still reading). --dompackage CMS::Users; use Digest::MD5 qw(md5); use CGI; sub new { my $class = shift; my $self = { }; bless $self, $class; return $self; } sub SetDBH { my ($self, $dbh) = @_; if ($dbh) { $self->{DBH} = $dbh; return 1; } else { return undef; } } sub GetUserList { my ($self,%args) = @_; return "Sub call worked. I'm from: $self"; } 1;
In reply to My module's methods aren't working under Mason pages? by domje
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |