SRevie...::Base(3pm)

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

πŸ’– 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 the children property of collections created by create in SReview::Files::Factory only returns SReview::Files::Access objects. 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 files argument to pass an arrayref of absolute filenames:
$coll->delete_files(files => ["/foo/bar", "/foo/baz"]);
  • use the relnames argument 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