NAME

Zack::File2Text::Cached

DESCRIPTION

The digest is not of the text stored. The digest is of what we got the text *from*. This is meant to be used via Zack module/namespace. Private.

METHODS

new()

new({ dbh => $dbh });

file2text()

Argument is abs path to file on disk. If not cached, will regenerate using Zack::File2Text.

$self->file2text('/path/to/file.pdf');

If it returns nothing, there might not be an extractor for the filetype. Check $Zack::File2Text::errstr

Returns text cached.

get()

Argument is sum. Returns text cached.

my $text = $self->get('87c1e9938cd60077f3cdfbda765d8695');
my $text = $self->get('./file.txt');

set()

Argument is sum and text.

$self->set('87c1e9938cd60077f3cdfbda765d8695','text content');
$self->set('./file.txt','text content');

delete()

Argument is sum.

$self->delete('87c1e9938cd60077f3cdfbda765d8695');   
$self->delete('./file.txt');

exists()

Argument is sum. Returns boolean.

$self->exists('87c1e9938cd60077f3cdfbda765d8695');   
$self->exists('./file.txt');

records_count()

Returns count of records.

DEBUG ETC

Debug on:

$Zack::File2Text::Cached::DEBUG = 1;

Table name:

$Zack::File2Text::Cached::TABLE_NAME;

WHAT IS SUM AND WHAT IS TEXT

Sum is a md5 sum hex digest, 32 chars long, as output by cli gnu md5sum utility.

Text is text content extracted from a source image or html page, etc.

CAVEATS

For the methods that take a sum as argument, you can optionally provide a file path as argument, and we try to use md5sum to get the sum. This is for covenience.

If your output is larger then 1 meg for a file, you will need to change the max_allowed_packet_size in your mysqld server.

# locate my.cnf

Add a line that says

max_allowed_packet=5M

Restart the daemon

# /etc/init.d/mysqld restart

The default is 1

SEE ALSO

Zack zack.conf

AUTHOR

Leo Charre leocharre at cpan dot org

COPYRIGHT

Copyright (c) Leo Charre. All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms and conditions as Perl itself.

This means that you can, at your option, redistribute it and/or modify it under either the terms the GNU Public License (GPL) version 1 or later, or under the Perl Artistic License.

See http://dev.perl.org/licenses/

DISCLAIMER

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Use of this software in any way or in any form, source or binary, is not allowed in any country which prohibits disclaimers of any implied warranties of merchantability or fitness for a particular purpose or any disclaimers of a similar nature.

IN NO EVENT SHALL I BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION (INCLUDING, BUT NOT LIMITED TO, LOST PROFITS) EVEN IF I HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE