| 1 | package Carp::Parse::CallerInformation; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Data::Dump; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | Carp::Parse::CallerInformation - Represent the parsed caller information for a line of the Carp stack trace. | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 VERSION | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | Version 1.0.7 | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 10 | our $VERSION = '1.0.7'; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | See the synopsis of C<Carp::Parse> for a full example that generates | ||||||||||||||||||||||||||||
| 27 | Carp::Parse::CallerInformation objects. As a user, you should not have to | ||||||||||||||||||||||||||||
| 28 | create Carp::Parse::CallerInformation objects yourself. | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # Retrieve the arguments string. | ||||||||||||||||||||||||||||
| 31 | my $arguments_string = $caller_information->get_arguments_string(); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # Retrieve the arguments array. | ||||||||||||||||||||||||||||
| 34 | my $arguments_list = $caller_information->get_arguments_list(); | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | # Retrieve the original line, pre-parsing. | ||||||||||||||||||||||||||||
| 37 | my $line = $caller_information->get_line(); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =head1 METHODS | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head2 new() | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | Create a new C<Carp::Parse::CallerInformation> object. | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | my $caller_information = Carp::Parse::CallerInformation->new( | ||||||||||||||||||||||||||||
| 47 | { | ||||||||||||||||||||||||||||
| 48 | arguments_string => $arguments_string, | ||||||||||||||||||||||||||||
| 49 | arguments_list => $arguments_list, | ||||||||||||||||||||||||||||
| 50 | line => $line, | ||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =cut | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub new | ||||||||||||||||||||||||||||
| 57 | 20 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | 20 | my ( $class, $data ) = @_; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | # Verify parameters. | ||||||||||||||||||||||||||||
| 61 | 20 | ▶ | croak 'The first argument must be a hashref with the data to set on the object.' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $data and UNIVERSAL::isa($data, "HASH")
MC/DC50%1/2
defined $data and UNIVERSAL::isa($data, "HASH")
defined $data
UNIVERSAL::isa($data, "HASH")
Truth table66%2/3
A and B
A= defined $dataB= UNIVERSAL::isa($data, "HASH")
| |||||||||||||||||||||||||||||
| 62 | unless defined( $data ) && UNIVERSAL::isa( $data, 'HASH' ); ## no critic (BuiltinFunctions::ProhibitUniversalIsa) | ||||||||||||||||||||||||||||
| 63 | 19 | my $line = delete( $data->{'line'} ); | |||||||||||||||||||||||||||
| 64 | 19 | my $arguments_string = delete( $data->{'arguments_string'} ); | |||||||||||||||||||||||||||
| 65 | 19 | my $arguments_list = delete( $data->{'arguments_list'} ); | |||||||||||||||||||||||||||
| 66 | 19 | ▶ | croak "The data hashref must contain the 'line' key with the original stack line" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | unless defined( $line ); | ||||||||||||||||||||||||||||
| 68 | 18 | ▶ | croak "The following parameters are not supported: " . Data::Dump::dump( $data ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | if scalar( keys %$data ) != 0; | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 18 | return bless( | |||||||||||||||||||||||||||
| 72 | { | ||||||||||||||||||||||||||||
| 73 | line => $line, | ||||||||||||||||||||||||||||
| 74 | arguments_string => $arguments_string, | ||||||||||||||||||||||||||||
| 75 | arguments_list => $arguments_list, | ||||||||||||||||||||||||||||
| 76 | }, | ||||||||||||||||||||||||||||
| 77 | $class, | ||||||||||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =head2 get_arguments_string() | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | Return a string of the arguments parsed for this caller. | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | my $arguments_string = $caller_information->get_arguments_string(); | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =cut | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | sub get_arguments_string | ||||||||||||||||||||||||||||
| 91 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_arguments_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 92 | 1 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 1 | return $self->{'arguments_string'}; | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | =head2 get_arguments_list() | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | Return an arrayref of the arguments parsed for this caller. | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | my $arguments_list = $caller_information->get_arguments_list(); | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =cut | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | sub get_arguments_list | ||||||||||||||||||||||||||||
| 107 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_arguments_list: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 108 | 1 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 1 | return $self->{'arguments_list'}; | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | =head2 get_line() | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | Return the original line from the stack trace. | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | my $line = $caller_information->get_line(); | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | =cut | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | sub get_line | ||||||||||||||||||||||||||||
| 123 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_line: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 124 | 1 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 1 | return $self->{'line'}; | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | Kate Kirby, C<< <kate at cpan.org> >>. | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | Guillaume Aubert, C<< <aubertg at cpan.org> >>. | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | =head1 BUGS | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | Please report any bugs or feature requests to C<bug-carp-parse at rt.cpan.org>, or through | ||||||||||||||||||||||||||||
| 140 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Carp-Parse>. | ||||||||||||||||||||||||||||
| 141 | I will be notified, and then you'll automatically be notified of progress on | ||||||||||||||||||||||||||||
| 142 | your bug as I make changes. | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | perldoc Carp::Parse::CallerInformation | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | You can also look for information at: | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | =over 4 | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Carp-Parse> | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | L<http://annocpan.org/dist/Carp-Parse> | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | =item * CPAN Ratings | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | L<http://cpanratings.perl.org/d/Carp-Parse> | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | =item * Search CPAN | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | L<http://search.cpan.org/dist/Carp-Parse/> | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | =back | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | Thanks to ThinkGeek (L<http://www.thinkgeek.com/>) and its corporate overlords | ||||||||||||||||||||||||||||
| 178 | at Geeknet (L<http://www.geek.net/>), for footing the bill while we eat pizza | ||||||||||||||||||||||||||||
| 179 | and write code for them! | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | Copyright 2012 Kate Kirby & Guillaume Aubert. | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | =cut | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 10 | 1; | |||||||||||||||||||||||||||