I find C++ much more productive that Perl - I guess it's just a question of what you know <g>.

Well, I know (or perhaps, knew once) C++ also, and I find Perl infinitely more productive. But then again, I hated C++ from my first encounter. Time and experience only made things worse -- but I know I am in a minority in that view:)

BTW, if I:
my $spamtest = SpamAssassin::Mail::SpamAssassin->new(...) : shared;
will $spamtest be available in the clone if I perl_clone after this Perl code is executed?

I've never seen anyone use that syntax before, and a quick test seems to indicate that you cannot use :share in that way.

use threads; use threads::shared; use Benchmark::Timer; $T = Benchmark::Timer->new() : shared; Unquoted string "shared" may clash with future reserved word at (eval +3) line 1, <> line 2. syntax error at (eval 3) line 1, near ") :"

Any attempt to share a blessed reference usually results in an error.

use threads; use threads::shared; use Benchmark::Timer; { my $T : shared; $T = Benchmark::Timer->new(); } Invalid value for shared scalar at (eval 5) line 1, <> line 5.

So, I think the short answer is no.

I assume you were hoping to share a single instance of spamassasin between the multiple interpreters. This will not work.

Creating a unique instance in each interpreter would(may) probably work, but I have no idea how much memory that would consume.

That would require a piece of suck-and-see engineering I am afraid. Unless anyone else knows better.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!


In reply to Re: Re: Re: Re: Re: Externally managed threads using embedded Perl by BrowserUk
in thread Externally managed threads using embedded Perl by Anonymous Monk

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.