Noah Petherbridge > Archive-Tyd-0.02 > Archive::Tyd

Download:
Archive-Tyd-0.02.zip

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Archive::Tyd - Perl extension for simple file archiving.

SYNOPSIS ^

  use Archive::Tyd;

  my $tyd = new Archive::Tyd (password => 'secret password');

  # Load an archive.
  $tyd->openArchive ("./archive.tyd");

  # Add a file.
  $tyd->addFile ("./secret image.jpg");

  # Write the archive.
  $tyd->writeArchive ("./archive.tyd");

  # Read the secret rules.
  my $rules = $tyd->readFile ("rules.txt");

DESCRIPTION ^

Tyd is a simple archiving algorith for merging multiple files together and encrypting the results, hence a password-protected archive.

Tyd Does: Reading and writing of encrypted Tyd archives and file operations within.

Tyd Does: Load all files into memory. Tyd is not good as a storage device for a large quanitity of large files. Tyd is best for keeping small text files and graphics together (maybe to keep a spriteset and definitions for a game?)

Tyd Does Not: support directories within the archive, compression of files, and many other things that WinZip and GZip support.

METHODS ^

new (ARGUMENTS)

Creates a new Tyd object. You can pass in defaults here (such as password and debug).

password (PASSWORD)

(Re)define the password to be used. The default password is 'default'.

openArchive (FILE)

Open the archive and decrypt it with the password. You can load multiple archives with one object, and even change the password between each one.

writeArchive (FILE)

Writes all the files to the archive using the current password.

addFile (FILEPATH)

Adds FILEPATH to the archive. The file will later be called by its file name, not the whole path (i.e. just "readme.txt", not "C:/secret folder/readme.txt")

deleteFile (FILENAME)

Delete the file from the archive.

readFile (FILENAME)

Read the file. It will return the binary data of the file (which you can then save to another file or whatever).

contents

Returns an array of each file in the archive.

filename (FILEPATH) *Internal

Takes a file path and returns its name

cipher ([FORCE]) *Internal

Creates the ciphering object. Supply FORCE for it to recreate the object forcefully (used when you call the password method to change the password).

WHY ^

I made this module to use with games I make which will allow users to create their own quests and store ALL of their data (maps, sound effects, tilesets, etc) into a single, password-protected file.

This module was not meant to compress files in any way. The resulting archive should be little more than the original size of all the files archived inside of it. This algorithm is only for tying files together and password protecting them.

ALGORITHM ^

The algorithm is quite simple. When not encrypted, the archive file would read like this:

  filename::data
  filename::data
  filename::data
  ...

Once the unencrypted file is ready, the entire thing is encrypted using Crypt::CipherSaber with the password provided and written to the archive.

CHANGES ^

  Version 0.02
  - Fixed some major bugs. In 0.01 version, reading an archive Tyd file and then
    re-archiving it from the files in-memory, would for some reason corrupt the file.
    This has been repaired.
  - Carriage Returns are now filtered in and out correctly.
  - Included Tydra--a Perl/Tk interface to Tyd Archive Viewing.

  Version 0.01
  - Initial Release

SEE ALSO ^

Crypt::CipherSaber

AUTHOR ^

C. J. Kirsle, <kirsle "@" rainbowboi.com>

COPYRIGHT AND LICENSE ^

Copyright (C) 2005 by C. J. Kirsle

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: