package MooseX::Types::Util;
-=head1 NAME
-
-MooseX::Types::Util - Common utility functions for the module
-
-=cut
+#ABSTRACT: Common utility functions for the distribution
use warnings;
use strict;
+use Scalar::Util 'blessed';
use base 'Exporter';
=head1 DESCRIPTION
-This package the exportable functions that many parts in
+This package the exportable functions that many parts in
L<MooseX::Types> might need.
=cut
TypeConstraint | Undef = has_available_type_export($package, $name);
-This function allows you to introspect if a given type export is available
+This function allows you to introspect if a given type export is available
I<at this point in time>. This means that the C<$package> must have imported
-a typeconstraint with the name C<$name>, and it must be still in its symbol
+a type constraint with the name C<$name>, and it must be still in its symbol
table.
Two arguments are expected:
or return undef;
return undef
- unless $sub->isa('MooseX::Types::EXPORTED_TYPE_CONSTRAINT');
+ unless blessed $sub && $sub->isa('MooseX::Types::EXPORTED_TYPE_CONSTRAINT');
return $sub->();
}
L<MooseX::Types::Moose>, L<Exporter>
-=head1 AUTHOR AND COPYRIGHT
-
-Robert 'phaylon' Sedlacek C<E<lt>rs@474.atE<gt>>, with many thanks to
-the C<#moose> cabal on C<irc.perl.org>.
-
=head1 LICENSE
This program is free software; you can redistribute it and/or modify