The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

 Scalar::LockRefType - simple scalar type checker

SYNOPSIS

 use Scalar::LockRefType;

 tie my $h1 => 'Scalar::LockRefType', {};
 tie my $h2 => 'Scalar::LockRefType', 'HASH';
 tie my $h3 => 'Scalar::LockRefType';

 $h1 = [];  # dies, violates the type
 $h2 = [];  # dies, violates the type

 $h3 = {};  # sets the type
 $h3 = [];  # dies

DESCRIPTION

This little module allows you to tie the type of a scalar to a specified reference type. If the refererence type of an assignment violates the tied type, the assignment throws an exception.

AUTHOR

Heiko Schlittermann <hs@schlittermann.de>