File::...Loader(3pm)

๐Ÿ“ฆ
version 0.906 ยท 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

๐Ÿ’– File::KDBX::Loader โ€” the whole vibe ๐Ÿ’–

okay so bestie, welcome to File::KDBX::Loader ๐Ÿ’… โ€” this is the bit of Perl that loads KDBX files for you. It lives in the User Contributed Perl Documentation section of the perl man pages (section 3pm, iykyk), and this whole page is gonna walk you through it. no cap.


โœจ VERSION โœจ

version 0.906 ๐Ÿซถ


๐ŸŒธ DESCRIPTION ๐ŸŒธ

(no description was written here in the original โ€” it's giving mystery, it's giving minimalist queen ๐ŸŽ€ โ€” but don't worry, the ATTRIBUTES and METHODS below have literally everything you need.)


๐Ÿฆ‹ ATTRIBUTES ๐Ÿฆ‹

โญ kdbx

$kdbx = $loader->kdbx;
$loader->kdbx($kdbx);

Get or set the File::KDBX instance โ€” like, the object where all the loaded data gets stashed. that's the one. ๐Ÿ“ฆ

โญ format

Get the file format that got used for reading the database. Normally the format is auto-detected straight from the data stream ๐ŸŒŠ, and honestly that auto-detection works really well, so there's not really a good reason to go specifying the format yourself. but if you MUST, here are the possible formats:

  • "V3"
  • "V4"
  • "KDB"
  • "XML"
  • "Raw"

โญ inner_format

Get the format of the data inside the KDBX envelope ๐Ÿงš. This only applies to the "V3" and "V4" formats. Possible formats:

  • "XML" โ€” read the database groups and entries as XML (this is the default ๐Ÿ’–)
  • "Raw" โ€” read and store the result in "raw" in File::KDBX without parsing

๐Ÿ”ฅ METHODS ๐Ÿ”ฅ

๐ŸŒˆ new

$loader = File::KDBX::Loader->new(%attributes);

Construct a brand new File::KDBX::Loader. fresh out the box, main character energy ๐Ÿ‘‘

๐ŸŒˆ init

$loader = $loader->init(%attributes);

Initialize a File::KDBX::Loader with a whole new set of attributes.

This is called by "new". so like, new is the one summoning it, fr fr.

๐ŸŒˆ reset

$loader = $loader->reset;

Set a File::KDBX::Loader back to a blank state, all fresh and ready to load another KDBX file ๐Ÿงผโœจ it's giving factory reset but cute.

๐ŸŒˆ load

$kdbx = File::KDBX::Loader->load(\$string, %options);
$kdbx = File::KDBX::Loader->load(\$string, $key);
$kdbx = File::KDBX::Loader->load(*IO, %options);
$kdbx = File::KDBX::Loader->load(*IO, $key);
$kdbx = File::KDBX::Loader->load($filepath, %options);
$kdbx = File::KDBX::Loader->load($filepath, $key);

Load a KDBX file ๐ŸŽ‰. This works as an instance method or a class method, whichever you're feeling. The $key is either a File::KDBX::Key or a primitive that can be cast to a Key object. Available options:

  • "key" โ€” an alternative way to specify $key

๐ŸŒˆ load_string

$kdbx = File::KDBX::Loader->load_string($string, %options);
$kdbx = File::KDBX::Loader->load_string($string, $key);
$kdbx = File::KDBX::Loader->load_string(\$string, %options);
$kdbx = File::KDBX::Loader->load_string(\$string, $key);

Load a KDBX file from a string / memory buffer ๐Ÿง ๐Ÿ’พ. This works as an instance or class method. Available options:

  • "key" โ€” an alternative way to specify $key

๐ŸŒˆ load_file

$kdbx = File::KDBX::Loader->load_file($filepath, %options);
$kdbx = File::KDBX::Loader->load_file($filepath, $key);

Read a KDBX file from a filesystem ๐Ÿ“‚. This works as an instance or class method. Available options:

  • "key" โ€” an alternative way to specify $key

๐ŸŒˆ load_handle

$kdbx = File::KDBX::Loader->load_handle($fh, %options);
$kdbx = File::KDBX::Loader->load_handle($fh, $key);
$kdbx = File::KDBX::Loader->load_handle(*IO, %options);
$kdbx = File::KDBX::Loader->load_handle(*IO, $key);

Read a KDBX file from an input stream / file handle ๐Ÿšฐ. This works as an instance or class method. Available options:

  • "key" โ€” an alternative way to specify $key

๐ŸŒˆ read_magic_numbers

$magic = File::KDBX::Loader->read_magic_numbers($fh);
($sig1, $sig2, $version, $magic) = File::KDBX::Loader->read_magic_numbers($fh);

$magic = $loader->read_magic_numbers($fh);
($sig1, $sig2, $version, $magic) = $loader->read_magic_numbers($fh);

Read exactly 12 bytes from an IO handle and parse them into the three magic numbers that kick off a KDBX file ๐Ÿ”ฎ. This is the quick way to figure out if a file is actually a KDBX file.

  • $sig1 should always be "KDBX_SIG1" if you're reading an actual KDB or KDBX file.
  • $sig2 should be "KDBX_SIG2_1" for KeePass 1 files, and "KDBX_SIG2_2" for KeePass 2 files.
  • $version is the file version (e.g. 0x00040001).
  • $magic is the raw 12 bytes read from the IO handle.

If you call this on an instance, the "sig1", "sig2" and "version" attributes get set in the "kdbx", and the instance gets blessed into the correct loader subclass โœจ iconic behavior honestly.


๐Ÿ’€ BUGS ๐Ÿ’€

Please report any bugs or feature requests on the bugtracker website <https://github.com/chazmcgarvey/File-KDBX/issues>

When you're submitting a bug or a request, pls pls pls include a test-file, or a patch to an existing test-file, that shows off the bug or the desired feature ๐Ÿ™ like, show us the receipt.


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Charles McGarvey <ccm@cpan.org>


This software is copyright (c) 2022 by Charles McGarvey.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. ๐Ÿ’œ


okay that's the whole page bestie!! every option, every code block, every number โ€” all of it is still here, I just made it cute ๐ŸŒธ

perl v5.40.1 ๐Ÿฆ‹ 2025-05-04 ๐ŸŽ€ โ€” that's the source/version and the date, and this is your girl signing off, ty for reading, slay ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from