SRevie...::Base(3pm)

πŸ“¦ version 0.12.0, in ubuntu resolute, ubuntu stonking

✨ 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