File Coverage

blib/lib/Convert/UUlib.pm
Criterion Covered Total %
statement 6 27 22.2
branch 0 36 0.0
condition n/a
subroutine 2 6 33.3
pod 3 4 75.0
total 11 73 15.0


line stmt bran cond sub pod time code
1             package Convert::UUlib;
2              
3 1     1   1133 use common::sense;
  1         13  
  1         5  
4              
5 1     1   63 use Carp;
  1         2  
  1         745  
6              
7             require Exporter;
8             require DynaLoader;
9              
10             our $VERSION = 1.8;
11              
12             our @ISA = qw(Exporter DynaLoader);
13              
14             our @_consts = qw(
15             ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING
16              
17             FILE_DECODED FILE_ERROR FILE_MISPART FILE_NOBEGIN FILE_NODATA
18             FILE_NOEND FILE_OK FILE_READ FILE_TMPFILE
19              
20             MSG_ERROR MSG_FATAL MSG_MESSAGE MSG_NOTE MSG_PANIC MSG_WARNING
21              
22             OPT_RBUF OPT_WBUF
23             OPT_BRACKPOL OPT_DEBUG OPT_DESPERATE OPT_DUMBNESS OPT_ENCEXT
24             OPT_ERRNO OPT_FAST OPT_IGNMODE OPT_IGNREPLY OPT_OVERWRITE OPT_PREAMB
25             OPT_PROGRESS OPT_SAVEPATH OPT_TINYB64 OPT_USETEXT OPT_VERBOSE
26             OPT_VERSION OPT_REMOVE OPT_MOREMIME OPT_DOTDOT OPT_AUTOCHECK
27              
28             RET_CANCEL RET_CONT RET_EXISTS RET_ILLVAL RET_IOERR RET_NODATA
29             RET_NOEND RET_NOMEM RET_OK RET_UNSUP
30              
31             B64_ENCODED BH_ENCODED PT_ENCODED QP_ENCODED
32             XX_ENCODED UU_ENCODED YENC_ENCODED
33             );
34              
35             our @_funcs = qw(
36             Initialize CleanUp GetOption SetOption strerror SetMsgCallback
37             SetBusyCallback SetFileCallback SetFNameFilter SetFileNameCallback
38             FNameFilter LoadFile GetFileListItem GetFileList RenameFile DecodeToTemp
39             RemoveTemp DecodeFile InfoFile Smerge QuickDecode EncodeMulti
40             EncodePartial EncodeToStream EncodeToFile E_PrepSingle
41             E_PrepPartial
42              
43             straction strencoding strmsglevel
44             );
45              
46             our @EXPORT = @_consts;
47             our @EXPORT_OK = @_funcs;
48             our %EXPORT_TAGS = (all => [@_consts,@_funcs], constants => \@_consts);
49              
50             bootstrap Convert::UUlib $VERSION;
51              
52             # dummy function for compatiiblity with pre-1.7 versions
53       0 0   sub Initialize { }
54              
55             # action code -> string mapping
56             sub straction($) {
57 0 0   0 1   return 'copying' if $_[0] == &ACT_COPYING;
58 0 0         return 'decoding' if $_[0] == &ACT_DECODING;
59 0 0         return 'encoding' if $_[0] == &ACT_ENCODING;
60 0 0         return 'idle' if $_[0] == &ACT_IDLE;
61 0 0         return 'scanning' if $_[0] == &ACT_SCANNING;
62 0           'unknown';
63             }
64              
65             # encoding type -> string mapping
66             sub strencoding($) {
67 0 0   0 1   return 'uuencode' if $_[0] == &UU_ENCODED;
68 0 0         return 'base64' if $_[0] == &B64_ENCODED;
69 0 0         return 'yenc' if $_[0] == &YENC_ENCODED;
70 0 0         return 'binhex' if $_[0] == &BH_ENCODED;
71 0 0         return 'plaintext' if $_[0] == &PT_ENCODED;
72 0 0         return 'quoted-printable' if $_[0] == &QP_ENCODED;
73 0 0         return 'xxencode' if $_[0] == &XX_ENCODED;
74 0           'unknown';
75             }
76              
77             sub strmsglevel($) {
78 0 0   0 1   return 'message' if $_[0] == &MSG_MESSAGE;
79 0 0         return 'note' if $_[0] == &MSG_NOTE;
80 0 0         return 'warning' if $_[0] == &MSG_WARNING;
81 0 0         return 'error' if $_[0] == &MSG_ERROR;
82 0 0         return 'panic' if $_[0] == &MSG_PANIC;
83 0 0         return 'fatal' if $_[0] == &MSG_FATAL;
84 0           'unknown';
85             }
86              
87             1;
88             __END__