| 1 | { | ||
| 2 | package OOP::Perlish::Class::Accessor::UnitTests::Glob; | ||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use OOP::Perlish::Class::Accessor::UnitTests::Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use base qw(OOP::Perlish::Class::Accessor::UnitTests::Base); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use OOP::Perlish::Class::Accessor; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use Test::More; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 2 | ▶ | sub setup : Test(setup) |
|
Subroutine
setup: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 12 | { | ||
| 13 | 2 | my ($self) = @_; | |
| 14 | 2 | $self->{accessor} = OOP::Perlish::Class::Accessor->new( type => 'GLOBREF', name => 'test', self => bless({}, __PACKAGE__) ); | |
| 15 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | sub get_value | ||
| 18 | 2 | ▶ | { |
|
Subroutine
get_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 19 | 2 | my ($self) = @_; | |
| 20 | 2 | return $self->{accessor}->value(); | |
| 21 | } | ||
| 22 | |||
| 23 | 1 | ▶ | sub set_value_ref : Test |
|
Subroutine
set_value_ref: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 24 | { | ||
| 25 | 1 | my ($self) = @_; | |
| 26 | 1 | my $t = 'foo'; | |
| 27 | 1 | my $globref = \*t; | |
| 28 | |||
| 29 | 1 | $self->{accessor}->value( $globref ); | |
| 30 | 1 | is( $self->get_value(), $globref , 'can set globref' ); | |
| 31 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 32 | |||
| 33 | 1 | ▶ | sub negative_set_value : Test |
|
Subroutine
negative_set_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 34 | { | ||
| 35 | 1 | my ($self) = @_; | |
| 36 | |||
| 37 | 1 | my $glob = 'foo'; | |
| 38 | |||
| 39 | 1 | $self->{accessor}->value( $glob ); | |
| 40 | 1 | ok( ! $self->get_value(), 'negative assert: cannot set non-globref' ); | |
| 41 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | } | ||
| 43 | 1 | 1; | |
| 44 | =head1 NAME | ||
| 45 | |||
| 46 | =head1 VERSION | ||
| 47 | |||
| 48 | =head1 SYNOPSIS | ||
| 49 | |||
| 50 | =head1 METHODS | ||
| 51 | |||
| 52 | =head1 AUTHOR | ||
| 53 | |||
| 54 | Jamie Beverly, C<< <jbeverly at cpan.org> >> | ||
| 55 | |||
| 56 | =head1 BUGS | ||
| 57 | |||
| 58 | Please report any bugs or feature requests to C<bug-foo-bar at rt.cpan.org>, | ||
| 59 | or through | ||
| 60 | the web interface at | ||
| 61 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=OOP-Perlish-Class>. I will be | ||
| 62 | notified, and then you'll | ||
| 63 | automatically be notified of progress on your bug as I make changes. | ||
| 64 | |||
| 65 | =head1 SUPPORT | ||
| 66 | |||
| 67 | You can find documentation for this module with the perldoc command. | ||
| 68 | |||
| 69 | perldoc OOP::Perlish::Class | ||
| 70 | |||
| 71 | |||
| 72 | You can also look for information at: | ||
| 73 | |||
| 74 | =over 4 | ||
| 75 | |||
| 76 | =item * RT: CPAN's request tracker | ||
| 77 | |||
| 78 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=OOP-Perlish-Class> | ||
| 79 | |||
| 80 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 81 | |||
| 82 | L<http://annocpan.org/dist/OOP-Perlish-Class> | ||
| 83 | |||
| 84 | =item * CPAN Ratings | ||
| 85 | |||
| 86 | L<http://cpanratings.perl.org/d/OOP-Perlish-Class> | ||
| 87 | |||
| 88 | =item * Search CPAN | ||
| 89 | |||
| 90 | L<http://search.cpan.org/dist/OOP-Perlish-Class/> | ||
| 91 | |||
| 92 | =back | ||
| 93 | |||
| 94 | |||
| 95 | =head1 ACKNOWLEDGEMENTS | ||
| 96 | |||
| 97 | =head1 COPYRIGHT & LICENSE | ||
| 98 | |||
| 99 | Copyright 2009 Jamie Beverly | ||
| 100 | |||
| 101 | This program is free software; you can redistribute it and/or modify it | ||
| 102 | under the terms of either: the GNU General Public License as published | ||
| 103 | by the Free Software Foundation; or the Artistic License. | ||
| 104 | |||
| 105 | See http://dev.perl.org/licenses/ for more information. | ||
| 106 | |||
| 107 | =cut | ||