Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-06-01 Thread Paul Lalli
On May 31, 7:18 pm, [EMAIL PROTECTED] (Jonathan Lang) wrote: abc.pm -- my $databasehandle; Note that this establishes a single $databasehandle for every object of type 'abc' that you create; it does not create a separate one for each object. sub

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-06-01 Thread [EMAIL PROTECTED]
On May 31, 2:17 pm, [EMAIL PROTECTED] (Alma) wrote: Hi , Urgent help. [ snip - substantially the same thing as he posted a few days back ] Please, if there is something you find unclear about the answers you are given in a newsgroup or mailing list then follow-up with further questions about

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-06-01 Thread Mumia W.
On 06/01/2007 12:36 PM, [EMAIL PROTECTED] wrote: On May 31, 2:17 pm, [EMAIL PROTECTED] (Alma) wrote: Hi , Urgent help. [ snip - substantially the same thing as he posted a few days back ] Please, if there is something you find unclear about the answers you are given in a newsgroup or

Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Alma
Hi , Urgent help. I have written 2 modules one abc.pm xyz.pm (admin modules). abc.pm -- my $databasehandle; sub new($){ my ($self,$usr,$pwd) = @_; $usr||= test; $pwd ||= test123; ($self) = {}; bless($self); $databasehandle =

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Jonathan Lang
Alma wrote: Hi , Urgent help. I have written 2 modules one abc.pm xyz.pm (admin modules). abc.pm -- my $databasehandle; Note that this establishes a single $databasehandle for every object of type 'abc' that you create; it does not create a separate one

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Chas Owens
On 5/31/07, Jonathan Lang [EMAIL PROTECTED] wrote: snip Again, you have a signature problem. 'sub new($)' says that 'new' will take a single scalar as a parameter; as such, @_ will only ever have one value in it: $usr and $pwd will always be set to null. snip Well, there is a prototype

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Chas Owens
On 31 May 2007 06:17:50 -0700, Alma [EMAIL PROTECTED] wrote: snip I am getting an error : Can't locate object method prepare via package abc at xyz.pm snip Besides the things that are wrong that other people have mentioned, you need to make the abc class a subclass of DBI. This being Perl

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Mumia W.
On 05/31/2007 08:17 AM, Alma wrote: [...] $database_handle = abc-new('test','test123'); [...] No, the 'new' method of 'abc' returns an object of type 'abc'--not a database handle. Review the return statement in abc::new again. sub display() { my $self = shift; my $sth =

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Jonathan Lang
Chas Owens wrote: Well, there is a prototype problem, but it isn't that $ will force new to only accept one value, but rather that prototypes and OO Perl don't mix. Perl simply ignores prototypes on methods. Also prototypes are broken*, don't use them. -snip- *

Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Chas Owens
On 5/31/07, Jonathan Lang [EMAIL PROTECTED] wrote: snip Also prototypes are broken*, don't use them. -snip- * http://library.n0i.net/programming/perl/articles/fm_prototypes/ Broken and don't use them is a bit extreme. But I will agree with the general sentiment that they should not be used as