EBook:...Reader(3pm)

πŸ“¦
version 0.5.4 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ NAME ✨

EBook::Tools::MSReader β€” bestie, this is the lil helper squad for working with Microsoft Reader (.lit) e-books πŸ’–


🌸 SYNOPSIS 🌸

use EBook::Tools::MSReader qw(find_convertlit find_convertlit_keys
                              system_convertlit);
$EBook::Tools::MSReader::convertlit_cmd = '/opt/convertlit/clit';
$EBook::Tools::MSReader::convertlit_keys = '/opt/convertlit/keys.txt';

my $convertlit = find_convertlit();
my $keyfile = find_convertlit_keys();
system_convertlit(infile => 'myfile.lit',
                  dir => 'myfile-unpacked');

πŸŽ€ PROCEDURES πŸŽ€

Okay so here's the tea: every single procedure is exportable, but none of them get exported by default. You gotta ask for them by name, no freeloaders πŸ’…

πŸ” find_convertlit()

This one goes on a lil scavenger hunt for the convertlit executable πŸ”Žβœ¨ It does that by running a test execution on the predicted locations (yes, including just checking PATH) and by peeking inside the EBook::Tools user configuration directory (see "userconfigdir()" in EBook::Tools).

It hands back the system command that got used for a successful invocation, or undef if literally nothing worked 😭

Heads up bestie: it uses the package variable $convertlit_cmd as its first guess, and then sets that variable to the return value too β€” so it remembers what it found 🫢

πŸ”‘ find_convertlit_keys($filename)

The key-hunting sibling πŸ—οΈ It goes looking for the convertlit keys.txt file by checking the predicted filenames, in both the current working directory and the EBook::Tools user configuration directory (see "userconfigdir()" in EBook::Tools).

If you pass in $filename, then the file basename-keys.txt also gets checked in both of those locations.

Returns the name of the first file it finds, or undef if it came up empty πŸ’€

Oh and same deal as before: it uses the package variable $convertlit_keys as its first guess, and sets that variable to the return value as well πŸ’–

βš™οΈ system_convertlit(%args)

This is the main character πŸ‘‘ It runs convertlit to extract or downconvert a MS Reader .lit file. Both find_convertlit() and find_convertlit_keys() get called up to locate the necessary helper files, because it does not do its own searching.

Returns the return value from convertlit β€” or undef if convertlit or the input file could not be found, or if neither output file nor directory is specified πŸ™ˆ

πŸ“ Arguments

  • infile β€” the input filename. If it's not specified or it's invalid, this procedure croaks. Not a vibe. Specify it.
  • outfile β€” the output filename. If you hand this one over, convertlit will do a downconversion.
  • dir β€” the output directory. If this is specified and outfile is not, convertlit will do an extraction. And if you specify both this and outfile, convertlit downconverts and drops the downconverted file into the directory you named. Iconic, honestly 🌈
  • keyfile β€” the location of the keys.txt file holding the encryption keys, if you've got it. This is only required when the .lit file is DRM-protected and the package variable $convertlit_keys doesn't already point at the correct file πŸ”

πŸ’€ BUGS AND LIMITATIONS πŸ’€

  • All handling happens through ConvertLIT as an external helper. Native Perl code may eventually be written to handle non-DRMed extraction. (Someday, bestie, someday πŸ¦‹)
  • Unit tests are unwritten 😭 (we know. we KNOW.)

πŸ‘‘ AUTHOR πŸ‘‘

Zed Pobre <zed@debian.org>


Copyright 2008 Zed Pobre

Licensed to the public under the terms of the GNU GPL, version 2.

ConvertLIT (not included) is copyright 2002, 2003 Dan A. Jackson, and licensed under the terms of the GNU GPL, version 2 or later.


Okay that's the whole page, you ate it up, go unpack some e-books πŸŽ€βœ¨ This lil doc is from perl v5.40.0, dated 2025-01-10, and it's the EBook::Tools::MSReader(3pm) manual page β€” mwah, ily, bye πŸ’œ

πŸ“¦ where this page comes from