App::C...H::Base(3pm)

✨ App::C...H::Base ✨

okay bestie, buckle up πŸ’– this is App::C...H::Base, a lil Perl module living in the 3pm manual section, and it's basically the main character base class that other objects inherit from. she's giving utility-function energy, no cap.


🌸 SYNOPSIS 🌸

use base qw/ App::ClusterSSH::Base /;

# in object new method
sub new {
    ( $class, $arg_ref ) = @_;
    my $self = $class->SUPER::new($arg_ref);
    return $self;
}

πŸ¦‹ DESCRIPTION πŸ¦‹

So like… this is a base object whose whole job is handing out some utility functions to other objects. that's it, that's the vibe. πŸ’…

lowkey important: this thing should NOT be used directly. she's a foundation, not a whole house. build on top of her, don't move into her. πŸ—οΈ

πŸ‘‘ METHODS πŸ‘‘

these extra methods are provided on the object, and honestly? iconic. 🌈

  • $obj = App::ClusterSSH::Base->new({ arg => val, }); β€” creates the object, periodt. and ooooh at higher debug levels the args get printed out πŸ‘€ so everyone can see what you passed in.
  • $obj->id β€” hands you back the unique id of the object so subclasses can use it, like this:
$info_for{ $self->id } = $info
  • $obj->debug_level(); β€” returns whatever the current debug level is, fr fr.
  • $obj->set_debug_level( n ) β€” sets the debug level to n for all the child objects. one call, whole fam updated. 🫢
  • $obj->debug($level, @text) β€” spits @text out on STDOUT if $level is the same as or lower than debug_level. quieter levels stay quiet, bestie. 🀫
  • $obj->set_lang β€” sets the Locale::Maketext language. defaults to 'en'. she expects the App::ClusterSSH/L10N/{lang}.pm module to exist and to contain all the relevant translations β€” and if it doesn't? we default back to English, no drama. πŸŽ€
  • $obj->loc('text to translate [_1]') β€” uses the App::ClusterSSH/L10N/{lang}.pm module to convert the text you give her into the appropriate language. peep App::ClusterSSH::L10N for the deets. essentially she's just a wrapper around maketext in Locale::Maketext. πŸ’œ
  • $obj->stdout_output(@); β€” outputs text on STDOUT. simple, clean, slay. ✨
  • $obj->parent; β€” returns the object that is the parent of this one, if it was set when the object got created. if not… she just doesn't have one, and that's valid. πŸ™ˆ
  • %obj->options; β€” accessor to the configured options, if it's been set up by this point. timing is everything, bestie.
  • $obj->exit; β€” a lil stub so your program can exit neatly from wherever in the code it happens to be. graceful queen. πŸ‘‘
  • $config = $obj->config; β€” returns whatever configuration object has been set up. ⚠️ she croaks if set_config hasn't been called β€” like, excuse me, where is the config??
  • $obj->set_config($config); β€” sets the config to the value you give. ⚠️ croaks if it's already been called β€” one config only, we don't do seconds around here.
  • $sort = $obj->sort β€” a code reference used to sort lists. if it's configured (and installed) she uses Sort;:Naturally, otherwise she falls back to plain perl sort. ✨ (yes, that's exactly how it's spelled, i don't make the rules)
  • %results = $obj->load_file( filename => '/path/to/file', type => '(cluster|config}' ) β€” loads in the file you specified and returns a hash. how she parses it depends on whether it's a config file (key = value) or a cluster file (key value). πŸ“

aaaand that's the whole page, bestie!! πŸ₯³ the source and version on this one is perl v5.42.2 and it's dated 2026-05-05 β€” so yeah, she's got history, and she's still serving. πŸ’–βœ¨πŸŽ€ go forth and build your subclasses, ily 🫢

πŸ“¦ where this page comes from