The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!perl -T
#
# $Id: 01-atomic.t,v 0.1 2008/06/27 19:11:42 dankogai Exp $
#
use strict;
use warnings;
use Attribute::Constant;
#use Test::More 'no_plan';
use Test::More tests => 10;

my $s : Constant(1);
is $s, 1, '$s => 1';
eval{ $s++ };
ok $@, $@;

my $c : Constant(sub { 1 });
isa_ok $c, 'CODE';
eval{ $c = sub { 0 } };
ok $@, $@;

my $g : Constant( \*STDIN);
isa_ok $g, 'GLOB';
eval{ $g = \*STDOUT };
ok $@, $@;

my $v : Constant( v1.2.3 );
is $v, v1.2.3, '$v => v1.2.3';
eval{ $v = v3.4.5 };
ok $@, $@;

my $r : Constant( qr/[perl]/ );
is $r, qr/[perl]/, '$r => qr/perl/';
eval{ $r = qr/[PERL]/ };
ok $@, $@;


__END__
SCALAR
#ARRAY
#HASH
CODE
#REF
GLOB
#LVALUE
#FORMAT
#IO
VSTRING
Regexp