Debian Codegraph @

README

raw
1 NAME
2 Convert::BaseN - encoding and decoding of base{2,4,8,16,32,64} strings
3
4 VERSION
5 $Id: README,v 0.1 2008/06/16 17:34:27 dankogai Exp dankogai $
6
7 SYNOPSIS
8 use Convert::BaseN;
9 # by name
10 my $cb = Convert::BaseN->new('base64');
11 my $cb = Convert::BaseN->new( name => 'base64' );
12 # or base
13 my $cb = Convert::BaseN->new( base => 64 );
14 my $cb_url = Convert::BaseN->new(
15 base => 64,
16 chars => '0-9A-Za-z\-_='
17 );
18 # encode and decode
19 $encoded = $cb->encode($data);
20 $decoded = $cb->decode($encoded);
21
22 EXPORT
23 Nothing. Instead of that, this module builds *transcoder object* for you
24 and you use its "decode" and "encode" methods to get the job done.
25
26 FUNCTIONS
27 new
28 Create the transcoder object.
29
30 # by name
31 my $cb = Convert::BaseN->new('base64');
32 my $cb = Convert::BaseN->new( name => 'base64' );
33 # or base
34 my $cb = Convert::BaseN->new( base => 64 );
35 my $cb_url = Convert::BaseN->new(
36 base => 64,
37 chars => '0-9A-Za-z\-_='
38 );
39
40 You can pick the decoder by name or create your own by specifying base
41 and character map.
42
43 base
44 Must be 2, 4, 16, 32 or 64.
45
46 chars
47 Specifiles the character map. The format is the same as "tr".
48
49 # DNA is coded that way.
50 my $dna = Convert::BaseN->new( base => 4, chars => 'ACGT' );
51
52 padding
53 nopadding
54 Specifies if padding (adding '=' or other chars) is required when
55 encoding. default is yes.
56
57 # url-safe Base64
58 my $b64url = Convert::BaseN->new(
59 base => 64, chars => '0-9A-Za-z\-_=', padding => 0;
60 );
61
62 name
63 When specified, the following pre-defined encodings will be used.
64
65 base2
66 base 2 encoding. "perl" is 01110000011001010111001001101100.
67
68 base4
69 DNA
70 RNA
71 base 4 encodings. "perl" is:
72
73 base4: 1300121113021230
74 DNA: CTAACGCCCTAGCGTA
75 RNA: GAUUGCGGGAUCGCAU
76
77 base 16 encoding. "perl" is "7065726c".
78
79 base32
80 base32hex
81 base 32 encoding mentioned in RFC4648. "perl" is:
82
83 base32: OBSXE3A==
84 base32hex: E1IN4R0==
85
86 base64
87 base64_url
88 base64_imap
89 base64_ircu
90 base 64 encoding, as in MIME::Base64. They differ only in characters
91 to represent number 62 and 63 as follows.
92
93 base64: +/
94 base64_url: -_
95 base64_imap: +,
96 base64_ircu: []
97
98 for all predefined base 64 variants, "decode" accept ANY form of
99 those.
100
101 decode
102 Does decode
103
104 my $decoded = $cb->decode($data)
105
106 encode
107 Does encode.
108
109 # line folds every 76 octets, like MIME::Base64::encode
110 my $encoded = $cb->encode($data);
111 # no line folding (compatibile w/ MIME::Base64)
112 my $encoded = $cb->encode($data, "");
113 # line folding by CRLF, every 40 octets
114 my $encoded = $cb->encode($data, "\r\n", 40);
115
116 SEE ALSO
117 RFC4648 <http://tools.ietf.org/html/rfc4648>
118
119 Wikipedia <http://en.wikipedia.org/wiki/Base64>
120
121 <http://www.centricorp.com/papers/base64.htm>
122
123 MIME::Base64
124
125 MIME::Base32
126
127 MIME::Base64::URLSafe
128
129 AUTHOR
130 Dan Kogai, "<dankogai at dan.co.jp>"
131
132 BUGS
133 Please report any bugs or feature requests to "bug-convert-basen at
134 rt.cpan.org", or through the web interface at
135 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Convert-BaseN>. I will
136 be notified, and then you'll automatically be notified of progress on
137 your bug as I make changes.
138
139 SUPPORT
140 You can find documentation for this module with the perldoc command.
141
142 perldoc Convert::BaseN
143
144 You can also look for information at:
145
146 * RT: CPAN's request tracker
147
148 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Convert-BaseN>
149
150 * AnnoCPAN: Annotated CPAN documentation
151
152 <http://annocpan.org/dist/Convert-BaseN>
153
154 * CPAN Ratings
155
156 <http://cpanratings.perl.org/d/Convert-BaseN>
157
158 * Search CPAN
159
160 <http://search.cpan.org/dist/Convert-BaseN>
161
162 ACKNOWLEDGEMENTS
163 N/A
164
165 COPYRIGHT & LICENSE
166 Copyright 2008 Dan Kogai, all rights reserved.
167
168 This program is free software; you can redistribute it and/or modify it
169 under the same terms as Perl itself.
170