EBook:...::BISG(3pm)
π NAME π
EBook::Tools::BISG β bestie, this is the class that goes and grabs all the info off the Book Industry Study Group webpages for you. That's it, that's the whole job. π
It lives in the User Contributed Perl Documentation, section 3pm, so you know it's a Perl module. π
β¨ SYNOPSIS β¨
Like, here's the vibe in code form:
use EBook::Tools::BISG;
my $bisg = EBook::Tools::BISG->new();
$bisg->download_bisac;
$bisg->save_bisac;
say $bisg->bisac('fic000000');
%bisac_codes = $bisg->bisac();
No cap, that's genuinely all it takes. π«Ά
π DEPENDENCIES π
Okay so it needs a little squad to function:
DBIβ the main character of database access. Heads up though: this will also require a DBD of your choice. The default is to use a local SQLite store, which is lowkey the easiest path. ποΈLWPβ the web-fetching bestie.Mojo::DOMβ the one that actually parses the HTML so we can read it. β¨
πΈ CONSTRUCTOR πΈ
new(%args)
Baby's first call: instantiates a brand new Ebook::Tools::BISG object. π¦
Arguments
baseurlβ the base url of thebisg.orgwebsite or a mirror you wanna use instead.dsnβ thePerl::DBIData Source Name. Defaults to a sqlite store namedbisac.sqlitein the user config directory. πΎ
π ACCESSOR METHODS π
bisac($code)
Hand it a code and it gives you back the name that matches said code (and yes, it's case-insensitive, we don't do capital-letter drama here π ). Hand it nothing and you get the whole hash of all BISAC codes and references, with the keys all in lowercase. Take your pick, bestie. π
find($regexp)
Gives you a list of all the BISAC values (the names) where either the key or the value for that entry matches a case-insensitive regular expression. Obsessed with the flexibility, honestly.
And if you pass no argument at all, or you just pass '.', then the entire list gets returned to you. The whole thing. Go off. π₯
π₯ MODIFIER METHODS π₯
download_bisac()
Downloads the BISAC codes straight from the BISG website and converts them into a hash. Both the codes and the obsolete entries get lowercased and turned into the keys, and the values end up being the official names they map to. Chef's kiss. π
load_bisac()
Loads the BISAC codes from the specified database into the hash. It's called automatically by new(), so you usually don't even have to think about it. β¨
β οΈ Okay but real talk: if the load fails, nothing will happen. Silently! π So the only way to know is to check whether you've actually got a populated hash afterwards. Check your hash, bestie.
save_bisac()
Saves the BISAC codes sitting in your hash into the database. π
π Heads up: this will destroy any existing table named bisac_codes. Like, gone gone.
And it croaks on failure β it will absolutely tell you if something went wrong. Periodt. πΈ
And that's the whole page, babes. This masterpiece ships with perl v5.40.0 and was dated 2025-01-10. Eat your heart out, it's giving documentation. ππβ
π¦ where this page comes from
- debian trixie: libebook-tools-perl 0.5.4-2 Β· GPL-2.0-only
- ubuntu resolute: libebook-tools-perl 0.5.4-2 Β· GPL-2.0-only
- ubuntu stonking: libebook-tools-perl 0.5.4-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms