File Coverage

blib/lib/Text/Markdown/Discount.pm
Criterion Covered Total %
statement 17 18 94.4
branch 5 6 83.3
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 27 31 87.1


line stmt bran cond sub pod time code
1             package Text::Markdown::Discount;
2              
3 5     5   351841 use 5.008000;
  5         66  
4 5     5   27 use strict;
  5         10  
  5         111  
5 5     5   24 use warnings;
  5         18  
  5         1642  
6              
7             require Exporter;
8              
9             our @ISA = qw(Exporter);
10              
11             # Items to export into callers namespace by default. Note: do not export
12             # names by default without a very good reason. Use EXPORT_OK instead.
13             # Do not simply export all your public functions/methods/constants.
14              
15             # This allows declaration use Text::Markdown::XS ':all';
16             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
17             # will save memory.
18             our %EXPORT_TAGS = ( 'all' => [ qw(
19             markdown
20             ) ] );
21              
22             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
23              
24             our @EXPORT = qw(
25            
26             );
27              
28             our $VERSION = '0.16';
29              
30             require XSLoader;
31             XSLoader::load('Text::Markdown::Discount', $VERSION);
32              
33             sub new {
34 14     14 0 819 return bless {}, 'Text::Markdown::Discount';
35             }
36              
37             sub markdown {
38 26     26 0 5748 my ($self, $text, $flags) = @_;
39              
40             # Detect functional mode, and create an instance for this run..
41 26 100       81 unless (ref $self) {
42 13 50       38 if ( $self ne __PACKAGE__ ) {
43 13         46 my $ob = __PACKAGE__->new();
44             # $self is text, $text is options
45 13         43 return $ob->markdown($self, $text, $flags);
46             }
47             else {
48 0         0 croak('Calling ' . $self . '->markdown (as a class method) is not supported.');
49             }
50             }
51 13 100       35 if (not defined $flags) {
52 12         41 $flags = MKD_NOHEADER()|MKD_NOPANTS();
53             }
54 13         373 return _markdown($text, $flags);
55             }
56              
57              
58             1;
59             __END__