1MCE::Subs(3)          User Contributed Perl Documentation         MCE::Subs(3)
2
3
4

NAME

6       MCE::Subs - Exports functions mapped directly to MCE methods
7

VERSION

9       This document describes MCE::Subs version 1.837
10

SYNOPSIS

12        use MCE::Subs;  ## Exports manager and worker functions only
13                        ## Getter functions are not exported by default
14
15        use MCE::Subs qw( :getter  );  ## All, including getter functions
16        use MCE::Subs qw( :manager );  ## Exports manager functions only
17        use MCE::Subs qw( :worker  );  ## Exports worker functions only
18
19        use MCE::Subs qw( :getter :worker );  ## Excludes manager functions
20

DESCRIPTION

22       This module exports functions mapped to MCE methods. All exported
23       functions are prototyped, therefore allowing one to call them without
24       using parentheses.
25
26        use MCE::Subs qw( :worker );
27
28        sub user_func {
29           my $wid = MCE->wid;
30
31           mce_say "A: $wid";
32           mce_sync;
33
34           mce_say "B: $wid";
35           mce_sync;
36
37           mce_say "C: $wid";
38           mce_sync;
39
40           return;
41        }
42
43        MCE->new(
44           max_workers => 24, user_func => \&user_func
45        );
46
47        mce_run 0 for (1..100);   ## 0 means do not shutdown after running
48
49       For the next example, we only want the worker functions to be exported
50       due to using MCE::Map, which takes care of creating a MCE instance and
51       running.
52
53        use MCE::Map;
54        use MCE::Subs qw( :worker );
55
56        ## The following serializes output to STDOUT and gathers $_ to @a.
57        ## mce_say displays $_ when called without arguments.
58
59        my @a = mce_map { mce_say; $_ } 1 .. 100;
60
61        print scalar @a, "\n";
62
63       Unlike the native Perl functions, printf, print, and say methods
64       require the comma after the glob reference or file handle.
65
66        MCE->printf(\*STDERR, "%s\n", $error_msg);
67        MCE->print(\*STDERR, $error_msg, "\n");
68        MCE->say(\*STDERR, $error_msg);
69        MCE->say($fh, $error_msg);
70
71        mce_printf \*STDERR, "%s\n", $error_msg;
72        mce_print \*STDERR, $error_msg, "\n";
73        mce_say \*STDERR, $error_msg;
74        mce_say $fh, $error_msg;
75

FUNCTIONS for the MANAGER PROCESS via ( :manager )

77       MCE methods are described in MCE::Core.
78
79       ·  mce_abort
80
81       ·  mce_forchunk
82
83       ·  mce_foreach
84
85       ·  mce_forseq
86
87       ·  mce_freeze
88
89       ·  mce_process
90
91       ·  mce_relay_final
92
93       ·  mce_restart_worker
94
95       ·  mce_run
96
97       ·  mce_print
98
99       ·  mce_printf
100
101       ·  mce_say
102
103       ·  mce_send
104
105       ·  mce_shutdown
106
107       ·  mce_spawn
108
109       ·  mce_status
110
111       ·  mce_thaw
112

FUNCTIONS for MCE WORKERS via ( :worker )

114       MCE methods are described in MCE::Core.
115
116       ·  mce_abort
117
118       ·  mce_do
119
120       ·  mce_exit
121
122       ·  mce_freeze
123
124       ·  mce_gather
125
126       ·  mce_last
127
128       ·  mce_next
129
130       ·  mce_print
131
132       ·  mce_printf
133
134       ·  mce_relay
135
136       ·  mce_relay_recv
137
138       ·  mce_say
139
140       ·  mce_sendto
141
142       ·  mce_sync
143
144       ·  mce_thaw
145
146       ·  mce_yield
147

GETTERS for MCE ATTRIBUTES via ( :getter )

149       MCE methods are described in MCE::Core.
150
151       ·  mce_chunk_id
152
153       ·  mce_chunk_size
154
155       ·  mce_max_retries
156
157       ·  mce_max_workers
158
159       ·  mce_pid
160
161       ·  mce_sess_dir
162
163       ·  mce_task_id
164
165       ·  mce_task_name
166
167       ·  mce_task_wid
168
169       ·  mce_tmp_dir
170
171       ·  mce_user_args
172
173       ·  mce_wid
174

INDEX

176       MCE, MCE::Core
177

AUTHOR

179       Mario E. Roy, <marioeroy AT gmail DOT com>
180
181
182
183perl v5.28.0                      2018-08-25                      MCE::Subs(3)
Impressum