File Coverage

blib/lib/RTF/Encode.pm
Criterion Covered Total %
statement 28 28 100.0
branch 6 8 75.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 41 43 95.3


line stmt bran cond sub pod time code
1             package RTF::Encode;
2             # vim:ts=4:shiftwidth=4:expandtab
3              
4             # ABSTRACT: Escapes strings into RTF
5              
6 1     1   76622 use strict;
  1         2  
  1         26  
7 1     1   4 use warnings;
  1         1  
  1         36  
8              
9             our $VERSION = '1.01';
10              
11             =head1 NAME
12              
13             RTF::Encode - Escapes strings into RTF
14              
15             =head1 SYNOPSIS
16              
17             use RTF::Encode qw/ encode_rtf /;
18             print encode_rtf("Smiling cat with heart shaped eyes, ".chr(0x1f63b);
19              
20             =cut
21              
22 1     1   484 use Encode qw/ encode /;
  1         10263  
  1         66  
23 1     1   872 use parent qw/ Exporter /;
  1         267  
  1         4  
24              
25             our (@EXPORT_OK);
26              
27             BEGIN {
28 1     1   260 @EXPORT_OK = qw(encode_rtf);
29             }
30              
31             =head2 encode_rtf
32              
33             my $rtf = encode_rtf($unicode);
34              
35             This function takes a string, which may contain Unicode characters, and
36             returns a string escaped to be used in an RTF file. It can be used to safely
37             insert arbitrary text into a template RTF file, perhaps via L