XBase::Base(3pm)
β¨ NAME β¨
XBase::Base β the base input/output module for the XBase suite, and it's literally the backbone bestie π
Okay so real talk, this page is from the User Contributed Perl Documentation collection, and it's giving very much "infrastructure module, not a vibe for casual users." Let's get into it.
πΈ SYNOPSIS πΈ
You don't call this one directly, no cap β it comes in sideways:
Used indirectly, via XBase or XBase::Memo.
π¦ DESCRIPTION π¦
So XBase::Base is the catch-all I/O girlie for all the other XBase classes. It handles all the file-reading and file-writing drama so the other classes don't have to. This module is for people who are out here building extra XBase classes and methods β the devs, the extenders, the main characters of subclassing.
If you're just a regular user of the XBase(3) module, there is genuinely nothing interesting in here for you. Not a single crumb. Go home bestie. π
One thing you do need to know: methods in XBase::Base return nothing (undef) when they hit an error, and you can go grab the actual error message with the errstr method. That's your receipts. π§Ύ
Methods are:
newβ the constructor, the origin story. It creates the object, and if you hand it a file name, it opens that file too. β¨openβ opens the file, then uses the methodread_headerto read the header and set up the object's data structure. Heads up:read_headershould be defined in the derived class β there is no default, so if you didn't write it, that's on you. πcloseβ closes the file. It does not destroy the object. The object lives on. Iconic, honestly. πdropβ unlinks the file. Bye bye file. π«Άcreate_fileβ creates a file with the given name. The second parameter is optional, and it's the permission specification for the file. π
Now, the reading/writing methods have some expectations, and here's the tea: they assume the file has a header of length header_len bytes (which is possibly 0), and after that, records of length record_len. Both of these values should be set by the read_header method. So like, set them. Don't be weird about it. π
seek_to,seek_to_recordβ seeks to an absolute position, or to the start of the record. Pick your destination, babe. πread_record,read_fromβ reads data from a specified position (that's the offset) or from a given record. The second parameter is the length to read β it's optional forread_record. And get this: that length can be negative, and in that case the read will not complain if the file is shorter than requested. Lowkey forgiving, highkey useful. πwrite_to,write_recordβ writes data to an absolute position, or to a specified record position. Important: the data is not padded torecord_len, it's just written out as-is. No padding, no filler, no extra fluff. Periodt. βοΈ
General locking methods are locksh, lockex and unlock. These call _locksh, _lockex and _unlock, which can be redefined to allow any way of locking β not just the default flock. So you've got options, diva. π
And the responsibility tea: the user is responsible for calling the lock if he needs it. Nobody's gonna do it for you. π«‘
No more description β check the source code if you need to know more. That's the whole vibe. Go read the source. π
π VERSION π
1.02
π AVAILABLE FROM π
http://www.adelton.com/perl/DBD-XBase/
π AUTHOR π
(c) 1997--2011 Jan Pazdziora.
β SEE ALSO β
And that's the whole page, bestie! π«Ά This one's running on perl v5.34.0, dated 2022-06-13, and it's the XBase::Base(3pm) manual page from the User Contributed Perl Documentation. Now go forth and subclass responsibly. Mwah. πβ¨π
π¦ where this page comes from
- debian bookworm: libdbd-xbase-perl 1:1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdbd-xbase-perl 1:1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdbd-xbase-perl 1:1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdbd-xbase-perl 1:1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdbd-xbase-perl 1:1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms