Manual Reference Pages - MOOSEX::TYPES::SIGNAL (3)
MooseX::Types::Signal - a type to represent valid UNIX or Perl signals
Often times you want to send a configurable signal, but you dont want
someone specifying SIGLOLCAT or 1234, because those arent valid
signals. Or are they?
With this module, you dont have to know; it will figure out what is
valid and what isnt, and what names map to what numbers.
Just use the Signal type, and signal numbers are validated. Use
the coercion, and you can refer to signals by name, too.
use MooseX::Types::Signal qw(Signal);
has kill_with => (
is => rw,
isa => Signal,
coerce => 1,
my $example = Example->new;
# kill with SIGKILL
# in any case, the reader C<kill_with> will always return 9, or
# whatever your system thinks the number for SIGKILL is
MooseX::Types::Signal exports a type, Signal, that recognizes
valid signals on your platform. The underlying type is a non-negative
number, but there is a coercion from strings to numbers that
recognizes signals by name.
There are also more restrictive types, PerlSignal and
UnixSignal. UnixSignal only understands signals that are in
your systems signal.h header file. PerlSignal only understands
signals that are in Perls %Config hash. Signal is either/or,
with preference to UnixSignal over PerlSignal when coercing.
The exports Signal, UnixSignal, and PerlSignal are exported
by Sub::Exporter, so you must explicitly request
them, and you can use any of Sub::Exporters magic when doing so.
This is true in general of MooseX::Types modules.
Jonathan Rockway <email@example.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Rockway.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
|perl v5.20.3 ||MOOSEX::TYPES::SIGNAL (3) ||2011-12-28 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.