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