GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MooseX::Types::Signal(3) User Contributed Perl Documentation MooseX::Types::Signal(3)

MooseX::Types::Signal - a type to represent valid UNIX or Perl signals

version 1.101932

Often times you want to send a configurable signal, but you don't want someone specifying SIGLOLCAT or 1234, because those aren't valid signals. Or are they?

With this module, you don't have to know; it will figure out what is valid and what isn't, 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.

   package Example;
   use MooseX::Types::Signal qw(Signal);
   use Moose;

   has 'kill_with' => (
       is     => 'rw',
       isa    => Signal,
       coerce => 1,
   );

   my $example = Example->new;

   # kill with SIGKILL
   $example->kill_with(9);
   $example->kill_with('KILL');
   $example->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 system's "signal.h" header file. "PerlSignal" only understands signals that are in Perl's %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::Exporter's magic when doing so. This is true in general of "MooseX::Types" modules.

Jonathan Rockway <jrockway@cpan.org>

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.

2011-12-28 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.