| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | our @ISA = qw(Log::Log4perl::Appender); | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | ################################################## | 
| 4 |  |  |  |  |  |  | # Log dispatcher writing to a string buffer | 
| 5 |  |  |  |  |  |  | ################################################## | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | ################################################## | 
| 8 |  |  |  |  |  |  | ################################################## | 
| 9 |  |  |  |  |  |  | my $proto  = shift; | 
| 10 |  |  |  |  |  |  | my $class  = ref $proto || $proto; | 
| 11 | 70 |  |  | 70 | 1 | 170 | my %params = @_; | 
| 12 | 70 |  | 33 |  |  | 383 |  | 
| 13 | 70 |  |  |  |  | 248 | my $self = { | 
| 14 |  |  |  |  |  |  | name      => "unknown name", | 
| 15 | 70 |  |  |  |  | 309 | string    => "", | 
| 16 |  |  |  |  |  |  | %params, | 
| 17 |  |  |  |  |  |  | }; | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | bless $self, $class; | 
| 20 |  |  |  |  |  |  | } | 
| 21 | 70 |  |  |  |  | 319 |  | 
| 22 |  |  |  |  |  |  | ################################################## | 
| 23 |  |  |  |  |  |  | ################################################## | 
| 24 |  |  |  |  |  |  | my $self = shift; | 
| 25 |  |  |  |  |  |  | my %params = @_; | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 50 |  |  | 50 | 0 | 77 | $self->{string} .= $params{message}; | 
| 28 | 50 |  |  |  |  | 160 | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 50 |  |  |  |  | 151 | ################################################## | 
| 31 |  |  |  |  |  |  | ################################################## | 
| 32 |  |  |  |  |  |  | my($self, $new) = @_; | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | if(defined $new) { | 
| 35 |  |  |  |  |  |  | $self->{string} = $new; | 
| 36 | 100 |  |  | 100 | 0 | 161 | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 | 100 | 100 |  |  |  | 187 | return $self->{string}; | 
| 39 | 50 |  |  |  |  | 85 | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | 1; | 
| 42 | 100 |  |  |  |  | 241 |  | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =encoding utf8 | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | =head1 NAME | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | Log::Log4perl::Appender::String - Append to a string | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | use Log::Log4perl::Appender::String; | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | my $appender = Log::Log4perl::Appender::String->new( | 
| 55 |  |  |  |  |  |  | name      => 'my string appender', | 
| 56 |  |  |  |  |  |  | ); | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | # Append to the string | 
| 59 |  |  |  |  |  |  | $appender->log( | 
| 60 |  |  |  |  |  |  | message => "I'm searching the city for sci-fi wasabi\n" | 
| 61 |  |  |  |  |  |  | ); | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | # Retrieve the result | 
| 64 |  |  |  |  |  |  | my $result = $appender->string(); | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | # Reset the buffer to the empty string | 
| 67 |  |  |  |  |  |  | $appender->string(""); | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | This is a simple appender used internally by C<Log::Log4perl>. It | 
| 72 |  |  |  |  |  |  | appends messages to a scalar instance variable. | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | =head1 LICENSE | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | Copyright 2002-2013 by Mike Schilli E<lt>m@perlmeister.comE<gt> | 
| 77 |  |  |  |  |  |  | and Kevin Goess E<lt>cpan@goess.orgE<gt>. | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify | 
| 80 |  |  |  |  |  |  | it under the same terms as Perl itself. | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =head1 AUTHOR | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | Please contribute patches to the project on Github: | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | http://github.com/mschilli/log4perl | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | Send bug reports or requests for enhancements to the authors via our | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | MAILING LIST (questions, bug reports, suggestions/patches): | 
| 91 |  |  |  |  |  |  | log4perl-devel@lists.sourceforge.net | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | Authors (please contact them via the list above, not directly): | 
| 94 |  |  |  |  |  |  | Mike Schilli <m@perlmeister.com>, | 
| 95 |  |  |  |  |  |  | Kevin Goess <cpan@goess.org> | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | Contributors (in alphabetical order): | 
| 98 |  |  |  |  |  |  | Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton | 
| 99 |  |  |  |  |  |  | Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony | 
| 100 |  |  |  |  |  |  | Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy | 
| 101 |  |  |  |  |  |  | Grundman, Paul Harrington, Alexander Hartmaier  David Hull, | 
| 102 |  |  |  |  |  |  | Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, | 
| 103 |  |  |  |  |  |  | Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, | 
| 104 |  |  |  |  |  |  | Lars Thegler, David Viner, Mac Yang. | 
| 105 |  |  |  |  |  |  |  |