NAME

MySQL::Slurp::Writer - Adds buffering / locking writing to MySQL::Slurp

SYNOPSIS

my $writer = MySQL::Slurp::Writer->new( ... );

$writer->print( "records\tto\tprint\n" );

DESCRIPTION

This module wraps IO::File to provide a thread-safe method for writing to a file handles. The method is simple ... writing is buffered; the file handle is locked; the output is written to the file handle, the lock is released.

METHODS

new

Create a new MySQL::Slurp::Writer object

buffer

The size of the buffer. The default is 1 record, i.e. no buffering.

filename

The filename of the IO::File object

print

Write arguments to the buffer and if the buffer is full, commit to the file handle

flush

Flush the buffer

close

Closes the writing file handle

lock_ex

Block until an exclusive lock can be made on the file handle

lock_un

Release the lock

TODO

- item Generalize to object independent of MySQL::Slurp

SEE ALSO

MySQL::Slurp, IO::File, Moose

AUTHOR

Christopher Brown, <ctbrown@cpan.org<gt>

http://www.opendatagroup.com

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Open Data

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.8 or, at your option, any later version of Perl 5 you may have available.