in reply to Re^3: Parallel Modules ?
in thread Parallel Modules ?
Thanks for the comments.
use threads;
Somehow, I am not able to pass parameters to sub routines using threads->create.
Below are the sample code and errors.
Better.pm
package Better; sub saveBetter { my ($sbn, $cost, $ur) = @_; print "sbn: $sbn\n"; print "cost: $cost\n"; print "url: $url\n"; return; } 1;
./test.pl#!/usr/bin/perl -w use strict; use warnings; use threads; use Better; my $sbn = "123489876"; my $lee = "12.89"; my $abc = "abcde"; my @ParamList = ($sbn, $lee, $abc); my $thr = threads->create(Better::saveBetter, @ParamList); $thr->join();
#!/usr/bin/perl -w use strict; use warnings; use threads; use Better; my $sbn = "123489876"; my $lee = "12.89"; my $abc = "abcde"; my $thr = threads->create(Better::saveBetter, $sbn, $lee, $abc); $thr->join();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Parallel Modules ?
by BrowserUk (Patriarch) on Nov 29, 2011 at 23:09 UTC | |
by Gary Yang (Acolyte) on Nov 29, 2011 at 23:55 UTC | |
by BrowserUk (Patriarch) on Nov 30, 2011 at 00:21 UTC | |
by Gary Yang (Acolyte) on Dec 01, 2011 at 00:50 UTC | |
by BrowserUk (Patriarch) on Dec 01, 2011 at 01:07 UTC |