Badger...rkplace(3pm)

πŸ“¦
version 0.16 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu resolute

✨ NAME ✨

Badger::Workplace β€” a place to do work πŸ’…

(yes bestie, this is the Badger::Workplace(3pm) page from the User Contributed Perl Documentation, we're being so official rn)


🌸 DESCRIPTION 🌸

okay so picture this: it's a very simple base class for modules that operate on or around a particular filesystem directory. that's it. that's the whole vibe. it's giving "foundation, not feature set" 🫢

wanna see it out in the wild being used for real? go peek at Badger::Config::Filesystem β€” that's the example of it in use. iconic of them honestly.


πŸŽ€ CONFIGURATION OPTIONS πŸŽ€

these are the lil knobs you can set, bestie, turn them gently πŸ”§

  • root / dir / directory β€” you can hand over any of root, dir or directory to say where the root directory of the workplace lives. three names, one job, we love a flexible queen πŸ‘‘
  • urn β€” set this to define a Universal Resource Name (URN) for the workplace, just for reference purposes. if you leave it undefined it defaults to the name of the root directory. no extra effort required, she does it herself ✨
  • uri β€” set this to define a Universal Resource Identifier (URN) for the workplace, again for reference purposes. if it's undefined it defaults to the name of the value of urn. chain reaction, so slay πŸ’«
  • mkdir β€” here's the tea πŸ«–: the object constructor will fail if the root directory you specified via root (or dir, or directory) doesn't exist. BUT. if you set the mkdir option to any true value, the directory gets created automatically. no cap. it just makes it for you πŸ—οΈ

πŸ¦‹ METHODS πŸ¦‹

dir($name) / directory($name)

returns a Badger::Filesystem::Directory object for a named sub-directory relative to the workplace root πŸ—‚οΈ

and plot twist: when you call it with any arguments, it returns a Badger::Filesystem::Directory object for the workplace root directory itself. main character behaviour tbh.

file($name)

returns a Badger::Filesystem::File object for a named files relative to the workplace root πŸ“„

uri($path)

when you call this one with no arguments at all, it hands you back the base URI for the workspace. like:

print $workspace->uri;              # e.g. foo

but when you call it with a relative URI path as an argument? it returns the URI resolved relative to the project base URI. look at her go:

print $workspace->uri('bar');       # e.g. foo/bar

resolved. relative. gorgeous. periodt πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

Andy Wardley <http://wardley.org/> β€” the legend themselves 🫢


Copyright (C) 2008-2014 Andy Wardley. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole page bestie, you're officially fluent in Badger::Workplace now πŸŽ“βœ¨ this was perl v5.36.0, dated 2023-08-28 β€” go forth and make directories, ily, bye πŸ¦‹πŸ’–

πŸ“¦ where this page comes from