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
Specio::Subs(3) User Contributed Perl Documentation Specio::Subs(3)

Specio::Subs - Make validation and coercion subs from Specio types

version 0.47

  use Specio::Subs qw( Specio::Library::Builtins Specio::Library::Perl My::Lib );

  if ( is_PackageName($var) ) { ... }

  assert_Str($var);

  my $person1 = to_Person($var);
  my $person2 = force_Person($var);

This module generates a set of helpful validation and coercion subroutines for all of the types defined in one or more libraries.

To use it, simply import "Specio::Subs" passing a list of one or more library names. This module will load those libraries as needed.

If any of the types in any libraries have names that do not work as part of a Perl subroutine name, this module will throw an exception.

If you have Sub::Util or Sub::Name installed, one of those will be used to name the generated subroutines.

The following subs are created in the importing package:

This subroutine returns a boolean indicating whether or not the $value is valid for the type.

This subroutine dies if the $value is not valid for the type.

This subroutine attempts to coerce $value into the given type. If it cannot be coerced it returns the original $value.

This is only created if the type has coercions.

This subroutine attempts to coerce $value into the given type, and dies if it cannot do so.

This is only created if the type has coercions.

This module has a subroutine named "subs_installed_into". It is not exported but it can be called by its fully qualified name. It accepts a single argument, a package name. It returns a list of subs that it generated and installed in the given package, if any.

This exists to make it easy to write a type library that combines other library and generates helper subs for export all at once.

Bugs may be submitted at <https://github.com/houseabsolute/Specio/issues>.

I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".

The source code repository for Specio can be found at <https://github.com/houseabsolute/Specio>.

Dave Rolsky <autarch@urth.org>

This software is Copyright (c) 2012 - 2021 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

The full text of the license can be found in the LICENSE file included with this distribution.

2021-01-29 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.