SRevie...::Base(3pm)
π SRevie...::Base(3pm) π
okay bestie, welcome to the manpage for SReview::Files::Collection::Base, which lives in the User Contributed Perl Documentation section of your friendly neighbourhood perl v5.40.1 install. buckle up π
β¨ NAME β¨
SReview::Files::Collection::Base β it's the base class for file collections π«Ά like, the blueprint, the blueprint-est blueprint, the mother of all file collections.
πΈ DESCRIPTION πΈ
so this class is the base class for all SReview::Files::Collection classes. every collection class out there is basically standing on its shoulders π
for SReview, a collection is a "container" of files, like a directory. iconic behaviour tbh.
and here's the rule, no cap: the implementation requires that each file object in the collection has a URL created by the collection's baseurl property, followed by a slash, and the relative name of the file. that's the whole vibe. that's the shape of it.
π¦ PROPERTIES π¦
children
an array of SReview::Files::Base objects β one for each file in the collection π
this is a lazy property, meaning it gets computed on demand based on the files that are, at that point in time, actually available in the collection. it does this through its builder, _probe_children, which needs to be implemented by the implementing class if indexing of files is supported.
some implementations just don't support that, and that's fine. those implementations (e.g., SReview::Files::Collection::HTTP) do not need to implement the _probe_children method. slay.
Note: the definition allows for collections to contain more collections π but that turned out to be problematic, so the current implementation expects that thechildrenproperty of collections created bycreateinSReview::Files::Factoryonly returnsSReview::Files::Accessobjects. however, since some implementations might want to internally use a collection that does use a collection of collections, this is not enforced at the API level. so it's giving "we said don't but we won't stop you" π
baseurl
the base URL of the collection β¨ either this property or the globpattern one is required β pick one bestie, you gotta have one.
defaults to the leading part of the globpattern up to the last character before the first * character, with trailing slashes, if any, removed. cute little auto-derivation moment.
it need not be a valid absolute URL! e.g., the SReview::Files::Collection::direct implementation uses an absolute path that contains the collection. flexible queen π
globpattern
the globpattern is used by some implementations' children property to find the files in the collection π
either this property or the baseurl one is required. same deal as above, just the other side of the coin πͺ
fileclass
the name of the SReview::Files::Access::Base subclass used for files found in the collection π
required. no fileclass, no files, no collection, no vibes. periodt.
collection_name
the name of the collection. used in some debugging methods π so when things go sideways you know which collection was being dramatic.
π METHODS π
get_file
helper method to create an object of the fileclass class for files that already exist in the collection β
any valid properties for the fileclass class can be specified as arguments. it explicitly sets the create property to false. like, we're not making anything new here, we're just visiting.
add_file
helper method to create an object of the fileclass class for files that do not yet exist in the collection π
any valid properties for the fileclass class can be specified as arguments. it explicitly sets the create property to true. go forth and manifest that file β¨
has_file
helper method to determine if the file with the given relname property exists in the collection π€
the default implementation is an inefficient search over the list of files returned by the children property. where possible, subclasses should implement a more efficient method of testing the file's existence. ngl the default one is lowkey doing cardio for no reason π
delete_files
helper method to delete multiple files in the collection ποΈ
can be called in one of two ways:
- use the
filesargument to pass an arrayref of absolute filenames:
$coll->delete_files(files => ["/foo/bar", "/foo/baz"]);
- use the
relnamesargument to pass an arrayref of relative filenames:
$coll->delete_files(relnames => ["bar", "baz"]);
either way, the list of files to delete must be within the collection; any files that are not a part of the collection will not be deleted. we stay in our lane, we respect the boundary π«Ά
a file is deleted if it shares a prefix with one of the items in the list. e.g., if the absolute path of the collection is /foo, and the collection contained files bar/test123, baz, and bazy, then in the above two examples all those files would be removed. yes, all of them. prefix matching ate and left no crumbs π
if a prefix passed does not exist within the collection, a warning is printed but this will not be considered an error. so it's giving "hey, heads up" and not "the world is ending". chill warning energy π
delete
helper method to delete the collection π§Ή
the default implementation only deletes all the files in the collection. subclasses should implement deleting the collection itself (e.g., by deleting an S3 bucket, or deleting the directory in which the files of the collection are found). so like, the default is "empty the room" and the subclass upgrade is "remove the room entirely". main character demolition energy π
β οΈ heads up bestie: this page is from perl v5.40.1, dated 2026-02-15, and it documents SRevie...::Base(3pm) β keep all that in mind when you go gremlin-mode in the source. π
k that's the whole page, you're so smart for reading it all, go implement _probe_children or something, i'm obsessed with you ππ¦β¨
π¦ 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