[Sent a few hours ago, but apparently lost somewhere. I resent it
just in case.]
On Jun 30, 2005, at 4:21, Siegfried Heintze wrote:
I have the following line of code:
my $id = async { &PopulateIndustryCompanyJobs($sIndustryName,
$nThread);
$qCompleted->enqueue($sIndustryName); }
It causes this error:
Prototype mismatch: sub main::async (&;@) vs (&) at c:/Perl/lib/
Exporter.pm
line 65.
Here is the line of source code from my ActiveState Perl
distribution 5.8+:
*{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_;
I have two questions:
(1) What the heck does that line of code do? We are assigning a
reference of
a function in some package to a typeglob? What do all the {} do?
What is the
\:: for? Why the quotes?
That line aliases subroutines in different packages using fully
qualified names. To export a subroutine into another package
Exporter.pm puts it in its symbol table using the *... = \&... idiom.
See the section "Symbol Tables" of perlmod.
The "\::" is needed to put a literal "::" in the string because
otherwise Perl thinks you mean
$callpkg:: . $_
whereas what you want is
$callpkg . "::" . $_
(2) Am I doing something wrong? My program seems to work. What
should I
change?
The description in perldiag is
Prototype mismatch: %s vs %s
(S prototype) The subroutine being declared or defined had
previ-
ously been declared or defined with a different function
prototype.
I guess "async" is the one from Thread.pm, does that explanation ring
any bell?
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>