Decode a base64 string by calling the <A HREF="#item_decode_base64"><CODE>decode_base64()</CODE></A> function. This
function takes a single argument which is the string to decode and
returns the decoded data.
<P>Any character not part of the 65-character base64 subset set is
silently ignored. Characters occuring after a '=' padding character
are never decoded.</P>
<P>If the length of the string to decode (after ignoring
non-base64 chars) is not a multiple of 4 or padding occurs too ealy,
then a warning is generated if perl is running under <CODE>-w</CODE>.</P>
<P></P></DL>
<P>If you prefer not to import these routines into your namespace you can
call them as:</P>
<PRE>
use MIME::Base64 ();
$encoded = MIME::Base64::encode($decoded);
$decoded = MIME::Base64::decode($encoded);</PRE>
<P>
<HR>
<H1><A NAME="diagnostics">DIAGNOSTICS</A></H1>
<P>The following warnings might be generated if perl is invoked with the
<CODE>-w</CODE> switch:</P>
<DL>
<DT><STRONG><A NAME="item_Premature_end_of_base64_data">Premature end of base64 data</A></STRONG><BR>
<DD>
The number of characters to decode is not a multiple of 4. Legal
base64 data should be padded with one or two ``='' characters to make
its length a multiple of 4. The decoded result will anyway be as if
the padding was there.
<P></P>
<DT><STRONG><A NAME="item_Premature_padding_of_base64_data">Premature padding of base64 data</A></STRONG><BR>
<DD>
The '=' padding character occurs as the first or second character
in a base64 quartet.
<P></P></DL>
<P>
<HR>
<H1><A NAME="examples">EXAMPLES</A></H1>
<P>If you want to encode a large file, you should encode it in chunks
that are a multiple of 57 bytes. This ensures that the base64 lines
line up and that you do not end up with padding in the middle. 57
bytes of data fills one complete base64 line (76 == 57*4/3):</P>
<PRE>
use MIME::Base64 qw(encode_base64);</PRE>
<PRE>
open(FILE, "/var/log/wtmp") or die "$!";
while (read(FILE, $buf, 60*57)) {
print encode_base64($buf);
}</PRE>
<P>or if you know you have enough memory</P>
<PRE>
use MIME::Base64 qw(encode_base64);
local($/) = undef; # slurp
print encode_base64(<STDIN>);</PRE>
<P>
<HR>
<H1><A NAME="copyright">COPYRIGHT</A></H1>
<P>Copyright 1995-1999 Gisle Aas.</P>
<P>This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.</P>
<P>Distantly based on LWP::Base64 written by Martijn Koster
<<A HREF="mailto:m.koster@nexor.co.uk">m.koster@nexor.co.uk</A>> and Joerg Reichelt <<A HREF="mailto:j.reichelt@nexor.co.uk">j.reichelt@nexor.co.uk</A>> and
code posted to comp.lang.perl <<A HREF="mailto:3pd2lp$6gf@wsinti07.win.tue.nl">3pd2lp$6gf@wsinti07.win.tue.nl</A>> by Hans