SRevie...::Base(3pm)
β¨ NAME β¨
SReview::Files::Access::Base β bestie, it's the base class for all the file access methods π
(and yeah, the header up top calls it SRevie...::Base(3pm) because man pages truncate, we don't gatekeep here π, it's a User Contributed Perl Documentation situation)
πΈ DESCRIPTION πΈ
Okay so. This class is the base class for every SReview::Files class that gives you access to files (as opposed to directories, that's a different girlie).
Do NOT use it directly, bestie. It's giving abstract. π
What it does do is define the API for accessing files through the SReview::Files API. That's the whole vibe. It's the blueprint, not the building. ποΈ
π¦ PROPERTIES π¦
relname π
The relative name of the file, inside the collection. Required at object creation time, no exceptions. It should contain the full path from the root of the collection. Slay.
filename π
An absolute pathname pointing to a readable version of the data file, on the local filesystem. Its builder, _get_file, must be implemented by subclasses β that's a you problem, not this class's problem. π
If the file isn't currently available on the local filesystem, the _get_file method should do whatever is required to make it somehow be there (e.g., download the file to a temporary directory), and then return the filename to the file it just made available. The created file must have the same extension so other parts of SReview can correctly recognize the file type β but it is not otherwise required to have any part of relname in the name.
If the create property is true, the caller wants to create or overwrite the contents of the file. In that case, _get_file should not download a file, but should still return a filename with the correct extension. π
mtime β°
The modification time of the file. Used by sreview-detect to figure out if a file has changed since it was last seen. Like a "have you changed your profile pic" check but for files. π
baseurl π
A copy of the containing collection's baseurl property. It's done as an optimization, so an implementation doesn't have to look up the collection in use just to build the full URL when needed. Efficiency queen. π
basepath π€οΈ
The base path of the filename β the part that comes before the valid_path_filename. For the SReview::Files::Access::direct implementation, this is the same as baseurl. For other implementations, it could be the name of a temporary directory or something along those lines. Very choose-your-own-adventure. β¨
create ποΈ
Boolean. Set this property to true if you want to write to the file, and false if you want to read from it.
Creating an object that can be used both for reading and writing at the same time is not supported. Pick a lane, bestie. π
is_stored πΎ
Boolean. Indicates the file has been uploaded to the server, if that was required. Used by the destructor to catch forgotten store_file calls and make them implicit. Not me forgetting to uploadβ¦ couldn't be me. π
π METHODS π
valid_path_filename π§
The valid_path_filename method should be implemented by subclasses to return the path to the file on the local filesystem. The way it differs from the filename property is that the returned filename must end with the value of the relname property. It may do this by way of a symlink to the file pointed to by the filename property, though. Flexible, iconic, we love that for her. π
Future versions of this API may implement this as a lazy property rather than a subroutine. Just so you know. iykyk. π
store_file π€
This method should be implemented by subclasses to write the contents of the file to the correct location on the server. After successfully uploading the file, the is_stored property should be set to true. Periodt.
Read-only implementations of the SReview::Files API (e.g., SReview::Files::Access::HTTP) do not need to provide this method β they're just here to look cute and read. π«Ά
If no upload is required, the method should still set the is_stored property to true. Rules are rules. π
delete ποΈ
This method should be implemented by subclasses to delete the file from the collection. Bye bestie. π
Read-only implementations of the SReview::Files API (e.g., SReview::Files::Access::HTTP) do not need to provide this method either. They're reading only, and honestly? Respect. β¨
π AUTHOR π
Wouter Verblauw? No wait β Wouter Verhelst <w@uter.be> π The author of all this. Give her her flowers. πΈ
Okay that's the whole page, bestie! One last thing β this was perl v5.40.1, dated 2026-02-15, and yes the man header/footer both say SRevie...::Base(3pm) because of the truncation thing. Slay, you read the whole thing. πβ¨π
π¦ where this page comes from
- ubuntu resolute: sreview-common 0.12.0-1
- ubuntu stonking: sreview-common 0.12.0-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms