Convert-UU

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN

	* address RT#4926: followed a suggestion by DJBURKE to use
	UNIVERSAL::isa instead of ref() to check for IO::Handle

2003-02-08  Andreas J. Koenig  <andreas.koenig@anima.de>

	* lib/Convert/UU.pm: Integrated a patch sent by Silvester Erdeg to
	accept filenames with spaces in them. Apologies to him and all the
	others who sent in patch suggestions that it took so long to mak a
	new release.

	* Pierre Vanhove sent me an example file that was decoded by
	uudecode with error message "Short file" which then resulted in
	garbage bytes at the end of the decoded file. Appending the
	unneeded line C< ` > before the C< end > tag seems to fix this
	problem.

1999-05-10  Andreas J. Koenig  <andreas.koenig@anima.de>

	* Harald Joerg C<E<lt>Harald.Joerg@mch.sni.de$<gt>> sent me a
	patch to add binmode to the filehandles that are used, so the
	whole thing works on Windows.

	* Modernized the Makefile.PL to use fixin() instead of writing the
	EXE_FILES "by hand".

1997-02-07  Andreas J. Koenig  <andreas.koenig@anima.de>

	* Further investigation of the warning I "fixed" yesterday. Added
	tests for a trailing empty string in the last line of the
	uuencoded string and for a zero in the last line of the uudecoded
	string. Found the bug in the code that skipped lines starting with
	a "#". Allowing such lines fixed a long standing bug.

1997-02-06  Andreas J. Koenig  <andreas.koenig@anima.de>

	* Thanks to Kurtis D. Rader <krader@sequent.com> who describes
	that a uuencoded chunk that consists of nothing but backtick
	triggers a "Use of uninitialized variable" warning. Although I'd
	like to see it as a bug in perl this version takes precautions to
	avoid the warning.

README  view on Meta::CPAN

    * uuencode
        uuencode() takes as the first argument a string that is to be
        uuencoded. Note, that it is the string that is encoded, not a
        filename. Alternatively a filehandle may be passed that must be
        opened for reading. It returns the uuencoded string including
        "begin" and "end". Second and third argument are optional and
        specify filename and mode. If unspecified these default to
        "uuencode.uu" and 644.

    * uudecode
        uudecode() takes a string as argument which will be uudecoded. If
        the argument is a filehandle this handle will be read instead. If it
        is a reference to an ARRAY, the elements are treated like lines that
        form a string. Leading and trailing garbage will be ignored. The
        function returns the uudecoded string for the first begin/end pair.
        In array context it returns an array whose first element is the
        uudecoded string, the second is the filename and the third is the
        mode.

EXPORT
    Both uudecode and uuencode are in @EXPORT_OK.

AUTHOR
    Andreas Koenig "ANDK@cpan.org". With code integrated that was posted to
    USENET from Hans Mulder and Randal L. Schwartz.

SEE ALSO

lib/Convert/UU.pm  view on Meta::CPAN


uuencode() takes as the first argument a string that is to be
uuencoded. Note, that it is the string that is encoded, not a
filename. Alternatively a filehandle may be passed that must be opened
for reading. It returns the uuencoded string including C<begin> and
C<end>. Second and third argument are optional and specify filename and
mode. If unspecified these default to "uuencode.uu" and 644.

=item * uudecode

uudecode() takes a string as argument which will be uudecoded. If the
argument is a filehandle this handle will be read instead. If it is a
reference to an ARRAY, the elements are treated like lines that form a
string. Leading and trailing garbage will be ignored. The function
returns the uudecoded string for the first begin/end pair. In array
context it returns an array whose first element is the uudecoded
string, the second is the filename and the third is the mode.

=back

=head1 EXPORT

Both uudecode and uuencode are in @EXPORT_OK.

=head1 AUTHOR

puudecode  view on Meta::CPAN

#!/usr/local/perl5.002_01/bin/perl

use strict;
use Convert::UU 'uudecode';
die "Usage: $0 file\n" unless @ARGV==1;
open F, $ARGV[0] or die "Couldn't open $ARGV[0]: $!";
my($uudecoded_string,$file,$mode) = uudecode(\*F);
open F, ">$file" or die "Can't open >$file: $!";
binmode(F);
print F $uudecoded_string;
close F;
chmod oct($mode), $file;

__END__

=head1 NAME

 puudecode - perl replacement for uudecode

=head1 SYNOPSIS

 puudecode inputfile

=head1 DESCRIPTION

Uudecode reads a uuencoded inputfile and writes the decoded string to
the file named in the uuencoded string. It changes the permissions to
the mode given in the uuencoded string.

=head1 BUGS

This implementation is much slower than most uudecode programs written
in C. Its primary intention is to allow quick testing of the
underlying Convert::UU module.

=head1 SEE ALSO

t/ext-uu.t  view on Meta::CPAN

Subject: Re: Convert::UU

>>>>> On Thu, 6 Feb 2003 13:54:16 +0100 (CET), Pierre Vanhove <pierre.vanhove@xxxxxxx> said:

  > Dear Ms Koenig,
  > i'm trying to use your perl routine UU.pm but i always get the "Short
  > file" error message when decode the uufile which a linux or unix uudecode
  > script.

  > I want to uuencode some web uploaded file and have it send by email. The
  > file has to be uudecoded by the people who receive the file, and therefore
  > are not always using the uudecode of your routine.

  > How can i avoid this error message.

I do not know. Please try an external uudecode program instead of mine
and see if that works better.

- If it does, please send me the problematic file, describe what
  exactly you do with it and how external uudecode and my module
  differ.

t/ext-uu.t  view on Meta::CPAN

} else {
  print "ok 1\n";
}
if (-f "t1.puu.txt") {
  print "ok 2\n";
} else {
  print "not ok 2 # no output file t1.puu.txt written\n";
}
open F, "t1.puu.txt" or die $!;
local $/;
my $decoded = <F>;
close F;
if ($decoded eq $string) {
  print "ok 3\n";
} else {
  print "not ok 3\n";
}



( run in 0.351 second using v1.01-cache-2.11-cpan-26ccb49234f )