| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Test::Run::Base::Struct; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 18 |  |  | 18 |  | 16134 | use strict; | 
|  | 18 |  |  |  |  | 35 |  | 
|  | 18 |  |  |  |  | 513 |  | 
| 4 | 18 |  |  | 18 |  | 98 | use warnings; | 
|  | 18 |  |  |  |  | 35 |  | 
|  | 18 |  |  |  |  | 617 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | =head1 NAME | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | Test::Run::Base::Struct - base class for Test::Run's "structs", that are | 
| 9 |  |  |  |  |  |  | simple classes that hold several values. | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | Inherits from L<Test::Run::Base>. | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =cut | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 18 |  |  | 18 |  | 98 | use MRO::Compat; | 
|  | 18 |  |  |  |  | 38 |  | 
|  | 18 |  |  |  |  | 377 |  | 
| 18 | 18 |  |  | 18 |  | 127 | use Moose; | 
|  | 18 |  |  |  |  | 31 |  | 
|  | 18 |  |  |  |  | 119 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | # We need to put it here before the use MooseX::StrictConstructor due | 
| 21 |  |  |  |  |  |  | # to a Moose mis-feature. Thanks to doy. | 
| 22 |  |  |  |  |  |  | BEGIN | 
| 23 |  |  |  |  |  |  | { | 
| 24 | 18 |  |  | 18 |  | 114076 | extends('Test::Run::Base'); | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 18 |  |  | 18 |  | 47741 | use MooseX::StrictConstructor; | 
|  | 18 |  |  |  |  | 582195 |  | 
|  | 18 |  |  |  |  | 91 |  | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub _pre_init | 
| 31 |  |  |  | 286 |  |  | { | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 18 |  |  | 18 |  | 168280 | use Carp; | 
|  | 18 |  |  |  |  | 46 |  | 
|  | 18 |  |  |  |  | 3881 |  | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | =head2 BUILD | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | For Moose. | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =cut | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | sub BUILD | 
| 43 |  |  |  |  |  |  | { | 
| 44 | 538 |  |  | 538 | 1 | 1063302 | my $self = shift; | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | =begin debugging_code | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | Carp::confess '$args not a hash' if (ref($args) ne "HASH"); | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =end debugging_code | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | =cut | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 538 |  |  |  |  | 3439 | $self->_pre_init(); | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 538 |  |  |  |  | 1698 | return; | 
| 57 |  |  |  |  |  |  | } | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | =head1 METHODS | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =head2 $struct->inc_field($field_name) | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | Increment the slot $field_name by 1. | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =cut | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | sub inc_field | 
| 68 |  |  |  |  |  |  | { | 
| 69 | 519 |  |  | 519 | 1 | 1352 | my ($self, $field) = @_; | 
| 70 | 519 |  |  |  |  | 1748 | return $self->add_to_field($field, 1); | 
| 71 |  |  |  |  |  |  | } | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head2 $struct->add_to_field($field_name, $difference) | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | Add $difference to the slot $field_name. | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | =cut | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | sub add_to_field | 
| 80 |  |  |  |  |  |  | { | 
| 81 | 521 |  |  | 521 | 1 | 1832 | my ($self, $field, $diff) = @_; | 
| 82 | 521 |  |  |  |  | 22185 | $self->$field($self->$field()+$diff); | 
| 83 |  |  |  |  |  |  | } | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | 1; | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | __END__ | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | L<Test::Run::Base>, L<Test::Run::Obj>, L<Test::Run::Core> | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | =head1 LICENSE | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | This file is freely distributable under the MIT X11 license. | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | L<http://www.opensource.org/licenses/mit-license.php> | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =head1 AUTHOR | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | Shlomi Fish, L<http://www.shlomifish.org/>. | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =cut | 
| 104 |  |  |  |  |  |  |  |