Hi,

On Wednesday 07 Apr 2010 14:59:08 Frenzel, Joerg (ext) wrote:
> Hello,
> 
> I need help by using threads in combination with external packages
> (modules).

I would really recommend against using threads:

* http://perldoc.perl.org/perlthrtut.html

* http://www.perlmonks.org/index.pl?node_id=288022

They don't work as expected in Perl (though in C/C++, .NET and/or Java, they 
may be an option[Thr]), and cause too many problems. If you are keen on doing 
multi-tasking you should use either fork() and multi-processing or something 
like http://poe.perl.org/ , but often multi-tasking is the wrong solution for 
the problem.

{{{
[Thr] - some people argue threads are always evil, and I can testify they are 
a large cause of software logistics headaches. I've written some programs of 
limited scope and ambitions using threads in C and they worked pretty well, 
but larger scope and more complex programs will be much harder to get right.
}}}

> 
> At main script threads were created and within these threads an
> database-handler was defined.
> 
> My Intention is to use this database-handler within a method of the
> external module.
> 
> The paramlist of my method contains a scalar variable $dhb
> (database-handler)
> 
> By using this variable with $dbh->Sql($statement);
> 

$dbh has no Sql method (in case it's a DBI data base handle) and furthermore.

> the perl compiler gives me the following error: "Thread error: Can't call
> method "Sql" on an undefined value".
> 

variables are not shared by default in perl's ithreads, as opposed to the 
intuitive way that people think about threads in C and other languages I've 
mentioned.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Stop Using MSIE - http://www.shlomifish.org/no-ie/

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to