.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "RoPkg::Rsync::Atom 3pm" .TH RoPkg::Rsync::Atom 3pm "2021-12-26" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" RoPkg::Rsync::Atom \- the smallest unit in a rsync configuration file .SH "SYPONSIS" .IX Header "SYPONSIS" .Vb 1 \& #!/usr/bin/perl \& \& use strict; \& use warnings; \& \& use RoPkg::Rsync::Atom; \& \& sub main { \& my $a = new RoPkg::Rsync::Atom( \& type => \*(Aqparam\*(Aq, \& name => \*(Aquid\*(Aq, \& value => \*(Aqnobody\*(Aq, \& ); \& \& print $a\->ToString(0),$/; \& \& return 0; \& } \& \& main(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" RoPkg::Rsync::Atom is a class used by RoPkg::Rsync modules. The Atom is considered the smallest part of any rsync configuration file. An atom can be (at this moment): .IP "param" 3 .IX Item "param" .PD 0 .IP "blank" 3 .IX Item "blank" .IP "comment" 3 .IX Item "comment" .PD .SH "METHODS" .IX Header "METHODS" All methods, throw the OutsideClass exception, if you use them as class methods. .PP \&\fBExample\fR: .PP .Vb 2 \& perl \-MRoPkg::Rsync::Atom \-e \*(AqRoPkg::Rsync::Atom\->Type;\*(Aq \& Called outside class instance .Ve .PP Besides \fIOutsideClass\fR the methods are throwing other exceptions as well. Refer to each method documentation for more information. .SS "\fBnew()\fP" .IX Subsection "new()" The constructor of the class. \fBnew\fR accepts 3 parameters grouped inside a hash: .IP "*) type \- type of the atom" 3 .IX Item "*) type - type of the atom" .PD 0 .IP "*) name \- name of the atom" 3 .IX Item "*) name - name of the atom" .IP "*) value \- value of the atom" 3 .IX Item "*) value - value of the atom" .PD .PP The \fBtype\fR parameter must always be present. If the \fBtype\fR parameter is not present, a \fIParam::Missing\fR exception is raised. At this moment, the atoms have 3 types: .IP "*) param \- a parameter in the standard form (name = value)" 3 .IX Item "*) param - a parameter in the standard form (name = value)" .PD 0 .IP "*) comment \- a comment" 3 .IX Item "*) comment - a comment" .IP "*) blank \- a blank line (or only with separators)" 3 .IX Item "*) blank - a blank line (or only with separators)" .PD .PP If the value of the \fBtype\fR parameter is not one of the ones specified a \fIParam::Wrong\fR exception is raised. .PP \fIExamples:\fR .IX Subsection "Examples:" .PP \&\fBexample 1 (param)\fR: .PP .Vb 5 \& my $a = new RoPkg::Rsync::Atom( \& type => \*(Aqparam\*(Aq, \& name => \*(Aqgid\*(Aq, \& value => \*(Aqusers\*(Aq, \& ); .Ve .PP \&\fBexample 2 (param)\fR: .PP .Vb 4 \& my $a = new RoPkg::Rsync::Atom(type => \*(Aqparam\*(Aq); \& $a\->Name(\*(Aqgid\*(Aq); \& $a\->Value(\*(Aqusers\*(Aq); \& print \*(AqName of the atom is:\*(Aq,$a\->Name,$/; .Ve .PP \&\fBexample 3 (comment)\fR: .PP .Vb 4 \& my $a = new RoPkg::Rsync::Atom( \& type => \*(Aqcomment\*(Aq, \& value => \*(Aq# this is the group id\*(Aq, \& ); .Ve .PP \&\fBexample 4 (blank)\fR: .PP .Vb 4 \& my $a = new RoPkg::Rsync::Atom( \& type => \*(Aqblank\*(Aq, \& value => q{ }, \& ); .Ve .SS "Name($new_name)" .IX Subsection "Name($new_name)" The \fBName\fR method is a get/set method. If \fI\f(CI$new_name\fI\fR 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. .SS "Value($new_value)" .IX Subsection "Value($new_value)" The \fBValue\fR method is a get/set method. If \fI\f(CI$new_value\fI\fR 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. .ie n .SS "ToString($indent, $spaces)" .el .SS "ToString($indent, \f(CW$spaces\fP)" .IX Subsection "ToString($indent, $spaces)" Returns the string representation of the atom. Accepts 2 parameters: \fIindent\fR and \fIspaces\fR. \&\fB\f(CB$indent\fB\fR is a true/false value specifing that the string representation should be prefixed with a tab character; \fB\f(CB$spaces\fB\fR 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 \fI\f(CI$spaces\fI\fR value. .PP \&\fBExample\fR: .PP .Vb 5 \& my $a = new RoPkg::Rsync::Atom( \& type => \*(Aqparam\*(Aq, \& name => \*(Aqgid\*(Aq, \& value => \*(Aqusers\*(Aq, \& ); \& \& 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),$/; .Ve .PP The result is: gid = users gid = users gid = users gid = users gid = users gid = users gid = users gid = users .SS "Type" .IX Subsection "Type" Returns the type (string representation) of the atom. .SH "PREREQUISITES" .IX Header "PREREQUISITES" perl 5.008 (or later) is required. Besides perl, you must have the following: .IP "RoPkg::Exceptions" 3 .IX Item "RoPkg::Exceptions" .PD 0 .IP "English" 3 .IX Item "English" .IP "Scalar::Util" 3 .IX Item "Scalar::Util" .PD .SH "SEE ALSO" .IX Header "SEE ALSO" RoPkg::Rsync::Node RoPkg::Rsync::ConfFile RoPkg::Exceptions .SH "AUTHOR" .IX Header "AUTHOR" Subredu Manuel .SH "LICENSE" .IX Header "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 \s-1LICENSE\s0 file contains the full text of the license.