summaryrefslogtreecommitdiff
path: root/cpan/MIME-Base64
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-02 13:45:44 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-02 13:45:44 +0100
commitb7c8007e17dac1921298ae21cba58fd10cfde840 (patch)
treeffdab895a91852a8e0b278ff9c95b68488dabb65 /cpan/MIME-Base64
parent6a9d70dc5bc1e24d7b72e48b62cd53b961f288cc (diff)
downloadperl-b7c8007e17dac1921298ae21cba58fd10cfde840.tar.gz
Move MIME::Base64 from ext/ to cpan/
Diffstat (limited to 'cpan/MIME-Base64')
-rw-r--r--cpan/MIME-Base64/Base64.pm175
-rw-r--r--cpan/MIME-Base64/Base64.xs457
-rw-r--r--cpan/MIME-Base64/Changes380
-rw-r--r--cpan/MIME-Base64/Makefile.PL13
-rw-r--r--cpan/MIME-Base64/QuotedPrint.pm114
-rw-r--r--cpan/MIME-Base64/README27
-rw-r--r--cpan/MIME-Base64/t/base64.t378
-rw-r--r--cpan/MIME-Base64/t/quoted-print.t352
-rw-r--r--cpan/MIME-Base64/t/unicode.t33
-rw-r--r--cpan/MIME-Base64/t/warn.t68
10 files changed, 1997 insertions, 0 deletions
diff --git a/cpan/MIME-Base64/Base64.pm b/cpan/MIME-Base64/Base64.pm
new file mode 100644
index 0000000000..6c076d1b7c
--- /dev/null
+++ b/cpan/MIME-Base64/Base64.pm
@@ -0,0 +1,175 @@
+package MIME::Base64;
+
+use strict;
+use vars qw(@ISA @EXPORT $VERSION);
+
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = qw(encode_base64 decode_base64);
+
+$VERSION = '3.08';
+
+require XSLoader;
+XSLoader::load('MIME::Base64', $VERSION);
+
+*encode = \&encode_base64;
+*decode = \&decode_base64;
+
+1;
+
+__END__
+
+=head1 NAME
+
+MIME::Base64 - Encoding and decoding of base64 strings
+
+=head1 SYNOPSIS
+
+ use MIME::Base64;
+
+ $encoded = encode_base64('Aladdin:open sesame');
+ $decoded = decode_base64($encoded);
+
+=head1 DESCRIPTION
+
+This module provides functions to encode and decode strings into and from the
+base64 encoding specified in RFC 2045 - I<MIME (Multipurpose Internet
+Mail Extensions)>. The base64 encoding is designed to represent
+arbitrary sequences of octets in a form that need not be humanly
+readable. A 65-character subset ([A-Za-z0-9+/=]) of US-ASCII is used,
+enabling 6 bits to be represented per printable character.
+
+The following functions are provided:
+
+=over 4
+
+=item encode_base64($str)
+
+=item encode_base64($str, $eol);
+
+Encode data by calling the encode_base64() function. The first
+argument is the string to encode. The second argument is the
+line-ending sequence to use. It is optional and defaults to "\n". The
+returned encoded string is broken into lines of no more than 76
+characters each and it will end with $eol unless it is empty. Pass an
+empty string as second argument if you do not want the encoded string
+to be broken into lines.
+
+=item decode_base64($str)
+
+Decode a base64 string by calling the decode_base64() function. This
+function takes a single argument which is the string to decode and
+returns the decoded data.
+
+Any character not part of the 65-character base64 subset is
+silently ignored. Characters occurring after a '=' padding character
+are never decoded.
+
+If the length of the string to decode, after ignoring
+non-base64 chars, is not a multiple of 4 or if padding occurs too early,
+then a warning is generated if perl is running under C<-w>.
+
+=back
+
+If you prefer not to import these routines into your namespace, you can
+call them as:
+
+ use MIME::Base64 ();
+ $encoded = MIME::Base64::encode($decoded);
+ $decoded = MIME::Base64::decode($encoded);
+
+=head1 DIAGNOSTICS
+
+The following warnings can be generated if perl is invoked with the
+C<-w> switch:
+
+=over 4
+
+=item Premature end of base64 data
+
+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 be the same
+whether the padding is present or not.
+
+=item Premature padding of base64 data
+
+The '=' padding character occurs as the first or second character
+in a base64 quartet.
+
+=back
+
+The following exception can be raised:
+
+=over 4
+
+=item Wide character in subroutine entry
+
+The string passed to encode_base64() contains characters with code
+above 255. The base64 encoding is only defined for single-byte
+characters. Use the Encode module to select the byte encoding you
+want.
+
+=back
+
+=head1 EXAMPLES
+
+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):
+
+ use MIME::Base64 qw(encode_base64);
+
+ open(FILE, "/var/log/wtmp") or die "$!";
+ while (read(FILE, $buf, 60*57)) {
+ print encode_base64($buf);
+ }
+
+or if you know you have enough memory
+
+ use MIME::Base64 qw(encode_base64);
+ local($/) = undef; # slurp
+ print encode_base64(<STDIN>);
+
+The same approach as a command line:
+
+ perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)' <file
+
+Decoding does not need slurp mode if every line contains a multiple
+of four base64 chars:
+
+ perl -MMIME::Base64 -ne 'print decode_base64($_)' <file
+
+Perl v5.8 and better allow extended Unicode characters in strings.
+Such strings cannot be encoded directly, as the base64
+encoding is only defined for single-byte characters. The solution is
+to use the Encode module to select the byte encoding you want. For
+example:
+
+ use MIME::Base64 qw(encode_base64);
+ use Encode qw(encode);
+
+ $encoded = encode_base64(encode("UTF-8", "\x{FFFF}\n"));
+ print $encoded;
+
+=head1 COPYRIGHT
+
+Copyright 1995-1999, 2001-2004 Gisle Aas.
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+Distantly based on LWP::Base64 written by Martijn Koster
+<m.koster@nexor.co.uk> and Joerg Reichelt <j.reichelt@nexor.co.uk> and
+code posted to comp.lang.perl <3pd2lp$6gf@wsinti07.win.tue.nl> by Hans
+Mulder <hansm@wsinti07.win.tue.nl>
+
+The XS implementation uses code from metamail. Copyright 1991 Bell
+Communications Research, Inc. (Bellcore)
+
+=head1 SEE ALSO
+
+L<MIME::QuotedPrint>
+
+=cut
diff --git a/cpan/MIME-Base64/Base64.xs b/cpan/MIME-Base64/Base64.xs
new file mode 100644
index 0000000000..1740a163f1
--- /dev/null
+++ b/cpan/MIME-Base64/Base64.xs
@@ -0,0 +1,457 @@
+/* $Id$
+
+Copyright 1997-2004 Gisle Aas
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+
+The tables and some of the code that used to be here was borrowed from
+metamail, which comes with this message:
+
+ Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
+
+ Permission to use, copy, modify, and distribute this material
+ for any purpose and without fee is hereby granted, provided
+ that the above copyright notice and this permission notice
+ appear in all copies, and that the name of Bellcore not be
+ used in advertising or publicity pertaining to this
+ material without the specific, prior written permission
+ of an authorized representative of Bellcore. BELLCORE
+ MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
+ OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
+ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
+
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define PERL_NO_GET_CONTEXT /* we want efficiency */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef PATCHLEVEL
+# include <patchlevel.h>
+# if !(defined(PERL_VERSION) || (SUBVERSION > 0 && defined(PATCHLEVEL)))
+# include <could_not_find_Perl_patchlevel.h>
+# endif
+#endif
+
+#if PATCHLEVEL <= 4 && !defined(PL_dowarn)
+ #define PL_dowarn dowarn
+#endif
+
+#ifdef G_WARN_ON
+ #define DOWARN (PL_dowarn & G_WARN_ON)
+#else
+ #define DOWARN PL_dowarn
+#endif
+
+
+#define MAX_LINE 76 /* size of encoded lines */
+
+static const char basis_64[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+#define XX 255 /* illegal base64 char */
+#define EQ 254 /* padding */
+#define INVALID XX
+
+static const unsigned char index_64[256] = {
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,62, XX,XX,XX,63,
+ 52,53,54,55, 56,57,58,59, 60,61,XX,XX, XX,EQ,XX,XX,
+ XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,
+ 15,16,17,18, 19,20,21,22, 23,24,25,XX, XX,XX,XX,XX,
+ XX,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
+ 41,42,43,44, 45,46,47,48, 49,50,51,XX, XX,XX,XX,XX,
+
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+ XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
+};
+
+#ifdef SvPVbyte
+# if PERL_REVISION == 5 && PERL_VERSION < 7
+ /* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */
+# undef SvPVbyte
+# define SvPVbyte(sv, lp) \
+ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
+ ? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp))
+ static char *
+ my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp)
+ {
+ sv_utf8_downgrade(sv,0);
+ return SvPV(sv,*lp);
+ }
+# endif
+#else
+# define SvPVbyte SvPV
+#endif
+
+#ifndef isXDIGIT
+# define isXDIGIT isxdigit
+#endif
+
+#ifndef NATIVE_TO_ASCII
+# define NATIVE_TO_ASCII(ch) (ch)
+#endif
+
+MODULE = MIME::Base64 PACKAGE = MIME::Base64
+
+SV*
+encode_base64(sv,...)
+ SV* sv
+ PROTOTYPE: $;$
+
+ PREINIT:
+ char *str; /* string to encode */
+ SSize_t len; /* length of the string */
+ char *eol; /* the end-of-line sequence to use */
+ STRLEN eollen; /* length of the EOL sequence */
+ char *r; /* result string */
+ STRLEN rlen; /* length of result string */
+ unsigned char c1, c2, c3;
+ int chunk;
+
+ CODE:
+#if PERL_REVISION == 5 && PERL_VERSION >= 6
+ sv_utf8_downgrade(sv, FALSE);
+#endif
+ str = SvPV(sv, rlen); /* SvPV(sv, len) gives warning for signed len */
+ len = (SSize_t)rlen;
+
+ /* set up EOL from the second argument if present, default to "\n" */
+ if (items > 1 && SvOK(ST(1))) {
+ eol = SvPV(ST(1), eollen);
+ } else {
+ eol = "\n";
+ eollen = 1;
+ }
+
+ /* calculate the length of the result */
+ rlen = (len+2) / 3 * 4; /* encoded bytes */
+ if (rlen) {
+ /* add space for EOL */
+ rlen += ((rlen-1) / MAX_LINE + 1) * eollen;
+ }
+
+ /* allocate a result buffer */
+ RETVAL = newSV(rlen ? rlen : 1);
+ SvPOK_on(RETVAL);
+ SvCUR_set(RETVAL, rlen);
+ r = SvPVX(RETVAL);
+
+ /* encode */
+ for (chunk=0; len > 0; len -= 3, chunk++) {
+ if (chunk == (MAX_LINE/4)) {
+ char *c = eol;
+ char *e = eol + eollen;
+ while (c < e)
+ *r++ = *c++;
+ chunk = 0;
+ }
+ c1 = *str++;
+ c2 = len > 1 ? *str++ : '\0';
+ *r++ = basis_64[c1>>2];
+ *r++ = basis_64[((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)];
+ if (len > 2) {
+ c3 = *str++;
+ *r++ = basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
+ *r++ = basis_64[c3 & 0x3F];
+ } else if (len == 2) {
+ *r++ = basis_64[(c2 & 0xF) << 2];
+ *r++ = '=';
+ } else { /* len == 1 */
+ *r++ = '=';
+ *r++ = '=';
+ }
+ }
+ if (rlen) {
+ /* append eol to the result string */
+ char *c = eol;
+ char *e = eol + eollen;
+ while (c < e)
+ *r++ = *c++;
+ }
+ *r = '\0'; /* every SV in perl should be NUL-terminated */
+
+ OUTPUT:
+ RETVAL
+
+SV*
+decode_base64(sv)
+ SV* sv
+ PROTOTYPE: $
+
+ PREINIT:
+ STRLEN len;
+ register unsigned char *str = (unsigned char*)SvPVbyte(sv, len);
+ unsigned char const* end = str + len;
+ char *r;
+ unsigned char c[4];
+
+ CODE:
+ {
+ /* always enough, but might be too much */
+ STRLEN rlen = len * 3 / 4;
+ RETVAL = newSV(rlen ? rlen : 1);
+ }
+ SvPOK_on(RETVAL);
+ r = SvPVX(RETVAL);
+
+ while (str < end) {
+ int i = 0;
+ do {
+ unsigned char uc = index_64[NATIVE_TO_ASCII(*str++)];
+ if (uc != INVALID)
+ c[i++] = uc;
+
+ if (str == end) {
+ if (i < 4) {
+ if (i && DOWARN)
+ warn("Premature end of base64 data");
+ if (i < 2) goto thats_it;
+ if (i == 2) c[2] = EQ;
+ c[3] = EQ;
+ }
+ break;
+ }
+ } while (i < 4);
+
+ if (c[0] == EQ || c[1] == EQ) {
+ if (DOWARN) warn("Premature padding of base64 data");
+ break;
+ }
+ /* printf("c0=%d,c1=%d,c2=%d,c3=%d\n", c[0],c[1],c[2],c[3]);*/
+
+ *r++ = (c[0] << 2) | ((c[1] & 0x30) >> 4);
+
+ if (c[2] == EQ)
+ break;
+ *r++ = ((c[1] & 0x0F) << 4) | ((c[2] & 0x3C) >> 2);
+
+ if (c[3] == EQ)
+ break;
+ *r++ = ((c[2] & 0x03) << 6) | c[3];
+ }
+
+ thats_it:
+ SvCUR_set(RETVAL, r - SvPVX(RETVAL));
+ *r = '\0';
+
+ OUTPUT:
+ RETVAL
+
+
+MODULE = MIME::Base64 PACKAGE = MIME::QuotedPrint
+
+#ifdef EBCDIC
+#define qp_isplain(c) ((c) == '\t' || ((!isprint(c) && (c) != '=')))
+#else
+#define qp_isplain(c) ((c) == '\t' || (((c) >= ' ' && (c) <= '~') && (c) != '='))
+#endif
+
+SV*
+encode_qp(sv,...)
+ SV* sv
+ PROTOTYPE: $;$$
+
+ PREINIT:
+ char *eol;
+ STRLEN eol_len;
+ int binary;
+ STRLEN sv_len;
+ STRLEN linelen;
+ char *beg;
+ char *end;
+ char *p;
+ char *p_beg;
+ STRLEN p_len;
+
+ CODE:
+#if PERL_REVISION == 5 && PERL_VERSION >= 6
+ sv_utf8_downgrade(sv, FALSE);
+#endif
+ /* set up EOL from the second argument if present, default to "\n" */
+ if (items > 1 && SvOK(ST(1))) {
+ eol = SvPV(ST(1), eol_len);
+ } else {
+ eol = "\n";
+ eol_len = 1;
+ }
+
+ binary = (items > 2 && SvTRUE(ST(2)));
+
+ beg = SvPV(sv, sv_len);
+ end = beg + sv_len;
+
+ RETVAL = newSV(sv_len + 1);
+ sv_setpv(RETVAL, "");
+ linelen = 0;
+
+ p = beg;
+ while (1) {
+ p_beg = p;
+
+ /* skip past as much plain text as possible */
+ while (p < end && qp_isplain(*p)) {
+ p++;
+ }
+ if (p == end || *p == '\n') {
+ /* whitespace at end of line must be encoded */
+ while (p > p_beg && (*(p - 1) == '\t' || *(p - 1) == ' '))
+ p--;
+ }
+
+ p_len = p - p_beg;
+ if (p_len) {
+ /* output plain text (with line breaks) */
+ if (eol_len) {
+ STRLEN max_last_line = (p == end || *p == '\n')
+ ? MAX_LINE /* .......\n */
+ : ((p + 1) == end || *(p + 1) == '\n')
+ ? MAX_LINE - 3 /* ....=XX\n */
+ : MAX_LINE - 4; /* ...=XX=\n */
+ while (p_len + linelen > max_last_line) {
+ STRLEN len = MAX_LINE - 1 - linelen;
+ if (len > p_len)
+ len = p_len;
+ sv_catpvn(RETVAL, p_beg, len);
+ p_beg += len;
+ p_len -= len;
+ sv_catpvn(RETVAL, "=", 1);
+ sv_catpvn(RETVAL, eol, eol_len);
+ linelen = 0;
+ }
+ }
+ if (p_len) {
+ sv_catpvn(RETVAL, p_beg, p_len);
+ linelen += p_len;
+ }
+ }
+
+ if (p == end) {
+ break;
+ }
+ else if (*p == '\n' && eol_len && !binary) {
+ sv_catpvn(RETVAL, eol, eol_len);
+ p++;
+ linelen = 0;
+ }
+ else {
+ /* output escaped char (with line breaks) */
+ assert(p < end);
+ if (eol_len && linelen > MAX_LINE - 4) {
+ sv_catpvn(RETVAL, "=", 1);
+ sv_catpvn(RETVAL, eol, eol_len);
+ linelen = 0;
+ }
+ sv_catpvf(RETVAL, "=%02X", (unsigned char)*p);
+ p++;
+ linelen += 3;
+ }
+
+ /* optimize reallocs a bit */
+ if (SvLEN(RETVAL) > 80 && SvLEN(RETVAL) - SvCUR(RETVAL) < 3) {
+ STRLEN expected_len = (SvCUR(RETVAL) * sv_len) / (p - beg);
+ SvGROW(RETVAL, expected_len);
+ }
+ }
+
+ if (SvCUR(RETVAL) && eol_len && linelen) {
+ sv_catpvn(RETVAL, "=", 1);
+ sv_catpvn(RETVAL, eol, eol_len);
+ }
+
+ OUTPUT:
+ RETVAL
+
+SV*
+decode_qp(sv)
+ SV* sv
+ PROTOTYPE: $
+
+ PREINIT:
+ STRLEN len;
+ char *str = SvPVbyte(sv, len);
+ char const* end = str + len;
+ char *r;
+ char *whitespace = 0;
+
+ CODE:
+ RETVAL = newSV(len ? len : 1);
+ SvPOK_on(RETVAL);
+ r = SvPVX(RETVAL);
+ while (str < end) {
+ if (*str == ' ' || *str == '\t') {
+ if (!whitespace)
+ whitespace = str;
+ str++;
+ }
+ else if (*str == '\r' && (str + 1) < end && str[1] == '\n') {
+ str++;
+ }
+ else if (*str == '\n') {
+ whitespace = 0;
+ *r++ = *str++;
+ }
+ else {
+ if (whitespace) {
+ while (whitespace < str) {
+ *r++ = *whitespace++;
+ }
+ whitespace = 0;
+ }
+ if (*str == '=') {
+ if ((str + 2) < end && isXDIGIT(str[1]) && isXDIGIT(str[2])) {
+ char buf[3];
+ str++;
+ buf[0] = *str++;
+ buf[1] = *str++;
+ buf[2] = '\0';
+ *r++ = (char)strtol(buf, 0, 16);
+ }
+ else {
+ /* look for soft line break */
+ char *p = str + 1;
+ while (p < end && (*p == ' ' || *p == '\t'))
+ p++;
+ if (p < end && *p == '\n')
+ str = p + 1;
+ else if ((p + 1) < end && *p == '\r' && *(p + 1) == '\n')
+ str = p + 2;
+ else
+ *r++ = *str++; /* give up */
+ }
+ }
+ else {
+ *r++ = *str++;
+ }
+ }
+ }
+ if (whitespace) {
+ while (whitespace < str) {
+ *r++ = *whitespace++;
+ }
+ }
+ *r = '\0';
+ SvCUR_set(RETVAL, r - SvPVX(RETVAL));
+
+ OUTPUT:
+ RETVAL
+
+
+MODULE = MIME::Base64 PACKAGE = MIME::Base64
diff --git a/cpan/MIME-Base64/Changes b/cpan/MIME-Base64/Changes
new file mode 100644
index 0000000000..4b60a89d96
--- /dev/null
+++ b/cpan/MIME-Base64/Changes
@@ -0,0 +1,380 @@
+2009-06-09 Gisle Aas <gisle@ActiveState.com>
+
+ Release 3.08
+
+ Jarkko Hietaniemi (1):
+ EBCDIC changes from core
+
+ Nicholas Clark (1):
+ Get rid of the PERL_CORE hacks
+
+
+
+2005-11-30 Gisle Aas <gisle@ActiveState.com>
+
+ Release 3.07
+
+ Use a Makefile.PL that is also suitable for core perl.
+
+
+
+2005-11-26 Gisle Aas <gisle@ActiveState.com>
+
+ Release 3.06
+
+ Documentation tweaks.
+
+ use XSLoader; perl-5.6 now required.
+
+ Some consting from bleadperl.
+
+ Unbundled the {en,de}code-{base64,qp} utility scripts.
+ These are now found in the MIME-Base64-Scripts package.
+
+
+
+2004-09-20 Gisle Aas <gisle@ActiveState.com>
+
+ Release 3.05
+
+ Steve Hay <steve.hay@uk.radan.com> found the warn test broken
+ on Windows and provided a fix.
+
+
+
+2004-09-18 Gisle Aas <gisle@ActiveState.com>
+
+ Release 3.04
+
+ Fixed the bad-sv.t test script to actually contain the
+ correct expected result as of v3.02.
+
+
+
+2004-08-25 Gisle Aas <gisle@ActiveState.com>
+
+ Release 3.03
+
+ Forgot to increment version number in MIME::QuotedPrint even
+ if its interface changed in 3.02. As a result you will now
+ need to require MIME::QuotedPrint 3.03 if you want to ensure
+ it provides the binmode interface.
+
+
+
+2004-08-24 Gisle Aas <gisle@ActiveState.com>
+
+ Release 3.02
+
+ The encode_qp() function now takes an optional third argument
+ to select binary encoding mode.
+ <https://rt.cpan.org/Ticket/Display.html?id=7456>
+
+ The result of encode_qp($non_empty, $eol) will now always be
+ $eol terminated. If the string to encode does not end with "\n"
+ then a soft line break is appended to the result. As an example
+ encode_qp("foo") used to be encoded as "foo", but now encodes as
+ "foo=\n".
+
+
+
+2004-03-29 Gisle Aas <gisle@ActiveState.com>
+
+ Release 3.01
+
+ By compiling the extension with PERL_NO_GET_CONTEXT we can
+ make it slightly faster on a threaded perl. No change on a
+ regular perl. Patch provided by Beau E. Cox <beau@beaucox.com>.
+
+ Fixed missing ";" with assert. Patch provided by
+ Brendan O'Dea <bod@debian.org>.
+
+
+
+2004-01-14 Gisle Aas <gisle@ActiveState.com>
+
+ Release 3.00
+
+ Drop the pure Perl implementations of the encoders and
+ decoders. They are bloat that hides real problems in
+ the XS implementations. I will re-release them separately
+ in the new MIME-Base64-Perl distribution.
+
+ The 'gcc -Wall' fix in 2.22 broke support for perl5.005,
+ as the isXDIGIT() macro is not available in that perl.
+ This problem has now been fixed.
+
+
+
+2004-01-08 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.23
+
+ Documentation fixes by Paul Croome <Paul.Croome@softwareag.com>.
+
+
+
+2004-01-08 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.22
+
+ Fix 'gcc -Wall' complaints.
+
+
+
+2003-10-09 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.21
+
+ Documentation tweaks.
+
+ Don't rely on SvEND(sv) == '\0' as discussed in the perl5-porters
+ mailing list thread that starts with
+ http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-10/msg00258.html
+
+ Should now pass test suite even without XS support.
+
+ Perl v5.005 or better is now required.
+
+
+
+2003-05-13 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.20
+
+ decode_qp() recognize soft whitespace when there is whitespace
+ between the '=' and the '\n'.
+
+
+
+2003-05-13 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.19
+
+ decode_qp() did eat up all trailing whitespace in the string decoded.
+ Only whitespace in front of "\n" should go.
+
+ Win32 fix for t/warn.t by Reini Urban <rurban@x-ray.at>.
+
+
+
+2003-03-09 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.18
+
+ Fix up INSTALLDIRS for perl-5.8 and newer.
+
+
+
+2003-03-09 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.17
+
+ Make it reliable to disable base64 decoding warnings by
+ resetting $^W in recent perls. Would really like to be
+ able to do real lexical warnings but the current mechanism
+ does not seems suitable for XS code.
+
+ Passing "" as $eol to encode_qp() disable soft line
+ breaks as well.
+
+ Sync up with changes in bleadperl:
+ - safer patchlevel.h include
+ - bad cast
+
+
+
+2003-01-05 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.16
+
+ Fixed the encode_qp() line breaking code. It sometimes
+ made lines longer than 76 chars and it could even get into
+ an infinite loop on certain inputs.
+
+
+
+2003-01-03 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.15
+
+ Fixed the XS based decode_qp() for strings where a =XX
+ sequence was followed by digits.
+
+ Faster encode_qp() for long strings with lots of chars
+ that need escaping.
+
+ The old_decode_base64() function introduced in 2.13
+ was returning undef for empty input on olders perls.
+ This problem has been fixed.
+
+
+
+2003-01-01 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.14
+
+ MIME::QuotedPrint functions now also implemented using XS
+ which make them faster. 2-3 times faster when encoding line by
+ line and as much as 200 times faster on long binary input. There
+ is probably some breakage on non-ASCII systems from this.
+
+ The encode_qp() function now takes an $eol argument in the
+ same way as encode_base64() does.
+
+ Slight change in behaviour: the decode_qp() function now turns
+ \r\n terminated lines into \n terminated lines. This makes is
+ more likely that encode_qp(decode_qp()) round-trip properly.
+
+ Included {en,de}code-{base64,qp} utility scripts.
+
+
+
+2002-12-27 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.13
+
+ Sync up with bleadperl:
+ - Documentation update
+ - EBCDIC support
+ - Whitespace tweaks
+ - Improved Unicode support
+ - Test suite tweaks
+
+ Improved version of the old_{en,de}code_base64 functions
+ contributed by Paul Szabo <psz@maths.usyd.edu.au>.
+
+
+
+2001-02-23 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.12
+
+ Speed up pure perl base64 encoder/decoder by using join/map instead
+ of while loop. Contributed by Arno Beckmann <arno@gmx.de>
+
+ Doc update contributed by Jerrad Pierce <belg4mit@CALLOWAY.MIT.EDU>
+
+ Downgrade UTF8 strings before starting to encode.
+
+
+
+1999-02-27 Gisle Aas <gisle@aas.no>
+
+ Release 2.11
+
+ Fixed bogus "Premature end of base64 data" warning. Bug spotted
+ by Dwayne Jacques Fontenot.
+
+ Workaround for Redhat shipping trial releases of perl.
+
+
+
+1998-12-18 Gisle Aas <aas@sn.no>
+
+ Release 2.10
+
+ A tweak that should make compilation with some old perl5.00[23]
+ perls better.
+
+ A cast that make some compilers more happy.
+
+
+
+1998-11-13 Gisle Aas <aas@sn.no>
+
+ Release 2.09
+
+ The 2.08 release did not compile with perl5.005_53, because
+ all simple globals now need to be prefixed with "PL_".
+
+
+
+1998-10-22 Gisle Aas <aas@sn.no>
+
+ Release 2.08
+
+ Found another tweak to speed up decode_base64() with another 3%.
+
+ Improved MIME::Base64 documentation a little.
+
+
+
+1998-10-21 Gisle Aas <aas@sn.no>
+
+ Release 2.07
+
+ Faster and smarter C implementation of the decode_base64()
+ function. The new decode_base64() was 25% faster when tested
+ on Linux, i586, gcc -O2.
+
+
+
+1998-07-15 Gisle Aas <aas@sn.no>
+
+ Release 2.06
+
+ The decode_base64() implemented in pure perl will only carp
+ (not croak) if length of data to decode is not a multiple 4. This
+ actually made 'make test' fail after 'rm Base64.xs'.
+
+
+
+1998-01-27 Gisle Aas <aas@sn.no>
+
+ Release 2.05
+
+ The decode_base64() would previously allocate a too short buffer for the
+ result string when the trailing "==" padding was missing in the string to
+ be decoded.
+
+ The encode_base64() now allocate one byte less space in the result
+ strings returned.
+
+
+
+1997-12-02 Gisle Aas <aas@sn.no>
+
+ Release 2.04
+
+ Documentation expanded a bit.
+
+
+
+1997-07-10 Gisle Aas <aas@sn.no>
+
+ Release 2.03
+
+ Decode_base64() doesn't croak on premature ended data any more.
+ A warning is generated instead if running under -w.
+
+
+
+1997-06-27 Gisle Aas <aas@sn.no>
+
+ Release 2.02
+
+ QuotedPrint fix by Roderick Schertler <roderick@argon.org>:
+
+ - Long lines were not broken unless they're at the beginning
+ of the text
+
+ - Lines near but not over 76 chars were broken when they
+ shouldn't be
+
+
+
+1997-06-13 Gisle Aas <aas@sn.no>
+
+ Release 2.01
+
+ Base64.xs: Avoid type convertion warnings with some compilers
+
+ Minor documentation updates
+
+
+
+1997-04-24 Gisle Aas <aas@sn.no>
+
+ Release 2.00, based on libwww-perl-5.08.
+
diff --git a/cpan/MIME-Base64/Makefile.PL b/cpan/MIME-Base64/Makefile.PL
new file mode 100644
index 0000000000..7300447690
--- /dev/null
+++ b/cpan/MIME-Base64/Makefile.PL
@@ -0,0 +1,13 @@
+require 5.006;
+use ExtUtils::MakeMaker;
+
+my @makefileopts;
+if ($] >= 5.008) {
+ push @makefileopts, INSTALLDIRS => 'perl';
+}
+
+WriteMakefile(
+ NAME => 'MIME::Base64',
+ VERSION_FROM => 'Base64.pm',
+ @makefileopts,
+);
diff --git a/cpan/MIME-Base64/QuotedPrint.pm b/cpan/MIME-Base64/QuotedPrint.pm
new file mode 100644
index 0000000000..aee13d6256
--- /dev/null
+++ b/cpan/MIME-Base64/QuotedPrint.pm
@@ -0,0 +1,114 @@
+package MIME::QuotedPrint;
+
+use strict;
+use vars qw(@ISA @EXPORT $VERSION);
+
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = qw(encode_qp decode_qp);
+
+$VERSION = "3.08";
+
+use MIME::Base64; # will load XS version of {en,de}code_qp()
+
+*encode = \&encode_qp;
+*decode = \&decode_qp;
+
+1;
+
+__END__
+
+=head1 NAME
+
+MIME::QuotedPrint - Encoding and decoding of quoted-printable strings
+
+=head1 SYNOPSIS
+
+ use MIME::QuotedPrint;
+
+ $encoded = encode_qp($decoded);
+ $decoded = decode_qp($encoded);
+
+=head1 DESCRIPTION
+
+This module provides functions to encode and decode strings into and from the
+quoted-printable encoding specified in RFC 2045 - I<MIME (Multipurpose
+Internet Mail Extensions)>. The quoted-printable encoding is intended
+to represent data that largely consists of bytes that correspond to
+printable characters in the ASCII character set. Each non-printable
+character (as defined by English Americans) is represented by a
+triplet consisting of the character "=" followed by two hexadecimal
+digits.
+
+The following functions are provided:
+
+=over 4
+
+=item encode_qp($str)
+
+=item encode_qp($str, $eol)
+
+=item encode_qp($str, $eol, $binmode)
+
+This function returns an encoded version of the string ($str) given as
+argument.
+
+The second argument ($eol) is the line-ending sequence to use. It is
+optional and defaults to "\n". Every occurrence of "\n" is replaced
+with this string, and it is also used for additional "soft line
+breaks" to ensure that no line end up longer than 76 characters. Pass
+it as "\015\012" to produce data suitable for external consumption.
+The string "\r\n" produces the same result on many platforms, but not
+all.
+
+The third argument ($binmode) will select binary mode if passed as a
+TRUE value. In binary mode "\n" will be encoded in the same way as
+any other non-printable character. This ensures that a decoder will
+end up with exactly the same string whatever line ending sequence it
+uses. In general it is preferable to use the base64 encoding for
+binary data; see L<MIME::Base64>.
+
+An $eol of "" (the empty string) is special. In this case, no "soft
+line breaks" are introduced and binary mode is effectively enabled so
+that any "\n" in the original data is encoded as well.
+
+=item decode_qp($str);
+
+This function returns the plain text version of the string given
+as argument. The lines of the result are "\n" terminated, even if
+the $str argument contains "\r\n" terminated lines.
+
+=back
+
+
+If you prefer not to import these routines into your namespace, you can
+call them as:
+
+ use MIME::QuotedPrint ();
+ $encoded = MIME::QuotedPrint::encode($decoded);
+ $decoded = MIME::QuotedPrint::decode($encoded);
+
+Perl v5.8 and better allow extended Unicode characters in strings.
+Such strings cannot be encoded directly, as the quoted-printable
+encoding is only defined for single-byte characters. The solution is
+to use the Encode module to select the byte encoding you want. For
+example:
+
+ use MIME::QuotedPrint qw(encode_qp);
+ use Encode qw(encode);
+
+ $encoded = encode_qp(encode("UTF-8", "\x{FFFF}\n"));
+ print $encoded;
+
+=head1 COPYRIGHT
+
+Copyright 1995-1997,2002-2004 Gisle Aas.
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<MIME::Base64>
+
+=cut
diff --git a/cpan/MIME-Base64/README b/cpan/MIME-Base64/README
new file mode 100644
index 0000000000..fbd3d54cda
--- /dev/null
+++ b/cpan/MIME-Base64/README
@@ -0,0 +1,27 @@
+This package contains a base64 encoder/decoder and a quoted-printable
+encoder/decoder. These encoding methods are specified in RFC 2045 -
+MIME (Multipurpose Internet Mail Extensions).
+
+The base64 encoding is designed to represent arbitrary sequences of
+octets in a form that need not be humanly readable. A 65-character
+subset ([A-Za-z0-9+/=]) of US-ASCII is used, enabling 6 bits to be
+represented per printable character.
+
+The quoted-printable encoding is intended to represent data that
+largely consists of bytes that correspond to printable characters in
+the ASCII character set. Each non-printable character is represented by
+a triplet consisting of the character "=" followed by two hexadecimal
+digits.
+
+In order to install and use this package you will need Perl version
+5.6 or better. Installation as usual:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+Copyright 1995-1999,2001-2004 Gisle Aas <gisle@ActiveState.com>
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
diff --git a/cpan/MIME-Base64/t/base64.t b/cpan/MIME-Base64/t/base64.t
new file mode 100644
index 0000000000..d446ec25bf
--- /dev/null
+++ b/cpan/MIME-Base64/t/base64.t
@@ -0,0 +1,378 @@
+BEGIN {
+ if ($ENV{'PERL_CORE'}){
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+}
+
+use strict;
+use MIME::Base64;
+
+print "1..283\n";
+
+print "# Testing MIME::Base64-", $MIME::Base64::VERSION, "\n";
+
+BEGIN {
+ if (ord('A') == 0x41) {
+ *ASCII = sub { return $_[0] };
+ }
+ else {
+ require Encode;
+ *ASCII = sub { Encode::encode('ascii',$_[0]) };
+ }
+}
+
+my $testno = 1;
+# instead of "for my $test (...)" , which is my preference.
+# Not sure which perl version has started supporting. MIME::Base64
+# was supposed to work with very old perl5, right?
+my $test;
+
+encodeTest();
+decodeTest();
+
+# This used to generate a warning
+print "not " unless decode_base64(encode_base64("foo")) eq "foo";
+print "ok ", $testno++, "\n";
+
+sub encodeTest
+{
+ print "# encode test\n";
+
+ my @encode_tests = (
+ # All values
+ ["\000" => "AA=="],
+ ["\001" => "AQ=="],
+ ["\002" => "Ag=="],
+ ["\003" => "Aw=="],
+ ["\004" => "BA=="],
+ ["\005" => "BQ=="],
+ ["\006" => "Bg=="],
+ ["\007" => "Bw=="],
+ ["\010" => "CA=="],
+ ["\011" => "CQ=="],
+ ["\012" => "Cg=="],
+ ["\013" => "Cw=="],
+ ["\014" => "DA=="],
+ ["\015" => "DQ=="],
+ ["\016" => "Dg=="],
+ ["\017" => "Dw=="],
+ ["\020" => "EA=="],
+ ["\021" => "EQ=="],
+ ["\022" => "Eg=="],
+ ["\023" => "Ew=="],
+ ["\024" => "FA=="],
+ ["\025" => "FQ=="],
+ ["\026" => "Fg=="],
+ ["\027" => "Fw=="],
+ ["\030" => "GA=="],
+ ["\031" => "GQ=="],
+ ["\032" => "Gg=="],
+ ["\033" => "Gw=="],
+ ["\034" => "HA=="],
+ ["\035" => "HQ=="],
+ ["\036" => "Hg=="],
+ ["\037" => "Hw=="],
+ ["\040" => "IA=="],
+ ["\041" => "IQ=="],
+ ["\042" => "Ig=="],
+ ["\043" => "Iw=="],
+ ["\044" => "JA=="],
+ ["\045" => "JQ=="],
+ ["\046" => "Jg=="],
+ ["\047" => "Jw=="],
+ ["\050" => "KA=="],
+ ["\051" => "KQ=="],
+ ["\052" => "Kg=="],
+ ["\053" => "Kw=="],
+ ["\054" => "LA=="],
+ ["\055" => "LQ=="],
+ ["\056" => "Lg=="],
+ ["\057" => "Lw=="],
+ ["\060" => "MA=="],
+ ["\061" => "MQ=="],
+ ["\062" => "Mg=="],
+ ["\063" => "Mw=="],
+ ["\064" => "NA=="],
+ ["\065" => "NQ=="],
+ ["\066" => "Ng=="],
+ ["\067" => "Nw=="],
+ ["\070" => "OA=="],
+ ["\071" => "OQ=="],
+ ["\072" => "Og=="],
+ ["\073" => "Ow=="],
+ ["\074" => "PA=="],
+ ["\075" => "PQ=="],
+ ["\076" => "Pg=="],
+ ["\077" => "Pw=="],
+ ["\100" => "QA=="],
+ ["\101" => "QQ=="],
+ ["\102" => "Qg=="],
+ ["\103" => "Qw=="],
+ ["\104" => "RA=="],
+ ["\105" => "RQ=="],
+ ["\106" => "Rg=="],
+ ["\107" => "Rw=="],
+ ["\110" => "SA=="],
+ ["\111" => "SQ=="],
+ ["\112" => "Sg=="],
+ ["\113" => "Sw=="],
+ ["\114" => "TA=="],
+ ["\115" => "TQ=="],
+ ["\116" => "Tg=="],
+ ["\117" => "Tw=="],
+ ["\120" => "UA=="],
+ ["\121" => "UQ=="],
+ ["\122" => "Ug=="],
+ ["\123" => "Uw=="],
+ ["\124" => "VA=="],
+ ["\125" => "VQ=="],
+ ["\126" => "Vg=="],
+ ["\127" => "Vw=="],
+ ["\130" => "WA=="],
+ ["\131" => "WQ=="],
+ ["\132" => "Wg=="],
+ ["\133" => "Ww=="],
+ ["\134" => "XA=="],
+ ["\135" => "XQ=="],
+ ["\136" => "Xg=="],
+ ["\137" => "Xw=="],
+ ["\140" => "YA=="],
+ ["\141" => "YQ=="],
+ ["\142" => "Yg=="],
+ ["\143" => "Yw=="],
+ ["\144" => "ZA=="],
+ ["\145" => "ZQ=="],
+ ["\146" => "Zg=="],
+ ["\147" => "Zw=="],
+ ["\150" => "aA=="],
+ ["\151" => "aQ=="],
+ ["\152" => "ag=="],
+ ["\153" => "aw=="],
+ ["\154" => "bA=="],
+ ["\155" => "bQ=="],
+ ["\156" => "bg=="],
+ ["\157" => "bw=="],
+ ["\160" => "cA=="],
+ ["\161" => "cQ=="],
+ ["\162" => "cg=="],
+ ["\163" => "cw=="],
+ ["\164" => "dA=="],
+ ["\165" => "dQ=="],
+ ["\166" => "dg=="],
+ ["\167" => "dw=="],
+ ["\170" => "eA=="],
+ ["\171" => "eQ=="],
+ ["\172" => "eg=="],
+ ["\173" => "ew=="],
+ ["\174" => "fA=="],
+ ["\175" => "fQ=="],
+ ["\176" => "fg=="],
+ ["\177" => "fw=="],
+ ["\200" => "gA=="],
+ ["\201" => "gQ=="],
+ ["\202" => "gg=="],
+ ["\203" => "gw=="],
+ ["\204" => "hA=="],
+ ["\205" => "hQ=="],
+ ["\206" => "hg=="],
+ ["\207" => "hw=="],
+ ["\210" => "iA=="],
+ ["\211" => "iQ=="],
+ ["\212" => "ig=="],
+ ["\213" => "iw=="],
+ ["\214" => "jA=="],
+ ["\215" => "jQ=="],
+ ["\216" => "jg=="],
+ ["\217" => "jw=="],
+ ["\220" => "kA=="],
+ ["\221" => "kQ=="],
+ ["\222" => "kg=="],
+ ["\223" => "kw=="],
+ ["\224" => "lA=="],
+ ["\225" => "lQ=="],
+ ["\226" => "lg=="],
+ ["\227" => "lw=="],
+ ["\230" => "mA=="],
+ ["\231" => "mQ=="],
+ ["\232" => "mg=="],
+ ["\233" => "mw=="],
+ ["\234" => "nA=="],
+ ["\235" => "nQ=="],
+ ["\236" => "ng=="],
+ ["\237" => "nw=="],
+ ["\240" => "oA=="],
+ ["\241" => "oQ=="],
+ ["\242" => "og=="],
+ ["\243" => "ow=="],
+ ["\244" => "pA=="],
+ ["\245" => "pQ=="],
+ ["\246" => "pg=="],
+ ["\247" => "pw=="],
+ ["\250" => "qA=="],
+ ["\251" => "qQ=="],
+ ["\252" => "qg=="],
+ ["\253" => "qw=="],
+ ["\254" => "rA=="],
+ ["\255" => "rQ=="],
+ ["\256" => "rg=="],
+ ["\257" => "rw=="],
+ ["\260" => "sA=="],
+ ["\261" => "sQ=="],
+ ["\262" => "sg=="],
+ ["\263" => "sw=="],
+ ["\264" => "tA=="],
+ ["\265" => "tQ=="],
+ ["\266" => "tg=="],
+ ["\267" => "tw=="],
+ ["\270" => "uA=="],
+ ["\271" => "uQ=="],
+ ["\272" => "ug=="],
+ ["\273" => "uw=="],
+ ["\274" => "vA=="],
+ ["\275" => "vQ=="],
+ ["\276" => "vg=="],
+ ["\277" => "vw=="],
+ ["\300" => "wA=="],
+ ["\301" => "wQ=="],
+ ["\302" => "wg=="],
+ ["\303" => "ww=="],
+ ["\304" => "xA=="],
+ ["\305" => "xQ=="],
+ ["\306" => "xg=="],
+ ["\307" => "xw=="],
+ ["\310" => "yA=="],
+ ["\311" => "yQ=="],
+ ["\312" => "yg=="],
+ ["\313" => "yw=="],
+ ["\314" => "zA=="],
+ ["\315" => "zQ=="],
+ ["\316" => "zg=="],
+ ["\317" => "zw=="],
+ ["\320" => "0A=="],
+ ["\321" => "0Q=="],
+ ["\322" => "0g=="],
+ ["\323" => "0w=="],
+ ["\324" => "1A=="],
+ ["\325" => "1Q=="],
+ ["\326" => "1g=="],
+ ["\327" => "1w=="],
+ ["\330" => "2A=="],
+ ["\331" => "2Q=="],
+ ["\332" => "2g=="],
+ ["\333" => "2w=="],
+ ["\334" => "3A=="],
+ ["\335" => "3Q=="],
+ ["\336" => "3g=="],
+ ["\337" => "3w=="],
+ ["\340" => "4A=="],
+ ["\341" => "4Q=="],
+ ["\342" => "4g=="],
+ ["\343" => "4w=="],
+ ["\344" => "5A=="],
+ ["\345" => "5Q=="],
+ ["\346" => "5g=="],
+ ["\347" => "5w=="],
+ ["\350" => "6A=="],
+ ["\351" => "6Q=="],
+ ["\352" => "6g=="],
+ ["\353" => "6w=="],
+ ["\354" => "7A=="],
+ ["\355" => "7Q=="],
+ ["\356" => "7g=="],
+ ["\357" => "7w=="],
+ ["\360" => "8A=="],
+ ["\361" => "8Q=="],
+ ["\362" => "8g=="],
+ ["\363" => "8w=="],
+ ["\364" => "9A=="],
+ ["\365" => "9Q=="],
+ ["\366" => "9g=="],
+ ["\367" => "9w=="],
+ ["\370" => "+A=="],
+ ["\371" => "+Q=="],
+ ["\372" => "+g=="],
+ ["\373" => "+w=="],
+ ["\374" => "/A=="],
+ ["\375" => "/Q=="],
+ ["\376" => "/g=="],
+ ["\377" => "/w=="],
+
+ ["\000\377" => "AP8="],
+ ["\377\000" => "/wA="],
+ ["\000\000\000" => "AAAA"],
+
+ ['' => ''],
+ [ASCII('a') => 'YQ=='],
+ [ASCII('aa') => 'YWE='],
+ [ASCII('aaa') => 'YWFh'],
+
+ [ASCII('aaa') => 'YWFh'],
+ [ASCII('aaa') => 'YWFh'],
+ [ASCII('aaa') => 'YWFh'],
+
+
+ # from HTTP spec
+ [ASCII('Aladdin:open sesame') => 'QWxhZGRpbjpvcGVuIHNlc2FtZQ=='],
+
+ [ASCII('a') x 100 => 'YWFh' x 33 . 'YQ=='],
+
+ [ASCII('Multipurpose Internet Mail Extensions: The Base64 Content-Transfer-Encoding is designed to represent sequences of octets in a form that is not humanly readable. ')
+ => "TXVsdGlwdXJwb3NlIEludGVybmV0IE1haWwgRXh0ZW5zaW9uczogVGhlIEJhc2U2NCBDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nIGlzIGRlc2lnbmVkIHRvIHJlcHJlc2VudCBzZXF1ZW5jZXMgb2Ygb2N0ZXRzIGluIGEgZm9ybSB0aGF0IGlzIG5vdCBodW1hbmx5IHJlYWRhYmxlLiA="],
+
+ );
+
+ for $test (@encode_tests) {
+ my($plain, $expected) = ($$test[0], $$test[1]);
+
+ my $encoded = encode_base64($plain, '');
+ if ($encoded ne $expected) {
+ print "test $testno ($plain): expected $expected, got $encoded\n";
+ print "not ";
+ }
+ my $decoded = decode_base64($encoded);
+ if ($decoded ne $plain) {
+ print "test $testno ($encoded): expected $plain, got $decoded\n";
+ print "not ";
+ }
+
+ print "ok $testno\n";
+ $testno++;
+ }
+}
+
+sub decodeTest
+{
+ print "# decode test\n";
+
+ local $SIG{__WARN__} = sub { print $_[0] }; # avoid warnings on stderr
+
+ my @decode_tests = (
+ ['YWE=' => ASCII('aa')],
+ [' YWE=' => ASCII('aa')],
+ ['Y WE=' => ASCII('aa')],
+ ['YWE= ' => ASCII('aa')],
+ ["Y\nW\r\nE=" => ASCII('aa')],
+
+ # These will generate some warnings
+ ['YWE=====' => ASCII('aa')], # extra padding
+ ['YWE' => ASCII('aa')], # missing padding
+ ['YWFh====' => ASCII('aaa')],
+ ['YQ' => ASCII('a')],
+ ['Y' => ''],
+ ['x==' => ''],
+ ['' => ''],
+ [undef() => ''],
+ );
+
+ for $test (@decode_tests) {
+ my($encoded, $expected) = ($$test[0], $$test[1]);
+
+ my $decoded = decode_base64($encoded);
+ if ($decoded ne $expected) {
+ die "test $testno ($encoded): expected $expected, got $decoded\n";
+ }
+ print "ok $testno\n";
+ $testno++;
+ }
+}
diff --git a/cpan/MIME-Base64/t/quoted-print.t b/cpan/MIME-Base64/t/quoted-print.t
new file mode 100644
index 0000000000..5bb87385af
--- /dev/null
+++ b/cpan/MIME-Base64/t/quoted-print.t
@@ -0,0 +1,352 @@
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+}
+
+use MIME::QuotedPrint;
+
+$x70 = "x" x 70;
+
+$IsASCII = ord('A') == 65;
+$IsEBCDIC = ord('A') == 193;
+
+if ($IsASCII) {
+
+@tests =
+ (
+ # plain ascii should not be encoded
+ ["", ""],
+ ["quoted printable" =>
+ "quoted printable=\n"],
+
+ # 8-bit chars should be encoded
+ ["v\xe5re kj\xe6re norske tegn b\xf8r \xe6res" =>
+ "v=E5re kj=E6re norske tegn b=F8r =E6res=\n"],
+
+ # trailing space should be encoded
+ [" " => "=20=20=\n"],
+ ["\tt\t" => "\tt=09=\n"],
+ ["test \ntest\n\t \t \n" => "test=20=20\ntest\n=09=20=09=20\n"],
+
+ # "=" is special an should be decoded
+ ["=30\n" => "=3D30\n"],
+ ["\0\xff0" => "=00=FF0=\n"],
+
+ # Very long lines should be broken (not more than 76 chars
+ ["The Quoted-Printable encoding is intended to represent data that largly consists of octets that correspond to printable characters in the ASCII character set." =>
+ "The Quoted-Printable encoding is intended to represent data that largly con=
+sists of octets that correspond to printable characters in the ASCII charac=
+ter set.=\n"
+ ],
+
+ # Long lines after short lines were broken through 2.01.
+ ["short line
+In America, any boy may become president and I suppose that's just one of the risks he takes. -- Adlai Stevenson" =>
+ "short line
+In America, any boy may become president and I suppose that's just one of t=
+he risks he takes. -- Adlai Stevenson=\n"],
+
+ # My (roderick@argon.org) first crack at fixing that bug failed for
+ # multiple long lines.
+ ["College football is a game which would be much more interesting if the faculty played instead of the students, and even more interesting if the
+trustees played. There would be a great increase in broken arms, legs, and necks, and simultaneously an appreciable diminution in the loss to humanity. -- H. L. Mencken" =>
+ "College football is a game which would be much more interesting if the facu=
+lty played instead of the students, and even more interesting if the
+trustees played. There would be a great increase in broken arms, legs, and=
+ necks, and simultaneously an appreciable diminution in the loss to humanit=
+y. -- H. L. Mencken=\n"],
+
+ # Don't break a line that's near but not over 76 chars.
+ ["$x70!23" => "$x70!23=\n"],
+ ["$x70!234" => "$x70!234=\n"],
+ ["$x70!2345" => "$x70!2345=\n"],
+ ["$x70!23456" => "$x70!23456=\n"],
+ ["$x70!234567" => "$x70!2345=\n67=\n"],
+ ["$x70!23456=" => "$x70!2345=\n6=3D=\n"],
+ ["$x70!23\n" => "$x70!23\n"],
+ ["$x70!234\n" => "$x70!234\n"],
+ ["$x70!2345\n" => "$x70!2345\n"],
+ ["$x70!23456\n" => "$x70!23456\n"],
+ ["$x70!234567\n" => "$x70!2345=\n67\n"],
+ ["$x70!23456=\n" => "$x70!2345=\n6=3D\n"],
+
+ # Not allowed to break =XX escapes using soft line break
+ ["$x70===xxxxx" => "$x70=3D=\n=3D=3Dxxxxx=\n"],
+ ["$x70!===xxxx" => "$x70!=3D=\n=3D=3Dxxxx=\n"],
+ ["$x70!2===xxx" => "$x70!2=3D=\n=3D=3Dxxx=\n"],
+ ["$x70!23===xx" => "$x70!23=\n=3D=3D=3Dxx=\n"],
+ ["$x70!234===x" => "$x70!234=\n=3D=3D=3Dx=\n"],
+ ["$x70!2=\n" => "$x70!2=3D\n"],
+ ["$x70!23=\n" => "$x70!23=\n=3D\n"],
+ ["$x70!234=\n" => "$x70!234=\n=3D\n"],
+ ["$x70!2345=\n" => "$x70!2345=\n=3D\n"],
+ ["$x70!23456=\n" => "$x70!2345=\n6=3D\n"],
+ # ^
+ # 70123456|
+ # max
+ # line width
+
+ # some extra special cases we have had problems with
+ ["$x70!2=x=x" => "$x70!2=3D=\nx=3Dx=\n"],
+ ["$x70!2345$x70!2345$x70!23456\n", "$x70!2345=\n$x70!2345=\n$x70!23456\n"],
+
+ # trailing whitespace
+ ["foo \t ", "foo=20=09=20=\n"],
+ ["foo\t \n \t", "foo=09=20\n=20=09=\n"],
+);
+
+} elsif ($IsEBCDIC) {
+
+@tests =
+ (
+ # plain ascii should not be encoded
+ ["", ""],
+ ["quoted printable" =>
+ "quoted printable=\n"],
+
+ # 8-bit chars should be encoded
+ ["v\x47re kj\x9cre norske tegn b\x70r \x47res" =>
+ "v=47re kj=9Cre norske tegn b=70r =47res=\n"],
+
+ # trailing space should be encoded
+ [" " => "=40=40=\n"],
+ ["\tt\t" => "\tt=05=\n"],
+ ["test \ntest\n\t \t \n" => "test=40=40\ntest\n=05=40=05=40\n"],
+
+ # "=" is special an should be decoded
+ ["=30\n" => "=7E30\n"],
+ ["\0\xff0" => "=00=FF0=\n"],
+
+ # Very long lines should be broken (not more than 76 chars
+ ["The Quoted-Printable encoding is intended to represent data that largly consists of octets that correspond to printable characters in the ASCII character set." =>
+ "The Quoted-Printable encoding is intended to represent data that largly con=
+sists of octets that correspond to printable characters in the ASCII charac=
+ter set.=\n"
+ ],
+
+ # Long lines after short lines were broken through 2.01.
+ ["short line
+In America, any boy may become president and I suppose that's just one of the risks he takes. -- Adlai Stevenson" =>
+ "short line
+In America, any boy may become president and I suppose that's just one of t=
+he risks he takes. -- Adlai Stevenson=\n"],
+
+ # My (roderick@argon.org) first crack at fixing that bug failed for
+ # multiple long lines.
+ ["College football is a game which would be much more interesting if the faculty played instead of the students, and even more interesting if the
+trustees played. There would be a great increase in broken arms, legs, and necks, and simultaneously an appreciable diminution in the loss to humanity. -- H. L. Mencken" =>
+ "College football is a game which would be much more interesting if the facu=
+lty played instead of the students, and even more interesting if the
+trustees played. There would be a great increase in broken arms, legs, and=
+ necks, and simultaneously an appreciable diminution in the loss to humanit=
+y. -- H. L. Mencken=\n"],
+
+ # Don't break a line that's near but not over 76 chars.
+ ["$x70!23" => "$x70!23=\n"],
+ ["$x70!234" => "$x70!234=\n"],
+ ["$x70!2345" => "$x70!2345=\n"],
+ ["$x70!23456" => "$x70!23456=\n"],
+ ["$x70!234567" => "$x70!2345=\n67=\n"],
+ ["$x70!23456=" => "$x70!2345=\n6=7E=\n"],
+ ["$x70!23\n" => "$x70!23\n"],
+ ["$x70!234\n" => "$x70!234\n"],
+ ["$x70!2345\n" => "$x70!2345\n"],
+ ["$x70!23456\n" => "$x70!23456\n"],
+ ["$x70!234567\n" => "$x70!2345=\n67\n"],
+ ["$x70!23456=\n" => "$x70!2345=\n6=7E\n"],
+
+ # Not allowed to break =XX escapes using soft line break
+ ["$x70===xxxxx" => "$x70=7E=\n=7E=7Exxxxx=\n"],
+ ["$x70!===xxxx" => "$x70!=7E=\n=7E=7Exxxx=\n"],
+ ["$x70!2===xxx" => "$x70!2=7E=\n=7E=7Exxx=\n"],
+ ["$x70!23===xx" => "$x70!23=\n=7E=7E=7Exx=\n"],
+ ["$x70!234===x" => "$x70!234=\n=7E=7E=7Ex=\n"],
+ ["$x70!2=\n" => "$x70!2=7E\n"],
+ ["$x70!23=\n" => "$x70!23=\n=7E\n"],
+ ["$x70!234=\n" => "$x70!234=\n=7E\n"],
+ ["$x70!2345=\n" => "$x70!2345=\n=7E\n"],
+ ["$x70!23456=\n" => "$x70!2345=\n6=7E\n"],
+ # ^
+ # 70123456|
+ # max
+ # line width
+
+ # some extra special cases we have had problems with
+ ["$x70!2=x=x" => "$x70!2=7E=\nx=7Ex=\n"],
+ ["$x70!2345$x70!2345$x70!23456\n", "$x70!2345=\n$x70!2345=\n$x70!23456\n"],
+
+ # trailing whitespace
+ ["foo \t ", "foo=40=05=40=\n"],
+ ["foo\t \n \t", "foo=05=40\n=40=05=\n"],
+);
+
+} else {
+ die sprintf "Unknown character set: ord('A') == %d\n", ord('A');
+}
+
+$notests = @tests + 16;
+print "1..$notests\n";
+
+$testno = 0;
+for (@tests) {
+ $testno++;
+ ($plain, $encoded) = @$_;
+ if (ord('A') == 193) { # EBCDIC 8 bit chars are different
+ if ($testno == 2) { $plain =~ s/\xe5/\x47/; $plain =~ s/\xe6/\x9c/g; $plain =~ s/\xf8/\x70/; }
+ if ($testno == 7) { $plain =~ s/\xff/\xdf/; }
+ }
+ $x = encode_qp($plain);
+ if ($x ne $encoded) {
+ print "Encode test failed\n";
+ print "Got: '$x'\n";
+ print "Expected: '$encoded'\n";
+ print "not ok $testno\n";
+ next;
+ }
+ $x = decode_qp($encoded);
+ if ($x ne $plain) {
+ print "Decode test failed\n";
+ print "Got: '$x'\n";
+ print "Expected: '$plain'\n";
+ print "not ok $testno\n";
+ next;
+ }
+ print "ok $testno\n";
+}
+
+if ($IsASCII) {
+
+# Some extra testing for a case that was wrong until libwww-perl-5.09
+print "not " unless decode_qp("foo \n\nfoo =\n\nfoo=20\n\n") eq
+ "foo\n\nfoo \nfoo \n\n";
+$testno++; print "ok $testno\n";
+
+# Same test but with "\r\n" terminated lines
+print "not " unless decode_qp("foo \r\n\r\nfoo =\r\n\r\nfoo=20\r\n\r\n") eq
+ "foo\n\nfoo \nfoo \n\n";
+$testno++; print "ok $testno\n";
+
+# Trailing whitespace
+print "not " unless decode_qp("foo ") eq "foo ";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo \n") eq "foo\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x20\nbar\t\x20\n") eq "foo bar\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x20\r\nbar\t\x20\r\n") eq "foo bar\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x20\n") eq "foo ";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x20\r\n") eq "foo ";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x20y\r\n") eq "foo = \t\x20y\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo =xy\n") eq "foo =xy\n";
+$testno++; print "ok $testno\n";
+
+# Test with with alternative line break
+print "not " unless encode_qp("$x70!2345$x70\n", "***") eq "$x70!2345=***$x70***";
+$testno++; print "ok $testno\n";
+
+# Test with no line breaks
+print "not " unless encode_qp("$x70!2345$x70\n", "") eq "$x70!2345$x70=0A";
+$testno++; print "ok $testno\n";
+
+# Test binary encoding
+print "not " unless encode_qp("foo", undef, 1) eq "foo=\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless encode_qp("foo\nbar\r\n", undef, 1) eq "foo=0Abar=0D=0A=\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless encode_qp(join("", map chr, 0..255), undef, 1) eq <<'EOT'; $testno++; print "ok $testno\n";
+=00=01=02=03=04=05=06=07=08=09=0A=0B=0C=0D=0E=0F=10=11=12=13=14=15=16=17=18=
+=19=1A=1B=1C=1D=1E=1F !"#$%&'()*+,-./0123456789:;<=3D>?@ABCDEFGHIJKLMNOPQRS=
+TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~=7F=80=81=82=83=84=85=86=87=88=
+=89=8A=8B=8C=8D=8E=8F=90=91=92=93=94=95=96=97=98=99=9A=9B=9C=9D=9E=9F=A0=A1=
+=A2=A3=A4=A5=A6=A7=A8=A9=AA=AB=AC=AD=AE=AF=B0=B1=B2=B3=B4=B5=B6=B7=B8=B9=BA=
+=BB=BC=BD=BE=BF=C0=C1=C2=C3=C4=C5=C6=C7=C8=C9=CA=CB=CC=CD=CE=CF=D0=D1=D2=D3=
+=D4=D5=D6=D7=D8=D9=DA=DB=DC=DD=DE=DF=E0=E1=E2=E3=E4=E5=E6=E7=E8=E9=EA=EB=EC=
+=ED=EE=EF=F0=F1=F2=F3=F4=F5=F6=F7=F8=F9=FA=FB=FC=FD=FE=FF=
+EOT
+
+print "not " if $] >= 5.006 && (eval 'encode_qp("XXX \x{100}")' || !$@);
+$testno++; print "ok $testno\n";
+
+} elsif ($IsEBCDIC) {
+
+# Some extra testing for a case that was wrong until libwww-perl-5.05
+print "not " unless decode_qp("foo \n\nfoo =\n\nfoo=40\n\n") eq
+ "foo\n\nfoo \nfoo \n\n";
+$testno++; print "ok $testno\n";
+
+# Same test but with "\r\n" terminated lines
+print "not " unless decode_qp("foo \r\n\r\nfoo =\r\n\r\nfoo=40\r\n\r\n") eq
+ "foo\n\nfoo \nfoo \n\n";
+$testno++; print "ok $testno\n";
+
+# Trailing whitespace
+print "not " unless decode_qp("foo ") eq "foo ";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo \n") eq "foo\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x40\nbar\t\x40\n") eq "foo bar\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x40\r\nbar\t\x40\r\n") eq "foo bar\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x40\n") eq "foo ";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x40\r\n") eq "foo ";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo = \t\x40y\r\n") eq "foo = \t\x40y\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo =xy\n") eq "foo =xy\n";
+$testno++; print "ok $testno\n";
+
+# Test with with alternative line break
+print "not " unless encode_qp("$x70!2345$x70\n", "***") eq "$x70!2345=***$x70***";
+$testno++; print "ok $testno\n";
+
+# Test with no line breaks
+print "not " unless encode_qp("$x70!2345$x70\n", "") eq "$x70!2345$x70=15";
+$testno++; print "ok $testno\n";
+
+# Test binary encoding
+print "not " unless encode_qp("foo", undef, 1) eq "foo=\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless encode_qp("foo\nbar\r\n", undef, 1) eq "foo=15bar=0D=15=\n";
+$testno++; print "ok $testno\n";
+
+print "not " unless encode_qp(join("", map chr, 0..255), undef, 1) eq <<'EOT'; $testno++; print "ok $testno\n";
+=00=01=02=03=04=05=06=07=08=09=0A=0B=0C=0D=0E=0F=10=11=12=13=14=15=16=17=18=
+=19=1A=1B=1C=1D=1E=1F=20=21=22=23=24=25=26=27=28=29=2A=2B=2C=2D=2E=2F=30=31=
+=32=33=34=35=36=37=38=39=3A=3B=3C=3D=3E=3F =41=42=43=44=45=46=47=48=49=4A.<=
+(+|&=51=52=53=54=55=56=57=58=59!$*);^-/=62=63=64=65=66=67=68=69=6A,%_>?=70=
+=71=72=73=74=75=76=77=78`:#@'=7E"=80abcdefghi=8A=8B=8C=8D=8E=8F=90jklmnopqr=
+=9A=9B=9C=9D=9E=9F=A0~stuvwxyz=AA=AB=AC=AD=AE=AF=B0=B1=B2=B3=B4=B5=B6=B7=B8=
+=B9=BA=BB=BC=BD=BE=BF{ABCDEFGHI=CA=CB=CC=CD=CE=CF}JKLMNOPQR=DA=DB=DC=DD=DE=
+=DF\=E1STUVWXYZ=EA=EB=EC=ED=EE=EF0123456789=FA=FB=FC=FD=FE=FF=
+EOT
+
+print "not " if $] >= 5.006 && (eval 'encode_qp("XXX \x{100}")' || !$@);
+$testno++; print "ok $testno\n";
+
+}
+
diff --git a/cpan/MIME-Base64/t/unicode.t b/cpan/MIME-Base64/t/unicode.t
new file mode 100644
index 0000000000..b09a328b3c
--- /dev/null
+++ b/cpan/MIME-Base64/t/unicode.t
@@ -0,0 +1,33 @@
+BEGIN {
+ unless ($] >= 5.006) {
+ print "1..0\n";
+ exit(0);
+ }
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+}
+
+print "1..2\n";
+
+require MIME::Base64;
+
+eval {
+ my $tmp = MIME::Base64::encode(v300);
+ print "# enc: $tmp\n";
+};
+print "# $@" if $@;
+print "not " unless $@;
+print "ok 1\n";
+
+require MIME::QuotedPrint;
+
+eval {
+ my $tmp = MIME::QuotedPrint::encode(v300);
+ print "# enc: $tmp\n";
+};
+print "# $@" if $@;
+print "not " unless $@;
+print "ok 2\n";
+
diff --git a/cpan/MIME-Base64/t/warn.t b/cpan/MIME-Base64/t/warn.t
new file mode 100644
index 0000000000..4ea57df988
--- /dev/null
+++ b/cpan/MIME-Base64/t/warn.t
@@ -0,0 +1,68 @@
+#!perl -w
+
+BEGIN {
+ if ($ENV{'PERL_CORE'}){
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+}
+
+BEGIN {
+ eval {
+ require warnings;
+ };
+ if ($@) {
+ print "1..0\n";
+ print $@;
+ exit;
+ }
+}
+
+use strict;
+use MIME::Base64 qw(decode_base64);
+
+print "1..1\n";
+
+use warnings;
+
+my @warn;
+$SIG{__WARN__} = sub { push(@warn, @_) };
+
+warn;
+my $a;
+$a = decode_base64("aa");
+$a = decode_base64("a===");
+warn;
+$a = do {
+ no warnings;
+ decode_base64("aa");
+};
+$a = do {
+ no warnings;
+ decode_base64("a===");
+};
+warn;
+$a = do {
+ local $^W;
+ decode_base64("aa");
+};
+$a = do {
+ local $^W;
+ decode_base64("a===");
+};
+warn;
+
+for (@warn) {
+ print "# $_";
+}
+
+print "not " unless join("", @warn) eq <<"EOT"; print "ok 1\n";
+Warning: something's wrong at $0 line 31.
+Premature end of base64 data at $0 line 33.
+Premature padding of base64 data at $0 line 34.
+Warning: something's wrong at $0 line 35.
+Premature end of base64 data at $0 line 38.
+Premature padding of base64 data at $0 line 42.
+Warning: something's wrong at $0 line 44.
+Warning: something's wrong at $0 line 53.
+EOT