| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Text::APL; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 112537 | use strict; | 
|  | 2 |  |  |  |  | 11 |  | 
|  | 2 |  |  |  |  | 43 |  | 
| 4 | 2 |  |  | 2 |  | 8 | use warnings; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 57 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | our $VERSION = 0.08; | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 2 |  |  | 2 |  | 637 | use Text::APL::Core; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 43 |  | 
| 9 | 2 |  |  | 2 |  | 766 | use Text::APL::WithCaching; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 323 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | sub new { | 
| 12 | 20 |  |  | 20 | 1 | 186 | my $class = shift; | 
| 13 | 20 |  |  |  |  | 33 | my (%options) = @_; | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 20 |  | 50 |  |  | 84 | $options{charset} ||= 'UTF-8'; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 20 |  | 33 |  |  | 72 | $options{reader} ||= $class->_build_reader(charset => $options{charset}); | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 20 | 100 |  |  |  | 40 | if (delete $options{cache}) { | 
| 20 | 1 |  |  |  |  | 8 | return Text::APL::WithCaching->new(%options); | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 19 |  |  |  |  | 56 | return Text::APL::Core->new(%options); | 
| 24 |  |  |  |  |  |  | } | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | sub _build_reader { | 
| 27 | 20 |  |  | 20 |  | 25 | my $self = shift; | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | exists $INC{"AnyEvent.pm"} | 
| 30 |  |  |  |  |  |  | ? do { | 
| 31 | 0 |  |  |  |  |  | require AnyEvent::AIO; | 
| 32 | 0 |  |  |  |  |  | require Text::APL::Reader::AIO; | 
| 33 | 0 |  |  |  |  |  | Text::APL::Reader::AIO->new(@_); | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  | : exists $INC{"IO/AIO.pm"} | 
| 36 | 20 | 50 |  |  |  | 80 | ? do { require Text::APL::Reader::AIO; Text::APL::Reader->AIO->new(@_) } | 
|  | 0 | 50 |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | : Text::APL::Reader->new(@_); | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | 1; | 
| 41 |  |  |  |  |  |  | __END__ |