hi,

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:

############################## 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 ################################
the error stmt i'm getting is :

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!


In reply to load object from a module to a module whose method is then used in a script by baxy77bax

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.