RoPkg:...nfFile(3pm)
β¨ NAME β¨
RoPkg::Rsync::ConfFile β bestie, it's a whole module, and yes it's giving main character energy π
π DESCRIPTION π
Okay so listen. RoPkg::Rsync::ConfFile is a class you use to mess with rsync configuration files. And the way it does it?? It's so respectful of your file, fr fr β it can keep the order of the modules exactly like you left them, and it even keeps your comments and your empty lines intact. No cap, nothing gets yeeted that you didn't ask to get yeeted. π¦
πΈ SYNOPSIS πΈ
#!/usr/bin/perl
use warnings;
use strict;
sub main {
my $cf = new RoPkg::Rsync::ConfFile(filename => '/etc/rsyncd.conf');
$cf->Write('/tmp/new_rsyncd.conf');
return 0;
}
main();
π METHODS π
Heads up bestie: all of these methods throw the OutsideClass exception if you go and use them as class methods. Rude of you, honestly. π And besides OutsideClass, the methods are throwing other exceptions too, so don't @ me β refer to each method's own documentation for the full tea. π
π§ new(%hash)
The class constructor, the origin story, the birth of your object. Accepts a hash as its parameter. At this moment only one parameter can be specified inside the hash: filename. If that parameter is present, the file you specified gets parsed and loaded right into the object. Slay. β¨
π AddParam($pname, $pvalue)
Add a new global parameter named $pname with value $value. π
π AddComment($pval)
Add a new global comment with value $pval. π
π AddBlank($bval)
Add a new global blank line with value $bval. π«Ά
π AddNode($node)
Adds a new RoPkg::Rsync::Node object to the current object. But bestie, before the node gets added, the nodes list gets checked for duplicates of the object β and if a duplicate is found, the method justβ¦ does nothing. Iconic restraint, honestly. π
Exceptions:
- If
$nodeis not a instance ofRoPkg::Rsync::Node, theParam::Wrongexception is raised. π¨
π DelNode($node_name)
Removes a node from the nodes list. The nodes are searched by their names. Returns -1 if the node was not found, and the new number of nodes otherwise. πΈ
π HasNode($node_name)
Returns 1 if the node with name $node_name was found in the nodes list, 0 otherwise. Simple as that, periodt. β¨
π Clean()
Clean the object. Removes all information (the nodes list, statistics, etc). Always returns 1. It's giving factory reset. π
π Parse($filename)
Parse the configuration file $filename and returns the number of nodes. Now the warnings, bestie, pay attention:
- If
$filenameis not defined, theParam::Missingexception is raised. - If the path does not point to a existing file, the
File::NotFoundexception is raised. - If the file could not be opened, the
File::Openexception is raised.
π Write($path)
Write the configuration into the file specified by path $path. π
π ToString()
Returns the string representation of the configuration file. π¦
π PREREQUISITES π
perl 5.008 (or later) is required, no exceptions (well, except the exception classes, lol). Besides perl, you must have the following:
RoPkg::ExceptionsScalar::UtilEnglish
π SEE ALSO π
RoPkg::Rsync::AtomRoPkg::Rsync::ConfFileRoPkg::Exceptions
π AUTHOR π
Subredu Manuel <diablo@iasi.roedu.net> β the icon, the legend, the moment. π«Ά
π 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, mwah ππ β this was perl v5.32.1, dated 2021-12-26, and yes we're obsessed with her. bye!! πβ¨
π¦ 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