NAME

Convert::UUlib - Perl interface to the uulib library (a.k.a. uudeview/uuenview).

SYNOPSIS

use Convert::UUlib;

DESCRIPTION

Read the file uulibdoc.dvi.gz and the example-decoder source. Sorry - more to come once people use me ;)

SMALL EXAMPLE DECODER

The following code excerpt is a minimal decoder program. It reads all files given on the commandline and decodes any files in it.

use Convert::UUlib ':all';

LoadFile($_) for @ARGV;

for($i=0; $uu=GetFileListItem($i); $i++) {
   $uu->decode if $uu->state & FILE_OK;
}

LARGE EXAMPLE DECODER

This is the file example-decoder from the distribution, put here instead of more thorough documentation.

# decode all the files in the directory uusrc/ and copy
# the resulting files to uudst/

use Convert::UUlib ':all';

sub namefilter {
   my($path)=@_;
   $path=~s/^.*[\/\\]//;
   $path;
}

sub busycb {
   my($action,$curfile,$partno,$numparts,$percent,$fsize)=@_;
   $_[0]=straction($action);
   print "busy_callback(",join(",",@_),")\n";
   0;
}

SetOption (OPT_IGNMODE, 1);
SetOption (OPT_VERBOSE, 1);

# show the three ways you can set callback functions
SetFNameFilter (\&namefilter);

SetBusyCallback ("busycb",333);

SetMsgCallback (sub {
   my($msg,$level)=@_;
   print uc(strmsglevel($_[1])),": $msg\n";
});

for(<uusrc/*>) {
   my($retval,$count)=LoadFile ($_,$_,1);
   print "file($_), status(",strerror($retval),") parts($count)\n";
}

SetOption (OPT_SAVEPATH, "uudst/");

$i=0;
while($uu=GetFileListItem($i)) {
   $i++;
   print "file nr. $i";
   print " state ",$uu->state;
   print " mode ",$uu->mode;
   print " uudet ",strencoding($uu->uudet);
   print " size ",$uu->size;
   print " filename ",$uu->filename;
   print " subfname ",$uu->subfname;
   print " mimeid ",$uu->mimeid;
   print " mimetype ",$uu->mimetype;
   print "\n";

   # print additional info about all parts
   for($uu->parts) {
      while(my($k,$v)=each(%$_)) {
         print "$k > $v, ";
      }
      print "\n";
   }

   $uu->decode_temp;
   print " temporarily decoded to ",$uu->binfile,"\n";
   $uu->remove_temp;

   print strerror($uu->decode);
   print " saved as uudst/",$uu->filename,"\n";
}

print "cleanup...\n";

CleanUp();

Exported constants

Action code constants:

ACT_COPYING
ACT_DECODING
ACT_ENCODING
ACT_IDLE
ACT_SCANNING

File status flags:

FILE_DECODED
FILE_ERROR
FILE_MISPART
FILE_NOBEGIN
FILE_NODATA
FILE_NOEND
FILE_OK
FILE_READ
FILE_TMPFILE

Message severity levels:

MSG_ERROR
MSG_FATAL
MSG_MESSAGE
MSG_NOTE
MSG_PANIC
MSG_WARNING

Options:

OPT_BRACKPOL
OPT_DEBUG
OPT_DESPERATE
OPT_DUMBNESS
OPT_ENCEXT
OPT_ERRNO
OPT_FAST
OPT_IGNMODE
OPT_IGNREPLY
OPT_OVERWRITE
OPT_PREAMB
OPT_PROGRESS
OPT_SAVEPATH
OPT_TINYB64
OPT_USETEXT
OPT_VERBOSE
OPT_VERSION

Error/Result codes:

RET_CANCEL
RET_CONT
RET_EXISTS
RET_ILLVAL
RET_IOERR
RET_NODATA
RET_NOEND
RET_NOMEM
RET_OK
RET_UNSUP

Encoding types:

B64ENCODED
BH_ENCODED
PT_ENCODED
QP_ENCODED
XX_ENCODED
UU_ENCODED

Exported functions

int	  Initialize		() ;
int	  GetOption		() ;
int	  SetOption		() ;
char *	  strerror		() ;
int	  SetMsgCallback	() ;
int	  SetBusyCallback	() ;
int	  SetFileCallback	() ;
int	  SetFNameFilter	() ;
char *	  FNameFilter		() ;
int	  LoadFile		() ;
uulist *   GetFileListItem	() ;
int	  RenameFile		() ;
int	  DecodeToTemp		() ;
int	  RemoveTemp		() ;
int	  DecodeFile		() ;
int	  InfoFile		() ;
int	  Smerge		() ;
int	  CleanUp		() ;
int	  QuickDecode		() ;
int	  EncodeMulti		() ;
int	  EncodePartial	() ;
int	  EncodeToStream	() ;
int	  EncodeToFile		() ;
int	  E_PrepSingle		() ;
int	  E_PrepPartial	() ;

AUTHOR

Marc Lehmann <pcg@goof.com>, the uulib library was written by Frank Pilhofer <fp@informatik.uni-frankfurt.de>.

SEE ALSO

perl(1), uudeview homepage at http://www.uni-frankfurt.de/~fp/uudeview/.