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.874
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_do
82
83       •  mce_forchunk
84
85       •  mce_foreach
86
87       •  mce_forseq
88
89       •  mce_freeze
90
91       •  mce_process
92
93       •  mce_relay_final
94
95       •  mce_restart_worker
96
97       •  mce_run
98
99       •  mce_print
100
101       •  mce_printf
102
103       •  mce_say
104
105       •  mce_send
106
107       •  mce_shutdown
108
109       •  mce_spawn
110
111       •  mce_status
112
113       •  mce_thaw
114

FUNCTIONS for MCE WORKERS via ( :worker )

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

GETTERS for MCE ATTRIBUTES via ( :getter )

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

INDEX

178       MCE, MCE::Core
179

AUTHOR

181       Mario E. Roy, <marioeroy AT gmail DOT com>
182
183
184
185perl v5.34.0                      2021-07-22                      MCE::Subs(3)
Impressum