baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
as the question says i would like to load and execute a method on an object that is loaded from one module to my object method in my *.pm module that i call from my script. example:
the error stmt i'm getting is :############################## script ############################## use strict; use MyTest; my $stm = "create table TEST (N01 varchar(100)not null, N02 integer no +t null)"; my $objref = MyTest->old(); $objref->just_do_it(argument => $stm); ################################# module ################################# package MyTest; use strict; use DBI; ########## my $dh = DBI->connect(...); sub old { my ($class)=@_; my $hash ={}; bless ($hash, $class); } sub just_do_it{ my ($self, %in) =@_; my $x = $self->{argument}=$in{argument}; my $y = $dbh->prepare($x); $y ->execute; } 1; ################################ and DBI module here ################################
DBD::SQLite::db prepare failed: unrecognized token: "0x225fc4"(1) at dbdimp.c li ne 271 at Lib/MyTest.pm line 38, <> line 2. DBD::SQLite::db prepare failed: unrecognized token: "0x225fc4"(1) at dbdimp.c li ne 271 at Lib/MyTest.pm line 38, <> line 2.
any ideas how to make this work?
thnx!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: load object from a module to a module whose method is then used in a script
by diotalevi (Canon) on Jul 24, 2008 at 04:40 UTC |