RoPkg:...::Atom(3pm)
π NAME π
okay bestie, welcome to the RoPkg:...::Atom(3pm) page β user contributed perl documentation, the whole vibe π
RoPkg::Rsync::Atom β it's literally the smallest unit in a rsync configuration file. tiny but iconic π
β¨ SYNOPSIS β¨
no cap, here's how you'd actually use it:
#!/usr/bin/perl
use strict;
use warnings;
use RoPkg::Rsync::Atom;
sub main {
my $a = new RoPkg::Rsync::Atom(
type => 'param',
name => 'uid',
value => 'nobody',
);
print $a->ToString(0),$/;
return 0;
}
main();
πΈ DESCRIPTION πΈ
so RoPkg::Rsync::Atom is a class that the RoPkg::Rsync modules use. the Atom is giving "smallest part of any rsync configuration file" energy β like, the little atom of the whole thing, iykyk π§
an atom can be (at this moment):
paramblankcomment
π METHODS π
okay so important thing first: all the methods throw the OutsideClass exception if you use them as class methods. not it.
example:
perl -MRoPkg::Rsync::Atom -e 'RoPkg::Rsync::Atom->Type;'
Called outside class instance
and besides OutsideClass, the methods are throwing other exceptions too π refer to each method's own documentation for the deets.
π new() π
the constructor of the class, the main character fr. new accepts 3 parameters grouped inside a hash:
*) typeβ type of the atom*) nameβ name of the atom*) valueβ value of the atom
the type parameter must always be present. if type is not present, a Param::Missing exception is raised π¨
at this moment, the atoms have 3 types:
*) paramβ a parameter in the standard form (name = value)*) commentβ a comment*) blankβ a blank line (or only with separators)
and if the value of the type parameter is not one of the ones specified, a Param::Wrong exception is raised π
examples, bestie:
example 1 (param):
my $a = new RoPkg::Rsync::Atom(
type => 'param',
name => 'gid',
value => 'users',
);
example 2 (param):
my $a = new RoPkg::Rsync::Atom(type => 'param');
$a->Name('gid');
$a->Value('users');
print 'Name of the atom is:',$a->Name,$/;
example 3 (comment):
my $a = new RoPkg::Rsync::Atom(
type => 'comment',
value => '# this is the group id',
);
example 4 (blank):
my $a = new RoPkg::Rsync::Atom(
type => 'blank',
value => q{ },
);
π Name($new_name)
the Name method is a get/set method β she does both, versatile queen β¨ if $new_name exists (and his value is defined) then the set behaviour is selected, otherwise the method acts as a get method. returns the name of the atom π«Ά
π¦ Value($new_value)
the Value method is a get/set method too. if $new_value exists (and his value is defined) then the set behaviour is selected, otherwise the method acts as a get method. returns the value of the atom π
β ToString($indent, $spaces)
returns the string representation of the atom. accepts 2 parameters: indent and spaces.
$indent is a true/false value specifing that the string representation should be prefixed with a tab character; $spaces is used to compute the number of spaces that should be added after the atom name, so that the total length of the parameter name to match the $spaces value. lowkey satisfying to watch it line up ngl π
example:
my $a = new RoPkg::Rsync::Atom(
type => 'param',
name => 'gid',
value => 'users',
);
print $a->ToString(0, 6),$/,
$a->ToString(0, 5),$/,
$a->ToString(0, 4),$/,
$a->ToString(0, 3),$/,
$a->ToString(1, 6),$/,
$a->ToString(1, 5),$/,
$a->ToString(1, 4),$/,
$a->ToString(1, 3),$/;
the result is:
gid = users
gid = users
gid = users
gid = users
gid = users
gid = users
gid = users
gid = users
π Type
returns the type (string representation) of the atom. short, sweet, slay π
π PREREQUISITES π
perl 5.008 (or later) is required. besides perl, you must have the following:
RoPkg::ExceptionsEnglishScalar::Util
π₯ SEE ALSO π₯
RoPkg::Rsync::Node RoPkg::Rsync::ConfFile RoPkg::Exceptions
π AUTHOR π
Subredu Manuel <diablo@iasi.roedu.net> β ty for your service king π«Ά
π§ LICENSE π§
Copyright (C) 2005 Subredu Manuel. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license.
okay that's the whole page bestie, you ate that π this wasperl v5.32.1, dated2021-12-26β and that's theRoPkg:...::Atom(3pm)vibe check, periodt πβ¨π
π¦ where this page comes from
- ubuntu jammy: libropkg-perl 0.4-1.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms