y::Package";
\%h ~~ Tied; # true
\%h ~~ Tied[ $My_Package ]; # true
\%h ~~ Tied["My::Package"]; # true
tie my $s, "Other::Package";
\$s ~~ Tied;
# true
$s ~~ Tied; # false !!
If you need to check that something is specifically a reference to
a tied hash, use an intersection:
use Types::Standard qw( Tied HashRef
hRef);
tie my %h, "My::Package";
tie my $s, "Other::Package";
\%h ~~ $TiedHash; # true
\$s ~~ $TiedHash; # false
=item *
B<< StrMatch[`a] >>
A string that matches a regu
ngWithMoo3>.
=head2 Type::Tiny and Smart Match
Perl 5.10 introduced the smart match operator C<< ~~ >>, which has since
been deprecated because though the general idea is fairly sound, the details
w
qw( Str Int );
given ( $value ) {
when ( Int ) { ... }
when ( Str ) { ... }
}
This will do what you wanted:
use Types::Standard qw( is_Str is_Int );
given ( $value ) {
when