?¡ëPNG
IHDR ? f ??C1 sRGB ??¨¦ gAMA ¡À?¨¹a pHYs ? ??o¡§d GIDATx^¨ª¨¹L¡±¡Âe¡ÂY?a?("Bh?_¨°???¡é¡ì?q5k?*:t0A-o??£¤]VkJ¡éM??f?¡À8\k2¨ªll¡ê1]q?¨´???T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
man/man3/Sys::Hostname::FQDN.3pm 0000666 00000020566 15047332065 0012116 0 ustar 00 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" 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" ''
'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 turned on, 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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "FQDN 3"
.TH FQDN 3 "2010-11-15" "perl v5.10.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"
.Vb 1
\& Sys::Hostname::FQDN \- Get the short or long hostname
.Ve
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 8
\& use Sys::Hostname::FQDN qw(
\& asciihostinfo
\& gethostinfo
\& inet_ntoa
\& inet_aton
\& fqdn
\& short
\& );
\&
\& $host = short();
\& $fqdn = fqdn();
\& ($name,$aliases,$addrtype,$length,@addrs)=gethostinfo();
\& ($name,$aliases,$addrtype,$length,@addrs)=asciihostinfo();
\& $dotquad = inet_ntoa($netaddr);
\& $netaddr = inet_aton($dotquad);
.Ve
.SH "INSTALLATION"
.IX Header "INSTALLATION"
To install this module type the following:
.PP
.Vb 4
\& perl Makefile.PL
\& make
\& make test
\& make install
.Ve
.PP
Solaris users, see the 'hints' subdirectory if you have problems with the
build.
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\fBSys::Hostname::FQDN\fR uses the host 'C' library to discover the (usually)
short host name, then uses (perl) gethostbyname to extract the real
hostname.
.PP
The results from gethostbyname are exported as \fBgethostinfo\fR and
\&\fBasciihostinfo\fR as a convenience since they are available. Similarly, the
\&'C' library functions \fBinet_ntoa\fR and \fBinet_aton\fR are exported.
.ie n .IP "$host = \fIshort()\fR;" 4
.el .IP "\f(CW$host\fR = \fIshort()\fR;" 4
.IX Item "$host = short();"
.Vb 1
\& returns the host part of this host\*(Aqs FQDN.
.Ve
.ie n .IP "$fqdn = \fIfqdn()\fR;" 4
.el .IP "\f(CW$fqdn\fR = \fIfqdn()\fR;" 4
.IX Item "$fqdn = fqdn();"
.Vb 1
\& returns the fully qualified host name of this host.
.Ve
.IP "($name,$aliases,$addrtype,$length,@addrs)=\fIgethostinfo()\fR;" 4
.IX Item "($name,$aliases,$addrtype,$length,@addrs)=gethostinfo();"
.Vb 7
\& returns:
\& $name fully qualifed host name of this host.
\& $aliases alternate names for this host.
\& $addrtype The type of address; always AF_INET at present.
\& $length The length of the address in bytes.
\& @addrs array of network addresses for this host
\& in network byte order.
.Ve
.IP "($name,$aliases,$addrtype,$length,@addrs)=\fIasciihostinfo()\fR;" 4
.IX Item "($name,$aliases,$addrtype,$length,@addrs)=asciihostinfo();"
.Vb 6
\& returns:
\& $name fully qualifed host name of this host.
\& $aliases alternate names for this host.
\& $addrtype The type of address; always AF_INET at present.
\& $length The length of the address in bytes.
\& @addrs array of dot quad IP addresses for this host.
.Ve
.ie n .IP "$dotquad = inet_ntoa($netaddr);" 4
.el .IP "\f(CW$dotquad\fR = inet_ntoa($netaddr);" 4
.IX Item "$dotquad = inet_ntoa($netaddr);"
.Vb 2
\& input: packed network address in network byte order.
\& returns: dot quad IP address.
.Ve
.ie n .IP "$netaddr = inet_aton($dotquad);" 4
.el .IP "\f(CW$netaddr\fR = inet_aton($dotquad);" 4
.IX Item "$netaddr = inet_aton($dotquad);"
.Vb 2
\& input: dot quad IP address.
\& returns: packed network address in network byte order.
.Ve
.SH "DEPENDENCIES"
.IX Header "DEPENDENCIES"
.Vb 1
\& none
.Ve
.SH "EXPORT"
.IX Header "EXPORT"
.Vb 1
\& None by default
.Ve
.SH "EXPORT_OK"
.IX Header "EXPORT_OK"
.Vb 6
\& asciihostinfo
\& gethostinfo
\& inet_ntoa
\& inet_aton
\& fqdn
\& short
.Ve
.SH "ACKNOWLEDGEMENTS"
.IX Header "ACKNOWLEDGEMENTS"
The workaround for systems that do not have 'inet_aton' is taken directly
from Socket.xs in the Perl 5 kit for perl\-5.8.0 by Larry Wall, copyright
1989\-2002. Thank you Larry for making \s-1PERL\s0 possible for all of us.
.SH "AUTHOR"
.IX Header "AUTHOR"
Michael Robinton
.SH "COPYRIGHT AND LICENCE"
.IX Header "COPYRIGHT AND LICENCE"
.Vb 1
\& Copyright 2003\-2010, Michael Robinton
.Ve
.PP
This module is free software; you can redistribute it and/or modify it
under the terms of either:
.PP
.Vb 2
\& a) the GNU General Public License as published by the Free Software
\& Foundation; either version 1, or (at your option) any later version,
\&
\& or
\&
\& b) the "Artistic License" which comes with this module.
.Ve
.PP
This program is distributed in the hope that it will be useful,
but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of
\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See either
the \s-1GNU\s0 General Public License or the Artistic License for more details.
.PP
You should have received a copy of the Artistic License with this
module, in the file \s-1ARTISTIC\s0. If not, I'll be glad to provide one.
.PP
You should have received a copy of the \s-1GNU\s0 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0 02111\-1307 \s-1USA\s0
man/man3/Log::Syslog::Fast::PP.3pm 0000666 00000011132 15047332065 0012341 0 ustar 00 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" 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" ''
'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 turned on, 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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Log::Syslog::Fast::PP 3"
.TH Log::Syslog::Fast::PP 3 "2012-01-04" "perl v5.10.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"
Log::Syslog::Fast::PP \- XS\-free, API\-compatible version of Log::Syslog::Fast
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 3
\& use Log::Syslog::Fast::PP \*(Aq:all\*(Aq;
\& my $logger = Log::Syslog::Fast::PP\->new(LOG_UDP, "127.0.0.1", 514, LOG_LOCAL0, LOG_INFO, "mymachine", "logger");
\& $logger\->send("log message", time);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module should be fully API-compatible with Log::Syslog::Fast; refer to
its documentation for usage.
.SH "AUTHOR"
.IX Header "AUTHOR"
Adam Thomason,
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright (C) 2009\-2011 by Say Media, Inc.
.PP
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.
man/man3/Log::Syslog::Constants.3pm 0000666 00000013714 15047332065 0013004 0 ustar 00 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" 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" ''
'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 turned on, 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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Log::Syslog::Constants 3"
.TH Log::Syslog::Constants 3 "2011-03-04" "perl v5.10.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"
Log::Syslog::Constants \- Perl extension containing syslog priority constants as
defined in RFC3164.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use Log::Syslog::Constants \*(Aq:all\*(Aq;
\&
\& @severities = (
\& LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO,
\& LOG_DEBUG
\& );
\&
\& @facilities = (
\& LOG_KERN, LOG_USER, LOG_MAIL, LOG_DAEMON, LOG_AUTH, LOG_SYSLOG, LOG_LPR,
\& LOG_NEWS, LOG_UUCP, LOG_CRON, LOG_AUTHPRIV, LOG_FTP, LOG_LOCAL0,
\& LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6,
\& LOG_LOCAL7
\& );
\&
\& $info_constant = get_severity(\*(AqINFO\*(Aq);
\& $local0_constant = get_facility(\*(Aqlocal0\*(Aq);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Syslog messages\*(--as standardized in RFC3164\-\-embed a priority number (the \s-1PRI\s0
part) which is composed of a severity and a facility value. The constants which
encode these values are specified in section 4.1.1, and are made available by
this module. For instance, the exportable \s-1LOG_FTP\s0 constant has a value of 11,
the value for the \s-1FTP\s0 facility.
.SH "EXPORTS"
.IX Header "EXPORTS"
Nothing is exported by default. You may optionally import individual constants
and functions or groups of them:
.PP
.Vb 4
\& use Log::Syslog::Constants qw(:severities); # LOG_CRIT, LOG_DEBUG, etc
\& use Log::Syslog::Constants qw(:facilities); # LOG_CRON, LOG_LOCAL3, etc
\& use Log::Syslog::Constants qw(:functions); # get_facility, get_severity
\& use Log::Syslog::Constants qw(:all); # all of the above
.Ve
.SH "FUNCTIONS"
.IX Header "FUNCTIONS"
.IP "\(bu" 4
get_facility($facility_string)
.IP "\(bu" 4
get_severity($severity_string)
.Sp
These functions look up a constant value by name, e.g.
\&\f(CW\*(C`get_severity(\*(Aqinfo\*(Aq) == LOG_INFO\*(C'\fR.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
<\s-1RFC3164\s0>
.SH "AUTHOR"
.IX Header "AUTHOR"
Adam Thomason,
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright (C) 2010\-2011 by Say Media, Inc.
.PP
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.
man/man3/Log::Syslog::Fast::Simple.3pm 0000666 00000014476 15047332065 0013271 0 ustar 00 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" 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" ''
'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 turned on, 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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Log::Syslog::Fast::Simple 3"
.TH Log::Syslog::Fast::Simple 3 "2012-01-04" "perl v5.10.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"
Log::Syslog::Fast::Simple \- Wrapper around Log::Syslog::Fast that adds some
flexibility at the expense of additional runtime overhead.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use Log::Syslog::Fast::Simple;
\&
\& # Simple usage:
\& $logger = Log::Syslog::Fast::Simple\->new;
\& $logger\->send("log message");
\&
\& # More customized usage:
\& $logger = Log::Syslog::Fast::Simple\->new(
\& loghost => \*(Aqmyloghost\*(Aq,
\& port => 6666,
\& facility => LOG_LOCAL2,
\& severity => LOG_INFO,
\& sender => \*(Aqmymachine\*(Aq,
\& name => \*(Aqmyapp\*(Aq,
\& );
\& $logger\->send("log message", time, LOG_LOCAL3, LOG_DEBUG);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module wraps Log::Syslog::Fast to provide a constructor with reasonable
defaults and a \fIsend()\fR method that optionally accepts override parameters for
facility and severity.
.SH "METHODS"
.IX Header "METHODS"
.IP "Log::Syslog::Fast::Simple\->new(%params);" 4
.IX Item "Log::Syslog::Fast::Simple->new(%params);"
Create a new Log::Syslog::Fast::Simple object with given parameters (may be a
hash or hashref). Takes the following named parameters which have the same
meaning as in Log::Syslog::Fast.
.RS 4
.IP "proto" 4
.IX Item "proto"
Defaults to \s-1LOG_UDP\s0
.IP "loghost" 4
.IX Item "loghost"
Defaults to 127.0.0.1
.IP "port" 4
.IX Item "port"
Defaults to 514
.IP "facility" 4
.IX Item "facility"
Defaults to \s-1LOG_LOCAL0\s0
.IP "severity" 4
.IX Item "severity"
Defaults to \s-1LOG_INFO\s0
.IP "sender" 4
.IX Item "sender"
Defaults to Sys::Hostname::hostname
.IP "name" 4
.IX Item "name"
Defaults to a cleaned \f(CW$0\fR
.RE
.RS 4
.RE
.ie n .IP "$logger\->send($logmsg, [$time], [$severity], [$facility])" 4
.el .IP "\f(CW$logger\fR\->send($logmsg, [$time], [$severity], [$facility])" 4
.IX Item "$logger->send($logmsg, [$time], [$severity], [$facility])"
Send a syslog message through the configured logger. If \f(CW$time\fR is not provided,
the current time is used. If \f(CW$severity\fR or \f(CW$facility\fR are not provided, the
default provided at construction time is used.
.SH "EXPORT"
.IX Header "EXPORT"
Same as Log::Syslog::Fast.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Log::Syslog::Fast
.SH "AUTHOR"
.IX Header "AUTHOR"
Adam Thomason,
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright (C) 2009\-2011 by Say Media, Inc.
.PP
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.
man/man3/DNS::ZoneParse.3pm 0000666 00000036552 15047332065 0011261 0 ustar 00 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" 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" ''
'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 turned on, 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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "DNS::ZoneParse 3"
.TH DNS::ZoneParse 3 "2010-09-29" "perl v5.10.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"
DNS::ZoneParse \- Parse and manipulate DNS Zone Files.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use DNS::ZoneParse;
\&
\& my $zonefile = DNS::ZoneParse\->new("/path/to/dns/zonefile.db", $origin);
\&
\& # Get a reference to the MX records
\& my $mx = $zonefile\->mx;
\&
\& # Change the first mailserver on the list
\& $mx\->[0] = { host => \*(Aqmail.localhost.com\*(Aq,
\& priority => 10,
\& name => \*(Aq@\*(Aq };
\&
\& # update the serial number
\& $zonefile\->new_serial();
\&
\& # write the new zone file to disk
\& my $newzone;
\& open($newzone, \*(Aq>\*(Aq, \*(Aq/path/to/dns/zonefile.db\*(Aq) or die "error";
\& print $newzone $zonefile\->output();
\& close $newzone;
.Ve
.SH "INSTALLATION"
.IX Header "INSTALLATION"
.Vb 4
\& perl Makefile.PL
\& make
\& make test
\& make install
.Ve
.PP
Win32 users substitute \*(L"make\*(R" with \*(L"nmake\*(R" or equivalent.
nmake is available at http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN\-US/Nmake15.exe
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module will parse a Zone File and put all the Resource Records (RRs)
into an anonymous hash structure. Various record types are supported, see the
methods section for details. It could be useful for maintaining \s-1DNS\s0 zones,
or for transferring \s-1DNS\s0 zones to other servers. If you want to generate an
XML-friendly version of your zone files, it is easy to use XML::Simple with
this module once you have parsed the zone file.
.PP
DNS::ZoneParse scans the \s-1DNS\s0 zone file \- removes comments and seperates
the file into its constituent records. It then parses each record and
stores the records internally. See below for information on the accessor
methods.
.SS "\s-1METHODS\s0"
.IX Subsection "METHODS"
.IP "new" 4
.IX Item "new"
This creates the DNS::ZoneParse object and loads the zone file.
.Sp
Example:
my \f(CW$zonefile\fR = DNS::ZoneParse\->new(\*(L"/path/to/zonefile.db\*(R");
.Sp
You can also initialise the object with the contents of a file:
my \f(CW$zonefile\fR = DNS::ZoneParse\->new( \e$zone_contents );
.Sp
You can pass a second, optional parameter to the constructor to supply an
\&\f(CW$origin\fR if none can be found in the zone file.
.Sp
.Vb 1
\& my $zonefile = DNS::ZoneParse\->new( \e$zone_contents, $origin );
.Ve
.Sp
You can pass a third, optional parameter to the constructor to supply a
callback which will be called whenever an unparsable line is encountered in
the zone file. See \f(CW\*(C`on_unparseable_line\*(C'\fR for details on this parameter and
how errors are handled when parsing zone files.
.Sp
If you plan to pass a on_unparseable_line callback but do not wish to specify
an \f(CW$origin\fR, pass 'undef' as the \f(CW$origin\fR parameter.
.IP "a(), \fIcname()\fR, \fIsrv()\fR, \fImx()\fR, \fIns()\fR, \fIptr()\fR, \fItxt()\fR, \fIhinfo()\fR, \fIrp()\fR, \fIloc()\fR" 4
.IX Item "a(), cname(), srv(), mx(), ns(), ptr(), txt(), hinfo(), rp(), loc()"
These methods return references to the resource records. For example:
.Sp
.Vb 1
\& my $mx = $zonefile\->mx;
.Ve
.Sp
Returns the mx records in an array reference.
.Sp
All records (except \s-1SOA\s0) have the following properties: 'ttl', 'class',
\&'host', 'name', '\s-1ORIGIN\s0'.
.Sp
\&\s-1MX\s0 records also have a 'priority' property.
.Sp
\&\s-1SRV\s0 records also have 'priority', 'weight' and 'port' properties.
.Sp
\&\s-1TXT\s0 records also have a 'text' property representing the record's 'txt\-data'
descriptive text.
.Sp
\&\s-1HINFO\s0 records also have 'cpu' and 'os' properties.
.Sp
\&\s-1RP\s0 records also have 'mbox' and 'text' properties.
.Sp
\&\s-1LOC\s0 records also have 'd1', 'm1', 's1', 'NorS', 'd2', 'm2', 's2', 'EorW',
\&'alt', 'siz', 'hp', and 'vp', as per \s-1RFC\s0 1876.
.Sp
If there are no records of a given type in the zone, the call will croak with
an error message about an invalid method. (This is not an ideal behavior, but
has been kept for backwards compatibility.)
.Sp
The '\s-1ORIGIN\s0' property is the fully-qualified origin of the record. See
fqname for details on constructing a fully qualified domain name. Note: for
\&\s-1SOA\s0 records, the '\s-1ORIGIN\s0' will match the 'origin' property when the \s-1SOA\s0 record
is specified as fully qualified.
.IP "\fIsoa()\fR" 4
.IX Item "soa()"
Returns a hash reference with the following properties:
\&'serial', 'origin', 'primary', 'refresh', 'retry', 'ttl', 'minimumTTL',
\&'email', 'expire', 'class', '\s-1ORIGIN\s0'.
.Sp
The '\s-1ORIGIN\s0' property is returned separate from 'origin' property, though the
data may be the same. '\s-1ORIGIN\s0' represents the implicit origin for the record
while 'origin' represents the origin specified on the \s-1SOA\s0 line in the file.
.Sp
If the 'origin' value is relative (that is, does not end with a '.'), the
actual zone for which the \s-1SOA\s0 line applies must be computed by concatenating
the 'origin' and '\s-1ORIGIN\s0' values. See fqname for details. If the 'origin'
value is absolute, no computation is necessary and 'origin' is the same as
\&'\s-1ORIGIN\s0'.
.IP "\fIgenerate()\fR" 4
.IX Item "generate()"
Returns an array of hashes representing \f(CW$GENERATE\fR directives present in the
zone. Note, \f(CW$GENERATE\fR directives are BIND-specific additions. They are not
expanded by DNS::ZoneParse, but users are able to access and modify these
directives. The following properties are returned:
.Sp
\&'range', 'lhs', 'ttl', 'class', 'type', 'rhs', '\s-1ORIGIN\s0'.
.Sp
See the \s-1BIND\s0 documentation for details on the syntax and usage of the \f(CW$GENERATE\fR
directive.
.IP "dump" 4
.IX Item "dump"
Returns a copy of the datastructute that stores all the resource records. This
might be useful if you want to quickly transform the data into another format,
such as \s-1XML\s0.
.IP "fqname" 4
.IX Item "fqname"
Takes a single parameter, a hash reference containing a record.
.Sp
Returns the fully qualified name of this record, with a trailing '.'. In most
cases this is as simple as concatenating the 'name' and '\s-1ORIGIN\s0' with a '.'
unless 'name' is '@', in which case the fqname is simply the '\s-1ORIGIN\s0'. For
\&\s-1SOA\s0 records, the same process is performed on the 'origin' instead of 'name'.
.Sp
Please note, fqname will not expand the right hand side of a record (ie,
\&\s-1CNAME\s0, \s-1SOA\s0, \s-1MX\s0, etc). The user must expand these values via the above method.
.IP "ttl_to_int" 4
.IX Item "ttl_to_int"
Takes a single parameter, a string representing a valid record \s-1TTL\s0.
.Sp
Returns an integer representing the number of seconds the \s-1TTL\s0 represents.
Note, this does not take into account any leap-years, leap-seconds, \s-1DST\s0
changes, etc. It is simply the count of the number of seconds in the specified
period of time.
.IP "new_serial" 4
.IX Item "new_serial"
\&\f(CW\*(C`new_serial()\*(C'\fR incriments the Zone serial number. It will generate a
date-based serial number. Or you can pass a positive number to add to the
current serial number.
.Sp
Examples:
.Sp
.Vb 4
\& $zonefile\->new_serial();
\& # generates a new serial number based on date:
\& # YYYYmmddHH format, incriments current serial
\& # by 1 if the new serial is still smaller
\&
\& $zonefile\->new_serial(50);
\& # adds 50 to the original serial number
.Ve
.IP "output" 4
.IX Item "output"
\&\f(CW\*(C`output()\*(C'\fR returns the new zone file output as a string. If you wish your
output formatted differently, you can pass the output of \f(CW\*(C`dump()\*(C'\fR to your
favourite templating module.
.IP "last_parse_error_count" 4
.IX Item "last_parse_error_count"
Returns a count of the number of unparsable lines from the last time a
zone file was parsed. If no zone file has been parsed yet, returns 0.
.Sp
If you want to be sure that a zone file was parsed completely and without
error, the return value of this method should be checked after the constructor
is called (or after a call to _parse).
.IP "on_unparseable_line" 4
.IX Item "on_unparseable_line"
\&\f(CW\*(C`on_unparseable_line()\*(C'\fR is an accessor method for the callback used when an
unparseable line is encountered while parsing a zone file. If not set,
DNS::ZoneParse will \f(CW\*(C`croak\*(C'\fR when an unparsable line is encountered, but will
continue to parse the file. Each time an unparsable line is encountered, an
internal counter is incrememnted. See \f(CW\*(C`last_parse_error_count\*(C'\fR for details.
.Sp
The callback is passed four parameters, a reference to the DNS::ZoneParse
object which is doing the parsing, the text of the line that is unable to be
parsed, the text of the reason the line could not be parsed, and the text of
the last successfully parsed line.
.Sp
If you want to abort parsing when an unparsable line is found, call \f(CW\*(C`die\*(C'\fR
from within your callback and catch that die with an eval block around the
DNS::ZoneParse constructor (or call to _parse).
.Sp
The method takes a single optional parameter, a code reference to the function
that will be called when an unparsable line is reached. Returns a reference to
the last callback. If passed an undefined value, a reference to the current
callback is returned. If passed any other value, undef is returned.
.SS "\s-1EXAMPLES\s0"
.IX Subsection "EXAMPLES"
This script will print the A records in a zone file, add a new A record for the
name \*(L"new\*(R" and then return the zone file.
.PP
.Vb 2
\& use strict;
\& use DNS::ZoneParse;
\&
\& my $zonefile = DNS::ZoneParse\->new("/path/to/zonefile.db");
\&
\& print "Current A Records\en";
\& my $a_records = $zonefile\->a();
\&
\& foreach my $record (@$a_records) {
\& print "$record\->{name} resolves at $record\->{host}\en";
\& }
\&
\& push (@$a_records, { name => \*(Aqnew\*(Aq, class => \*(AqIN\*(Aq,
\& host => \*(Aq127.0.0.1\*(Aq, ttl => \*(Aq\*(Aq });
\&
\& $zonefile\->new_serial();
\& my $newfile = $zonefile\->output();
.Ve
.PP
This script will convert a \s-1DNS\s0 Zone file to an \s-1XML\s0 file using XML::Simple.
.PP
.Vb 3
\& use strict;
\& use DNS::ZoneParse;
\& use XML::Simple;
\&
\& my $zonefile = DNS::ZoneParse\->new("/path/to/zonefile.db");
\&
\& my $new_xml = XMLout($zonefile\->dump,
\& noattr => 1,
\& suppressempty => 1,
\& rootname => $zonefile\->origin);
.Ve
.SH "CHANGES"
.IX Header "CHANGES"
See \fIChanges\fR
.SH "API"
.IX Header "API"
The DNS::ZoneParse \s-1API\s0 may change in future versions. At present, the parsing
is not as strict as it should be and support for \f(CW$ORIGIN\fR and \f(CW$TTL\fR is
quite basic. It would also be nice to support the \f(CW\*(C`INCLUDE\*(C'\fR
statement. Furthermore, parsing large zone files with thousands of records can
use lots of memory \- some people have requested a callback interface.
.SH "BUGS"
.IX Header "BUGS"
I can squash more bugs with your help. Please let me know if you spot something
that doesn't work as expected.
.PP
You can report bugs via the \s-1CPAN\s0 \s-1RT:\s0
.PP
If possible, please provide a diff against \fIt/dns\-zoneparse.t\fR and
\&\fIt/test\-zone.db\fR that demonstrates the bug(s).
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Other modules with similar functionality:
.PP
Net::DNS::ZoneParser, Net::DNS::ZoneFile, DNS::ZoneFile
.SH "AUTHOR"
.IX Header "AUTHOR"
Simon Flack
.SH "MAINTENANCE"
.IX Header "MAINTENANCE"
Maintainers: Mike Schilli (m@perlmeister.com), John Eaglesham (perl@8192.net).
.PP
Bug queue: http://rt.cpan.org/Public/Dist/Display.html?Name=DNS\-ZoneParse
.SH "LICENSE"
.IX Header "LICENSE"
DNS::ZoneParse is free software which you can redistribute and/or modify under
the same terms as Perl itself.
man/man3/Log::Syslog::Fast.3pm 0000666 00000031005 15047332065 0011716 0 ustar 00 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" 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" ''
'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 turned on, 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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Log::Syslog::Fast 3"
.TH Log::Syslog::Fast 3 "2012-01-04" "perl v5.10.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"
Log::Syslog::Fast \- Perl extension for sending syslog messages over TCP, UDP,
or UNIX sockets with minimal CPU overhead.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 3
\& use Log::Syslog::Fast \*(Aq:all\*(Aq;
\& my $logger = Log::Syslog::Fast\->new(LOG_UDP, "127.0.0.1", 514, LOG_LOCAL0, LOG_INFO, "mymachine", "logger");
\& $logger\->send("log message", time);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module sends syslog messages over a network socket. It works like
Sys::Syslog in setlogsock's 'udp', 'tcp', or 'unix' modes, but without the
significant \s-1CPU\s0 overhead of that module when used for high-volume logging. Use
of this specialized module is only recommended if 1) you must use network
syslog as a messaging transport but 2) need to minimize the time spent in the
logger.
.PP
This module supercedes the less general Log::Syslog::UDP.
.SH "METHODS"
.IX Header "METHODS"
.ie n .IP "Log::Syslog::Fast\->new($proto, $hostname, $port, $facility, $severity, $sender, $name);" 4
.el .IP "Log::Syslog::Fast\->new($proto, \f(CW$hostname\fR, \f(CW$port\fR, \f(CW$facility\fR, \f(CW$severity\fR, \f(CW$sender\fR, \f(CW$name\fR);" 4
.IX Item "Log::Syslog::Fast->new($proto, $hostname, $port, $facility, $severity, $sender, $name);"
Create a new Log::Syslog::Fast object with the following parameters:
.RS 4
.ie n .IP "$proto" 4
.el .IP "\f(CW$proto\fR" 4
.IX Item "$proto"
The transport protocol: one of \s-1LOG_TCP\s0, \s-1LOG_UDP\s0, or \s-1LOG_UNIX\s0.
.Sp
If \s-1LOG_TCP\s0 or \s-1LOG_UNIX\s0 is used, calls to \f(CW$logger\fR\->\fIsend()\fR will block until
remote receipt of the message is confirmed. If \s-1LOG_UDP\s0 is used, the call will
never block and may fail if insufficient buffer space exists in the network
stack (in which case an exception will be thrown).
.Sp
With \s-1LOG_UNIX\s0, \fI\->new\fR will first attempt to connect with a \s-1SOCK_STREAM\s0
socket, and then try a \s-1SOCK_DGRAM\s0 if that is what the server expects (e.g.
rsyslog).
.ie n .IP "$hostname" 4
.el .IP "\f(CW$hostname\fR" 4
.IX Item "$hostname"
For \s-1LOG_TCP\s0 and \s-1LOG_UDP\s0, the destination hostname where a syslogd is running.
For \s-1LOG_UNIX\s0, the path to the \s-1UNIX\s0 socket where syslogd is listening (typically
/dev/log).
.ie n .IP "$port" 4
.el .IP "\f(CW$port\fR" 4
.IX Item "$port"
For \s-1LOG_TCP\s0 and \s-1LOG_UDP\s0, the destination port where a syslogd is listening,
usually 514. Ignored for \s-1LOG_UNIX\s0.
.ie n .IP "$facility" 4
.el .IP "\f(CW$facility\fR" 4
.IX Item "$facility"
The syslog facility constant, eg 16 for 'local0'. See \s-1RFC3164\s0 section 4.1.1 (or
) for appropriate constant values. See \s-1EXPORTS\s0 below
for making these available by name.
.Sp
The \fIpriority\fR value is computed from the facility and severity per the \s-1RFC\s0.
.ie n .IP "$severity" 4
.el .IP "\f(CW$severity\fR" 4
.IX Item "$severity"
The syslog severity constant, eg 6 for 'info'. See \s-1RFC3164\s0 section 4.1.1 (or
) for appropriate constant values. See \s-1EXPORTS\s0 below
for making these available by name.
.ie n .IP "$sender" 4
.el .IP "\f(CW$sender\fR" 4
.IX Item "$sender"
The originating hostname. Sys::Hostname::hostname is typically a reasonable
source for this.
.ie n .IP "$name" 4
.el .IP "\f(CW$name\fR" 4
.IX Item "$name"
The program name or tag to use for the message.
.RE
.RS 4
.RE
.ie n .IP "$logger\->send($logmsg, [$time])" 4
.el .IP "\f(CW$logger\fR\->send($logmsg, [$time])" 4
.IX Item "$logger->send($logmsg, [$time])"
.PD 0
.ie n .IP "$logger\->emit($logmsg, [$time])" 4
.el .IP "\f(CW$logger\fR\->emit($logmsg, [$time])" 4
.IX Item "$logger->emit($logmsg, [$time])"
.PD
Send a syslog message through the configured logger. If \f(CW$time\fR is not provided,
\&\fB\f(BItime\fB\|(2)\fR will be called for you. That doubles the syscalls per message, so
try to pass it if you're already calling \fItime()\fR yourself.
.Sp
\&\->send may throw an exception if the system call fails (e.g. the transport
becomes disconnected for connected protocols, or the kernel buffer is full for
unconnected). For this reason it is usually wise to wrap calls with an
exception handler. Likewise, calling \->send from a \f(CW$SIG\fR{_\|_DIE_\|_} handler is
unwise.
.Sp
\&\fBemit\fR is an alias for \fBsend\fR.
.Sp
\&\fB\s-1NEWLINE\s0 \s-1CAVEAT\s0\fR
.Sp
Note that \fBsend\fR does not add any newline character(s) to its input. You will
certainly want to do this yourself for \s-1TCP\s0 connections, or the server will not
treat each message as a separate line. However with \s-1UDP\s0 the server should
accept a message without a trailing newline (though some implementations may
have difficulty with that).
.ie n .IP "$logger\->set_receiver($proto, $hostname, $port)" 4
.el .IP "\f(CW$logger\fR\->set_receiver($proto, \f(CW$hostname\fR, \f(CW$port\fR)" 4
.IX Item "$logger->set_receiver($proto, $hostname, $port)"
Change the protocol, destination host, and port. This will force a reconnection
in \s-1LOG_TCP\s0 or \s-1LOG_UNIX\s0 mode.
.ie n .IP "$logger\->set_priority($facility, $severity)" 4
.el .IP "\f(CW$logger\fR\->set_priority($facility, \f(CW$severity\fR)" 4
.IX Item "$logger->set_priority($facility, $severity)"
Change both the syslog facility and severity.
.ie n .IP "$logger\->set_facility($facility)" 4
.el .IP "\f(CW$logger\fR\->set_facility($facility)" 4
.IX Item "$logger->set_facility($facility)"
Change only the syslog facility.
.ie n .IP "$logger\->set_severity($severity)" 4
.el .IP "\f(CW$logger\fR\->set_severity($severity)" 4
.IX Item "$logger->set_severity($severity)"
Change only the syslog severity.
.ie n .IP "$logger\->set_sender($sender)" 4
.el .IP "\f(CW$logger\fR\->set_sender($sender)" 4
.IX Item "$logger->set_sender($sender)"
Change what is sent as the hostname of the sender.
.ie n .IP "$logger\->set_name($name)" 4
.el .IP "\f(CW$logger\fR\->set_name($name)" 4
.IX Item "$logger->set_name($name)"
Change what is sent as the name of the sending program.
.ie n .IP "$logger\->set_pid($name)" 4
.el .IP "\f(CW$logger\fR\->set_pid($name)" 4
.IX Item "$logger->set_pid($name)"
Change what is sent as the process id of the sending program.
.ie n .IP "$logger\->set_format($format)" 4
.el .IP "\f(CW$logger\fR\->set_format($format)" 4
.IX Item "$logger->set_format($format)"
Change the message format. This should be either the constant \s-1LOG_RFC3164\s0 (the
default) or \s-1LOG_RFC5424\s0.
.ie n .IP "$logger\->\fIget_priority()\fR" 4
.el .IP "\f(CW$logger\fR\->\fIget_priority()\fR" 4
.IX Item "$logger->get_priority()"
Returns the current priority value.
.ie n .IP "$logger\->\fIget_facility()\fR" 4
.el .IP "\f(CW$logger\fR\->\fIget_facility()\fR" 4
.IX Item "$logger->get_facility()"
Returns the current facility value.
.ie n .IP "$logger\->\fIget_severity()\fR" 4
.el .IP "\f(CW$logger\fR\->\fIget_severity()\fR" 4
.IX Item "$logger->get_severity()"
Returns the current severity value.
.ie n .IP "$logger\->get_format($format)" 4
.el .IP "\f(CW$logger\fR\->get_format($format)" 4
.IX Item "$logger->get_format($format)"
Returns the current message format.
.SH "UNREACHABLE SERVERS"
.IX Header "UNREACHABLE SERVERS"
If the remote syslogd is unreachable, certain methods may throw an exception or
raise a signal:
.IP "\(bu" 4
\&\s-1LOG_TCP\s0
.Sp
If the server is unreachable at connect time, \fI\->new\fR will fail with an
exception. If an established connection is closed remotely, \fI\->send\fR will
fail with an exception.
.IP "\(bu" 4
\&\s-1LOG_UDP\s0
.Sp
As \s-1UDP\s0 is connectionless, \fI\->new\fR will not throw an error as no attempt to
connect is made then. However, if the remote server starts or becomes unreachable and
1) the host is alive but 2) not listening on the specified port, and
3) \s-1ICMP\s0 packets are routable to the client, an exception \fBmay\fR be thrown by \fI\->send\fR; note that this may happen only on the second call, and subsequently
every other one. This behavior also depends on specific kernel interactions.
.IP "\(bu" 4
\&\s-1LOG_UNIX\s0
.Sp
With both \s-1SOCK_STREAM\-\s0 and SOCK_DGRAM\-based servers, \fI\->new\fR will throw an
exception if the socket is missing or not connectable.
.Sp
With \s-1SOCK_DGRAM\s0, \fI\->send\fR to a peer that went away will throw. With
\&\s-1SOCK_STREAM\s0, \fI\->send\fR to a peer that went away will raise \s-1SIGPIPE\s0.
.SH "EXPORTS"
.IX Header "EXPORTS"
Use Log::Syslog::Constants to export priority constants, e.g. \s-1LOG_INFO\s0.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Log::Syslog::Constants
.PP
Sys::Syslog
.SH "BUGS"
.IX Header "BUGS"
\&\s-1LOG_UNIX\s0 with \s-1SOCK_DGRAM\s0 has not been well tested.
.SH "AUTHOR"
.IX Header "AUTHOR"
Adam Thomason,
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright (C) 2009\-2011 by Say Media, Inc.
.PP
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.
man/man3/Log::Syslog::Fast::XS.3pm 0000666 00000010501 15047332065 0012353 0 ustar 00 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" 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" ''
'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 turned on, 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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Log::Syslog::Fast::XS 3"
.TH Log::Syslog::Fast::XS 3 "2012-01-04" "perl v5.10.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"
Log::Syslog::Fast::XS \- XS implementation of Log::Syslog::Fast
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This is the \s-1XS\s0 implementation of Log::Syslog::Fast. See its documentation
for usage.
.SH "AUTHOR"
.IX Header "AUTHOR"
Adam Thomason,
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright (C) 2009\-2011 by Say Media, Inc.
.PP
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.
perl5/Log/Syslog/Constants.pm 0000666 00000012554 15047332065 0012126 0 ustar 00 package Log::Syslog::Constants;
use 5.6.2;
use strict;
use warnings;
our $VERSION = '1.02';
# severities
use constant LOG_EMERG => 0; # system is unusable
use constant LOG_ALERT => 1; # action must be taken immediately
use constant LOG_CRIT => 2; # critical conditions
use constant LOG_ERR => 3; # error conditions
use constant LOG_WARNING => 4; # warning conditions
use constant LOG_NOTICE => 5; # normal but significant condition
use constant LOG_INFO => 6; # informational
use constant LOG_DEBUG => 7; # debug-level messages
# facilities
use constant LOG_KERN => 0; # kernel messages
use constant LOG_USER => 1; # random user-level messages
use constant LOG_MAIL => 2; # mail system
use constant LOG_DAEMON => 3; # system daemons
use constant LOG_AUTH => 4; # security/authorization messages
use constant LOG_SYSLOG => 5; # messages generated internally by syslogd
use constant LOG_LPR => 6; # line printer subsystem
use constant LOG_NEWS => 7; # network news subsystem
use constant LOG_UUCP => 8; # UUCP subsystem
use constant LOG_CRON => 9; # clock daemon
use constant LOG_AUTHPRIV => 10; # security/authorization messages (private)
use constant LOG_FTP => 11; # ftp daemon
use constant LOG_LOCAL0 => 16; # reserved for local use
use constant LOG_LOCAL1 => 17; # reserved for local use
use constant LOG_LOCAL2 => 18; # reserved for local use
use constant LOG_LOCAL3 => 19; # reserved for local use
use constant LOG_LOCAL4 => 20; # reserved for local use
use constant LOG_LOCAL5 => 21; # reserved for local use
use constant LOG_LOCAL6 => 22; # reserved for local use
use constant LOG_LOCAL7 => 23; # reserved for local use
my %_severities_by_name = (
emerg => LOG_EMERG,
alert => LOG_ALERT,
crit => LOG_CRIT,
err => LOG_ERR,
warning => LOG_WARNING,
notice => LOG_NOTICE,
info => LOG_INFO,
debug => LOG_DEBUG,
);
my %_facilities_by_name = (
kern => LOG_KERN,
user => LOG_USER,
mail => LOG_MAIL,
daemon => LOG_DAEMON,
auth => LOG_AUTH,
syslog => LOG_SYSLOG,
lpr => LOG_LPR,
news => LOG_NEWS,
uucp => LOG_UUCP,
cron => LOG_CRON,
authpriv => LOG_AUTHPRIV,
ftp => LOG_FTP,
local0 => LOG_LOCAL0,
local1 => LOG_LOCAL1,
local2 => LOG_LOCAL2,
local3 => LOG_LOCAL3,
local4 => LOG_LOCAL4,
local5 => LOG_LOCAL5,
local6 => LOG_LOCAL6,
local7 => LOG_LOCAL7,
);
sub get_severity {
$_severities_by_name{lc $_[0]};
}
sub get_facility {
$_facilities_by_name{lc $_[0]};
}
require Exporter;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = (
severities => [qw/
LOG_EMERG LOG_ALERT LOG_CRIT LOG_ERR LOG_WARNING
LOG_NOTICE LOG_INFO LOG_DEBUG
/],
facilities => [qw/
LOG_KERN LOG_USER LOG_MAIL LOG_DAEMON LOG_AUTH
LOG_SYSLOG LOG_LPR LOG_NEWS LOG_UUCP LOG_CRON
LOG_AUTHPRIV LOG_FTP LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2
LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7
/],
functions => [qw/
get_severity get_facility
/],
);
@{ $EXPORT_TAGS{'all'} } = (
@{ $EXPORT_TAGS{'facilities'} },
@{ $EXPORT_TAGS{'severities'} },
@{ $EXPORT_TAGS{'functions'} },
);
our @EXPORT_OK = @{ $EXPORT_TAGS{'all'} };
our @EXPORT = qw();
1;
__END__
=head1 NAME
Log::Syslog::Constants - Perl extension containing syslog priority constants as
defined in RFC3164.
=head1 SYNOPSIS
use Log::Syslog::Constants ':all';
@severities = (
LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO,
LOG_DEBUG
);
@facilities = (
LOG_KERN, LOG_USER, LOG_MAIL, LOG_DAEMON, LOG_AUTH, LOG_SYSLOG, LOG_LPR,
LOG_NEWS, LOG_UUCP, LOG_CRON, LOG_AUTHPRIV, LOG_FTP, LOG_LOCAL0,
LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6,
LOG_LOCAL7
);
$info_constant = get_severity('INFO');
$local0_constant = get_facility('local0');
=head1 DESCRIPTION
Syslog messages--as standardized in RFC3164--embed a priority number (the PRI
part) which is composed of a severity and a facility value. The constants which
encode these values are specified in section 4.1.1, and are made available by
this module. For instance, the exportable LOG_FTP constant has a value of 11,
the value for the FTP facility.
=head1 EXPORTS
Nothing is exported by default. You may optionally import individual constants
and functions or groups of them:
use Log::Syslog::Constants qw(:severities); # LOG_CRIT, LOG_DEBUG, etc
use Log::Syslog::Constants qw(:facilities); # LOG_CRON, LOG_LOCAL3, etc
use Log::Syslog::Constants qw(:functions); # get_facility, get_severity
use Log::Syslog::Constants qw(:all); # all of the above
=head1 FUNCTIONS
=over 4
=item * get_facility($facility_string)
=item * get_severity($severity_string)
These functions look up a constant value by name, e.g.
C.
=back
=head1 SEE ALSO
L
=head1 AUTHOR
Adam Thomason, Eathomason@cpan.orgE
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2010-2011 by Say Media, Inc.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.
=cut
perl5/DNS/ZoneParse.pm 0000666 00000122536 15047332065 0010505 0 ustar 00 # DNS::ZoneParse
# Parse and Manipulate DNS Zonefiles
package DNS::ZoneParse;
use 5.006;
use Storable 'dclone';
use POSIX 'strftime';
use File::Basename;
use vars qw($VERSION);
use strict;
use Carp;
# It makes everyone's life easier if you double-escape the backslash, and only
# the backslash, here.
my @ESCAPABLE_CHARACTERS = qw/ ; " \\\\ /;
my $rr_class = qr/(?:IN|HS|CH)/i;
my $rr_ttl = qr/(?:\d+[wdhms]?)+/i;
$VERSION = '1.10';
my (
%dns_id, %dns_soa, %dns_ns, %dns_a, %dns_cname, %dns_mx, %dns_txt,
%dns_ptr, %dns_a4, %dns_srv, %dns_hinfo, %dns_rp, %dns_loc,
%dns_generate,
%dns_last_name, %dns_last_origin, %dns_last_class, %dns_last_ttl,
%dns_found_origins, %unparseable_line_callback, %last_parse_error_count,
);
my %possibly_quoted = map { $_ => undef } qw/ os cpu text mbox /;
sub new {
my $class = shift;
my $file = shift;
my $origin = shift;
my $unparseable_callback = shift;
my $self = bless [], $class;
if ( ref $unparseable_callback eq 'CODE' ) {
$unparseable_line_callback{$self} = $unparseable_callback;
}
$self->_initialize();
$self->_load_file( $file, $origin ) if $file;
return $self;
}
sub on_unparseable_line {
my $self = shift;
my $arg = shift;
if ( !defined $arg ) {
return $unparseable_line_callback{$self};
} elsif ( ref $arg eq 'CODE' ) {
my $old = $unparseable_line_callback{$self};
$unparseable_line_callback{$self} = $arg;
return $old;
} else {
return undef;
}
}
sub last_parse_error_count {
my $self = shift;
return $last_parse_error_count{$self};
}
sub DESTROY {
my $self = shift;
delete $dns_soa{$self};
delete $dns_ns{$self};
delete $dns_a{$self};
delete $dns_cname{$self};
delete $dns_mx{$self};
delete $dns_txt{$self};
delete $dns_ptr{$self};
delete $dns_a4{$self};
delete $dns_srv{$self};
delete $dns_hinfo{$self};
delete $dns_rp{$self};
delete $dns_loc{$self};
delete $dns_id{$self};
delete $dns_generate{$self};
delete $dns_last_name{$self};
delete $dns_last_origin{$self};
delete $dns_last_ttl{$self};
delete $dns_last_class{$self};
delete $dns_found_origins{$self};
delete $unparseable_line_callback{$self};
delete $last_parse_error_count{$self};
}
sub AUTOLOAD {
my $self = shift;
( my $method = $DNS::ZoneParse::AUTOLOAD ) =~ s/.*:://;
my $rv =
$method eq 'soa' ? $dns_soa{$self}
: $method eq 'ns' ? $dns_ns{$self}
: $method eq 'a' ? $dns_a{$self}
: $method eq 'cname' ? $dns_cname{$self}
: $method eq 'mx' ? $dns_mx{$self}
: $method eq 'txt' ? $dns_txt{$self}
: $method eq 'ptr' ? $dns_ptr{$self}
: $method eq 'aaaa' ? $dns_a4{$self}
: $method eq 'srv' ? $dns_srv{$self}
: $method eq 'hinfo' ? $dns_hinfo{$self}
: $method eq 'rp' ? $dns_rp{$self}
: $method eq 'loc' ? $dns_loc{$self}
: $method eq 'generate' ? $dns_generate{$self}
: $method eq 'zonefile' ? $dns_id{$self}->{ZoneFile}
: $method eq 'origin' ? $dns_id{$self}->{Origin}
: undef;
croak "Invalid method called: $method" unless defined $rv;
return $rv;
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Public OO Methods
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub dump {
# returns a HOH for use with XML modules, etc
my $self = shift;
return dclone( {
SOA => $dns_soa{$self},
AAAA => $dns_a4{$self},
A => $dns_a{$self},
NS => $dns_ns{$self},
CNAME => $dns_cname{$self},
MX => $dns_mx{$self},
PTR => $dns_ptr{$self},
TXT => $dns_txt{$self},
SRV => $dns_srv{$self},
HINFO => $dns_hinfo{$self},
RP => $dns_rp{$self},
LOC => $dns_loc{$self},
} );
}
sub new_serial {
my $self = shift;
my $incriment = shift || 0;
my $soa = $dns_soa{$self};
if ( $incriment > 0 ) {
$soa->{serial} += $incriment;
} else {
my $newserial = strftime( "%Y%m%d%H", localtime( time ) );
$soa->{serial} =
( $newserial > $soa->{serial} )
? $newserial
: $soa->{serial} + 1;
}
return $soa->{serial};
}
sub output {
my $self = shift;
my $zone_ttl = $dns_soa{$self}{ttl} ? "\$TTL $dns_soa{$self}{ttl}" : '';
my $output = '';
$output .= <{ZoneFile} for $dns_id{$self}->{Origin} zone.
; Zone version: $dns_soa{$self}->{serial}
;
ZONEHEADER1
if ( $dns_soa{$self}->{'ORIGIN'} ne $dns_soa{$self}->{'origin'} ) {
$output .= "\n\$ORIGIN $dns_soa{$self}->{'ORIGIN'}\n\n";
}
$output .= <{origin} $dns_soa{$self}->{ttl} IN SOA $dns_soa{$self}->{primary} $dns_soa{$self}->{email} (
$dns_soa{$self}->{serial} ; serial number
$dns_soa{$self}->{refresh} ; refresh
$dns_soa{$self}->{retry} ; retry
$dns_soa{$self}->{expire} ; expire
$dns_soa{$self}->{minimumTTL} ; minimum TTL
)
;
; Zone NS Records
;
ZONEHEADER2
my @origins_to_process = grep {
if ( $_ eq $dns_soa{$self}->{'ORIGIN'} ) {
0;
} else {
1;
}
} keys %{ $dns_found_origins{$self} };
unshift @origins_to_process, $dns_soa{$self}->{'ORIGIN'};
foreach my $process_this_origin ( @origins_to_process ) {
if ( $process_this_origin ne $dns_soa{$self}->{'ORIGIN'} ) {
$output .= "\n\;\n\; $process_this_origin records\n\;\n\n";
$output .= "\$ORIGIN $process_this_origin\n\n";
}
foreach my $o ( @{ $dns_ns{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} NS $o->{host}\n";
}
foreach my $o ( @{ $dns_mx{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} MX $o->{priority} $o->{host}\n";
}
foreach my $o ( @{ $dns_a{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} A $o->{host}\n";
}
foreach my $o ( @{ $dns_cname{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} CNAME $o->{host}\n";
}
foreach my $o ( @{ $dns_a4{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} AAAA $o->{host}\n";
}
foreach my $o ( @{ $dns_txt{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= qq[$o->{name} $o->{ttl} $o->{class} TXT "$o->{text}"\n];
}
foreach my $o ( @{ $dns_ptr{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} PTR $o->{host}\n";
}
foreach my $o ( @{ $dns_srv{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} SRV $o->{priority} $o->{weight} $o->{port} $o->{host}\n";
}
foreach my $o ( @{ $dns_hinfo{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} HINFO $o->{cpu} $o->{os}\n";
}
foreach my $o ( @{ $dns_rp{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} RP $o->{mbox} $o->{text}\n";
}
foreach my $o ( @{ $dns_loc{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "$o->{name} $o->{ttl} $o->{class} LOC $o->{d1} $o->{m1} $o->{s1} $o->{NorS} ";
$output .= "$o->{d2} $o->{m2} $o->{s2} $o->{EorW} ";
$output .= "$o->{alt} $o->{siz} $o->{hp} $o->{vp}\n";
}
foreach my $o ( @{ $dns_generate{$self} } ) {
next unless defined $o;
next unless $o->{'ORIGIN'} eq $process_this_origin;
$self->_escape_chars( $o );
$output .= "\$GENERATE $o->{range} $o->{lhs} $o->{ttl} $o->{class} $o->{type} $o->{rhs}\n";
}
}
return $output;
}
sub fqname {
my ( $self, $record_ref ) = @_;
# Is this an SOA record?
if ( $record_ref->{'origin'} ) {
if ( ( $record_ref->{'origin'} eq '@' ) || ( $record_ref->{'origin'} =~ /\.$/ ) ) {
return $record_ref->{'ORIGIN'};
} else {
if ( $record_ref->{'ORIGIN'} =~ /^\./ ) {
return $record_ref->{'origin'} . $record_ref->{'ORIGIN'};
}
return $record_ref->{'origin'} . '.' . $record_ref->{'ORIGIN'};
}
} else {
if ( $record_ref->{'name'} eq '@' ) {
return $record_ref->{'ORIGIN'};
} else {
if ( $record_ref->{'ORIGIN'} =~ /^\./ ) {
return $record_ref->{'name'} . $record_ref->{'ORIGIN'};
}
return $record_ref->{'name'} . '.' . $record_ref->{'ORIGIN'};
}
}
}
sub ttl_to_int {
my ( $self, $t ) = @_;
# Passed in nothing? Huh?
if ( !$t ) {
return 0;
}
# If it's all digits already, just pass it right back.
if ( $t =~ /^\d+$/ ) {
return $t;
}
# If it doesn't look like a valid TTL string, error. We know, because of
# the above test, that it's not just a number, if we got this far.
if ( $t !~ /^(?:\d+[WDHMS])+$/i ) {
die "Unknown TTL string format!\n";
}
$t = uc( $t );
my $r;
my %ttl;
while ( $t =~ /(\d+)([WDHMS])/g ) {
# Did we already see this modifier?
if ( defined $ttl{ $2 } ) { die "Invalid TTL!\n"; }
$ttl{ $2 } = $1;
}
foreach my $m ( qw/ W D H M S / ) {
if ( !exists $ttl{ $m } ) { $ttl{ $m } = 0; }
}
$r = $ttl{'W'} * 7;
$r = ( $r + $ttl{'D'} ) * 24;
$r = ( $r + $ttl{'H'} ) * 60;
$r = ( $r + $ttl{'M'} ) * 60;
$r = ( $r + $ttl{'S'} );
die unless $r == $ttl{'S'} + 60 * ( $ttl{'M'} + 60 * ( $ttl{'H'} + 24 * ( $ttl{'D'} + 7 * $ttl{'W'} ) ) );
return $r;
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Private Methods
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub _initialize {
my $self = shift;
$dns_id{$self} = {};
$dns_soa{$self} = {};
$dns_ns{$self} = [];
$dns_a{$self} = [];
$dns_cname{$self} = [];
$dns_mx{$self} = [];
$dns_txt{$self} = [];
$dns_ptr{$self} = [];
$dns_a4{$self} = [];
$dns_srv{$self} = [];
$dns_hinfo{$self} = [];
$dns_rp{$self} = [];
$dns_loc{$self} = [];
$dns_generate{$self} = [];
$dns_last_name{$self} = undef;
$dns_last_origin{$self} = undef;
$dns_last_ttl{$self} = undef;
$dns_last_class{$self} = 'IN'; # Class defaults to IN.
$dns_found_origins{$self} = {};
$last_parse_error_count{$self} = 0;
return 1;
}
sub _load_file {
my ( $self, $zonefile, $origin ) = @_;
my $zone_contents;
if ( ref( $zonefile ) eq 'SCALAR' ) {
$zone_contents = $$zonefile;
} else {
my $inZONE;
if ( open( $inZONE, '<', $zonefile ) ) {
local $/;
$zone_contents = <$inZONE>;
close( $inZONE );
} else {
croak qq[DNS::ZoneParse Could not open input file: "$zonefile":$!];
}
}
if ( $self->_parse( $zonefile, $zone_contents, $origin ) ) { return 1; }
}
sub _parse {
# Support IsAlnum for unicode names.
use utf8;
my ( $self, $zonefile, $contents, $origin ) = @_;
$self->_initialize();
# Here's how we auto-detect the zonefile and origin. Note, the zonefile is
# only used to print out a comment in the file, so its okay if we're
# inaccurate. First, prefer what the user configures. Next, try to read a
# comment we would have written if we wrote the file out in the past.
# Finally, pick up any SOA or $ORIGIN statements present in the file.
if ( ref( $zonefile ) eq 'SCALAR' ) { $zonefile = ''; }
if ( !$origin || !$zonefile ) {
# I don't know why the ( dns)? capture is there, perhaps at one point
# this module wrote a different header comment? I'll leave it as to
# preserve whatever backwards compatability this affords us...
$contents =~ /^\s*;\s*Database file (\S+)( dns)? for (\S+) zone/im;
if ( !$origin && $3 ) { $origin = $3; }
if ( !$zonefile && $1 ) { $zonefile = $1; }
}
if ( $zonefile ) {
$zonefile = basename( $zonefile );
} else {
$zonefile = 'unknown';
}
if ( $origin ) {
# A trite way of insuring there is a trailing dot on the origin. It's
# really important you supply a trailing . in an origin when you mean
# it.
$origin =~ s/([^.])$/$1./;
} else {
$origin = '';
}
$dns_id{$self} = {
ZoneFile => $zonefile,
Origin => $origin,
};
my $records = $self->_clean_records( $contents );
# Everything valid in the name, except the '.' character.
my $valid_name_start_char = q/(?:[\p{IsAlnum}\@_\-*:+=!#$%^&`~,\[\]{}|?'\/]|/
. join( '|', map { "\\\\$_" } @ESCAPABLE_CHARACTERS ) . ')';
# The above, but adds the literal '.' character.
my $valid_name_char = qr/(?:$valid_name_start_char|[\.\\])/o;
my $valid_txt_char = qr/\S+/o;
my $valid_quoted_txt_char = qr/.+/o;
# Like the above, but adds whitespace (space and tabs) too.
my $valid_quoted_name_char = qr/(?:$valid_name_start_char|[. ;\t()\\])/o;
my $valid_name = qr/$valid_name_start_char$valid_name_char*/o;
my $valid_ip6 = qr/[\@a-zA-Z_\-\.0-9\*:]+/;
my $rr_type = qr/\b(?:NS|A|CNAME)\b/i;
#my $ttl_cls = qr/(?:($rr_ttl)\s)?(?:($rr_class)\s)?/o;
my $ttl_cls = qr/(?:\b((?:$rr_ttl)|(?:$rr_class))\s)?(?:\b((?:$rr_class)|(?:$rr_ttl))\s)?/o;
my $generate_range = qr{\d+\-\d+(?:/\d+)?};
my $last_good_line;
foreach ( @$records ) {
#TRACE( "parsing line <$_>" );
# It's faster to skip blank lines here than to remove them inside
# _clean_records.
next if /^\s*$/;
# The below is inside of an eval block to catch possible errors
# found inside _massage and propagate them up properly.
eval {
local $SIG{__DIE__} = 'DEFAULT';
if (
/^($valid_name)? \s+ # host
$ttl_cls # ttl & class
($rr_type) \s # record type
($valid_name) # record data
/ixo
)
{
my ( $name, $ttl, $class, $type, $host ) = ( $1, $2, $3, $4, $5 );
my $dns_thing =
uc $type eq 'NS' ? $dns_ns{$self}
: uc $type eq 'A' ? $dns_a{$self}
: $dns_cname{$self};
push @$dns_thing,
$self->_massage( {
name => $name,
class => $class,
host => $host,
ttl => $ttl,
} );
} elsif (
/^($valid_name)? \s+
$ttl_cls
AAAA \s
($valid_ip6)
/ixo
)
{
my ( $name, $ttl, $class, $host ) = ( $1, $2, $3, $4 );
push @{ $dns_a4{$self} },
$self->_massage( {
name => $name,
class => $class,
host => $host,
ttl => $ttl,
} );
} elsif (
/^($valid_name)? \s+
$ttl_cls
MX \s+
(\d+) \s+
($valid_name_char+)
/ixo
)
{
# host ttl class mx pri dest
my ( $name, $ttl, $class, $pri, $host ) = ( $1, $2, $3, $4, $5 );
push @{ $dns_mx{$self} },
$self->_massage( {
name => $name,
priority => $pri,
host => $host,
ttl => $ttl,
class => $class,
} );
} elsif (
/^($valid_name)? \s+
$ttl_cls
SRV \s+
(\d+) \s+
(\d+) \s+
(\d+) \s+
($valid_name)
/ixo
)
{
# host ttl class mx priority weight port dest
my ( $name, $ttl, $class, $pri, $weight, $port, $host ) = ( $1, $2, $3, $4, $5, $6, $7 );
push @{ $dns_srv{$self} },
$self->_massage( {
name => $name,
priority => $pri,
weight => $weight,
port => $port,
host => $host,
ttl => $ttl,
class => $class,
} );
} elsif (
/^($valid_name) \s+
$ttl_cls
SOA \s+
($valid_name) \s+
($valid_name) \s+
($rr_ttl) \s+
($rr_ttl) \s+
($rr_ttl) \s+
($rr_ttl) \s+
($rr_ttl)
/ixo
)
{
# SOA record
$dns_soa{$self} = $self->_massage( {
origin => $1,
ttl => $2,
class => $3,
primary => $4,
email => $5,
serial => $6,
refresh => $7,
retry => $8,
expire => $9,
minimumTTL => $10,
} );
if ( !$origin ) {
$origin = $1;
$dns_id{$self} = {
ZoneFile => $zonefile,
Origin => $origin,
};
}
} elsif (
/^($valid_name)? \s+
$ttl_cls
PTR \s+
($valid_name)
/ixo
)
{
# PTR
push @{ $dns_ptr{$self} },
$self->_massage( {
name => $1,
class => $3,
ttl => $2,
host => $4,
} );
} elsif (
/($valid_name)? \s+
$ttl_cls
TXT \s+
("$valid_quoted_txt_char*(?_massage( {
name => $1,
ttl => $2,
class => $3,
text => $4,
} );
} elsif (
/^\s*\$TTL \s+
($rr_ttl)
/ixo
) {
if ( !defined $dns_soa{$self} ) {
$dns_soa{$self}->{ttl} = $1;
}
$dns_last_ttl{$self} = $1;
} elsif (
/^($valid_name)? \s+
$ttl_cls
HINFO \s+
("$valid_quoted_txt_char*(?_massage( {
name => $1,
ttl => $2,
class => $3,
cpu => $4,
os => $5,
} );
} elsif (
/^($valid_name)? \s+
$ttl_cls
RP \s+
($valid_name_char+) \s+
($valid_name_char+)
/ixo
)
{
push @{ $dns_rp{$self} },
$self->_massage( {
name => $1,
ttl => $2,
class => $3,
mbox => $4,
text => $5,
} );
} elsif (
/^($valid_name)? \s+
$ttl_cls
LOC \s+
(-?[\d\.]+) \s*
([\d\.]*) \s*
([\d\.]*) \s+
([NS]) \s+
(-?[\d\.]+) \s*
([\d\.]*) \s*
([\d\.]*) \s+
([EW]) \s*
(-?[\d\.]*m?) \s*
([\d\.]*m?) \s*
([\d\.]*m?) \s*
([\d\.]*m?)
/ixo
)
{
push @{ $dns_loc{$self} },
$self->_massage( {
name => $1,
ttl => $2,
class => $3,
d1 => $4,
m1 => $5,
s1 => $6,
NorS => $7,
d2 => $8,
m2 => $9,
s2 => $10,
EorW => $11,
alt => $12,
siz => $13,
hp => $14,
vp => $15,
} );
} elsif ( /^\s*\$ORIGIN\s+($valid_name_char+)/io ) {
my $new_origin = $1;
# We could track each origins origin, all the way down, but what
# would that get us? Madness, surely.
if ( $new_origin !~ /\.$/ ) {
if ( $dns_last_origin{$self} =~ /^\./ ) {
$new_origin .= $dns_last_origin{$self};
} else {
$new_origin .= '.' . $dns_last_origin{$self};
}
}
$dns_last_origin{$self} = $new_origin;
$dns_found_origins{$self}->{ $new_origin } = 1;
} elsif ( /^ \s* \$GENERATE \s+
($generate_range) \s+ # range
($valid_name) \s+ # lhs
(?:($rr_ttl) \s+)? # ttl
(?:($rr_class) \s+)? # class
([a-z]+) \s+ # type
($valid_name) # rhs
/ixo
)
{
push @{ $dns_generate{$self} },
$self->_massage( {
range => $1,
lhs => $2,
ttl => $3,
class => $4,
type => $5,
rhs => $6,
} );
} else {
die "Unknown record type\n";
}
}; # End of eval block.
if ( $@ ) {
chomp $@;
$last_parse_error_count{$self}++;
if ( $unparseable_line_callback{$self} ) {
$unparseable_line_callback{$self}->( $self, $_, $@, $last_good_line );
} else {
carp "Unparseable line ($@)\n $_\n";
}
} else {
$last_good_line = $_;
}
}
return 1;
}
sub _clean_records {
my $self = shift;
my $zone = shift;
my $x = 0;
my $in_comment = 0;
my $in_quote = 0;
my $in_concat = 0;
my $last_char = '';
my $next_is_escaped = 0;
my @lines;
$zone =~ s/\r\n/\n/sg;
$zone =~ s{[ \t]+}{ }g; # Collapse whitespace, turn TABs to spaces.
# Trim comments, handle parentheses and some escape sequences.
while (1) {
my $c = substr( $zone, $x, 1 );
# If we're not in a comment then process parentheses, braces, comment
# tags, and quotes. If not, just look for the newline.
if ( !$in_comment ) {
if ( !$next_is_escaped ) {
if ( $c eq '"' ) {
$in_quote = !$in_quote;
} elsif ( $c eq '\\' ) {
$next_is_escaped = 1;
} elsif ( !$in_quote ) {
if ( $c eq ';' ) {
$in_comment = 1;
substr( $zone, $x, 1 ) = '';
$x--;
} elsif ( $c eq '(' ) {
substr( $zone, $x, 1 ) = ' ';
$in_concat++;
} elsif ( ( $in_concat ) && ( $c eq ')' ) ) {
substr( $zone, $x, 1 ) = ' ';
$in_concat--;
}
}
} else {
$next_is_escaped = 0;
}
} elsif ( $c ne "\n" ) {
substr( $zone, $x, 1 ) = '';
$x--;
}
if ( $c eq "\n" ) {
$in_comment = 0;
if ( $in_concat ) {
substr( $zone, $x, 1 ) = '';
$x--;
}
}
$x++;
if ( $x >= length( $zone ) ) { last; }
$last_char = $c;
}
return [ split( /\n/, $zone ) ];
}
sub _massage {
my ( $self, $record ) = @_;
foreach my $r ( keys %$record ) {
if ( !defined $record->{$r} ) {
$record->{$r} = '';
next;
}
if ( exists $possibly_quoted{$r} ) {
( $record->{$r} =~ s/^"// ) && ( $record->{$r} =~ s/"$// );
}
# We return email addresses just as they are in the file... for better
# or worse (mostly for backwards compatability reasons).
if ( $r ne 'email' && $r ne 'mbox' ) {
while ( $record->{$r} =~ m/\\/g ) {
my $pos = pos( $record->{$r} );
my $escape_char = substr( $record->{$r}, $pos, 1 );
if ( $escape_char =~ /\d/ ) {
$escape_char = substr( $record->{$r}, $pos, 3 );
# Max oct value that converts to 255 in dec.
if ( ( $escape_char =~ /^\d{3}$/ ) && ( $escape_char <= 377 ) ) {
substr( $record->{$r}, $pos - 1, 4 ) = chr( oct( $escape_char ) );
} else {
die "Invalid escape sequence\n";
}
} else {
# Not followed by a digit, so just remove the backslash.
# Like BIND does...
substr( $record->{$r}, $pos - 1, 2 ) = $escape_char;
}
pos( $record->{$r} ) = $pos;
}
}
}
if (
( ( $record->{'class'} =~ $rr_class ) && ( $record->{'ttl'} =~ $rr_class ) )
||
( ( $record->{'class'} =~ $rr_ttl ) && ( $record->{'ttl'} =~ $rr_ttl ) )
) {
die "Invalid ttl/class values!\n";
};
if ( ( $record->{'class'} =~ $rr_ttl ) || ( $record->{'ttl'} =~ $rr_class ) ) {
my $x = $record->{'class'};
$record->{'class'} = $record->{'ttl'};
$record->{'ttl'} = $x;
}
if ( $record->{'class'} ) {
$record->{'class'} = uc $record->{'class'};
$dns_last_class{$self} = $record->{'class'};
} else {
# This case should never happen, because we supply a default.
#if ( !defined $dns_last_class{$self} ) {
# die "No class defined!\n";
#}
$record->{'class'} = $dns_last_class{$self};
}
# This is silly, but we don't know what type of record we are massaging at
# this point. We can detect an SOA record because it's the only type that
# supplies this value, which is what we need to do here to properly set
# the owner.
if ( exists $record->{'minimumTTL'} ) {
$dns_last_name{$self} = $record->{'origin'};
# In the case of an SOA record, we fall back to the minimumTTL value
# when a TTL isn't otherwise specified. This is what BIND does.
if ( $record->{'ttl'} ) {
$record->{'ttl'} = $dns_last_ttl{$self} = uc( $record->{'ttl'} );
} else {
if ( $dns_last_ttl{$self} ) {
$record->{'ttl'} = $dns_last_ttl{$self};
} else {
$record->{'ttl'} = $dns_last_ttl{$self} = uc( $record->{'minimumTTL'} );
}
}
if ( $record->{'origin'} eq '@' ) {
# We encountered a @ SOA line without an origin directive above
# it, so we will try and guess the origin.
if ( !$dns_last_origin{$self} ) {
if ( !$dns_id{$self}->{'Origin'} ) {
die "Unknown origin\n";
}
$dns_last_origin{$self} = $dns_id{$self}->{'Origin'};
}
$record->{'ORIGIN'} = $dns_last_origin{$self};
} else {
my $new_origin = $record->{'origin'};
# Similar to above, it's origins all the way down. Don't bother
# tracking each separately, just collapse them all into the
# current origin.
if ( $new_origin =~ /\.$/ ) {
# If no one has set an $ORIGIN before, we need to use the SOA
# line to do it.
if ( !$dns_last_origin{$self} ) {
$dns_last_origin{$self} = $new_origin;
}
}
# Now we have a valid ORIGIN for this SOA, so assign it.
$record->{'ORIGIN'} = $dns_last_origin{$self};
}
# Alright, make sure we know we found this origin.
$dns_found_origins{$self}->{ $record->{'ORIGIN'} } = 1;
# Not an SOA record.
} else {
# The silliness continues: only $GENERATE directives have a lhs, and
# don't need a 'name'.
if ( !exists $record->{'lhs'} ) {
if ( $record->{'name'} ) {
$dns_last_name{$self} = $record->{'name'};
} else {
#TRACE( "Record has no name, using last name" );
if ( !$dns_last_name{$self} ) {
die "No current owner name\n";
}
$record->{'name'} = $dns_last_name{$self};
}
}
if ( !$dns_last_origin{$self} ) {
die "Unknown origin\n";
} else {
$record->{'ORIGIN'} = $dns_last_origin{$self};
}
# Nothing special about TTL parsing for non-SOA records.
if ( $record->{'ttl'} ) {
$record->{'ttl'} = $dns_last_ttl{$self} = uc( $record->{'ttl'} );
} else {
if ( !defined $dns_last_ttl{$self} ) {
die "No ttl defined!\n";
}
$record->{'ttl'} = $dns_last_ttl{$self};
}
}
#DUMP( "Record parsed", $record );
return $record;
}
sub _escape_chars {
my $self = shift;
my $clean_me = shift;
local $" = '|';
foreach my $k ( keys( %{$clean_me} ) ) {
$clean_me->{$k} =~ s/(@ESCAPABLE_CHARACTERS)/\\$1/g;
}
}
sub TRACE { 0 && print @_, $/ }
sub DUMP { 0 && require Data::Dumper && TRACE( shift, Data::Dumper::Dumper( @_ ) ) }
1;
__END__
=head1 NAME
DNS::ZoneParse - Parse and manipulate DNS Zone Files.
=head1 SYNOPSIS
use DNS::ZoneParse;
my $zonefile = DNS::ZoneParse->new("/path/to/dns/zonefile.db", $origin);
# Get a reference to the MX records
my $mx = $zonefile->mx;
# Change the first mailserver on the list
$mx->[0] = { host => 'mail.localhost.com',
priority => 10,
name => '@' };
# update the serial number
$zonefile->new_serial();
# write the new zone file to disk
my $newzone;
open($newzone, '>', '/path/to/dns/zonefile.db') or die "error";
print $newzone $zonefile->output();
close $newzone;
=head1 INSTALLATION
perl Makefile.PL
make
make test
make install
Win32 users substitute "make" with "nmake" or equivalent.
nmake is available at http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe
=head1 DESCRIPTION
This module will parse a Zone File and put all the Resource Records (RRs)
into an anonymous hash structure. Various record types are supported, see the
L section for details. It could be useful for maintaining DNS zones,
or for transferring DNS zones to other servers. If you want to generate an
XML-friendly version of your zone files, it is easy to use XML::Simple with
this module once you have parsed the zone file.
DNS::ZoneParse scans the DNS zone file - removes comments and seperates
the file into its constituent records. It then parses each record and
stores the records internally. See below for information on the accessor
methods.
=head2 METHODS
=over 4
=item new
This creates the DNS::ZoneParse object and loads the zone file.
Example:
my $zonefile = DNS::ZoneParse->new("/path/to/zonefile.db");
You can also initialise the object with the contents of a file:
my $zonefile = DNS::ZoneParse->new( \$zone_contents );
You can pass a second, optional parameter to the constructor to supply an
C<$origin> if none can be found in the zone file.
my $zonefile = DNS::ZoneParse->new( \$zone_contents, $origin );
You can pass a third, optional parameter to the constructor to supply a
callback which will be called whenever an unparsable line is encountered in
the zone file. See C for details on this parameter and
how errors are handled when parsing zone files.
If you plan to pass a on_unparseable_line callback but do not wish to specify
an C<$origin>, pass 'undef' as the C<$origin> parameter.
=item a(), cname(), srv(), mx(), ns(), ptr(), txt(), hinfo(), rp(), loc()
These methods return references to the resource records. For example:
my $mx = $zonefile->mx;
Returns the mx records in an array reference.
All records (except SOA) have the following properties: 'ttl', 'class',
'host', 'name', 'ORIGIN'.
MX records also have a 'priority' property.
SRV records also have 'priority', 'weight' and 'port' properties.
TXT records also have a 'text' property representing the record's 'txt-data'
descriptive text.
HINFO records also have 'cpu' and 'os' properties.
RP records also have 'mbox' and 'text' properties.
LOC records also have 'd1', 'm1', 's1', 'NorS', 'd2', 'm2', 's2', 'EorW',
'alt', 'siz', 'hp', and 'vp', as per RFC 1876.
If there are no records of a given type in the zone, the call will croak with
an error message about an invalid method. (This is not an ideal behavior, but
has been kept for backwards compatibility.)
The 'ORIGIN' property is the fully-qualified origin of the record. See
L for details on constructing a fully qualified domain name. Note: for
SOA records, the 'ORIGIN' will match the 'origin' property when the SOA record
is specified as fully qualified.
=item soa()
Returns a hash reference with the following properties:
'serial', 'origin', 'primary', 'refresh', 'retry', 'ttl', 'minimumTTL',
'email', 'expire', 'class', 'ORIGIN'.
The 'ORIGIN' property is returned separate from 'origin' property, though the
data may be the same. 'ORIGIN' represents the implicit origin for the record
while 'origin' represents the origin specified on the SOA line in the file.
If the 'origin' value is relative (that is, does not end with a '.'), the
actual zone for which the SOA line applies must be computed by concatenating
the 'origin' and 'ORIGIN' values. See L for details. If the 'origin'
value is absolute, no computation is necessary and 'origin' is the same as
'ORIGIN'.
=item generate()
Returns an array of hashes representing $GENERATE directives present in the
zone. Note, $GENERATE directives are BIND-specific additions. They are not
expanded by DNS::ZoneParse, but users are able to access and modify these
directives. The following properties are returned:
'range', 'lhs', 'ttl', 'class', 'type', 'rhs', 'ORIGIN'.
See the BIND documentation for details on the syntax and usage of the $GENERATE
directive.
=item dump
Returns a copy of the datastructute that stores all the resource records. This
might be useful if you want to quickly transform the data into another format,
such as XML.
=item fqname
Takes a single parameter, a hash reference containing a record.
Returns the fully qualified name of this record, with a trailing '.'. In most
cases this is as simple as concatenating the 'name' and 'ORIGIN' with a '.'
unless 'name' is '@', in which case the fqname is simply the 'ORIGIN'. For
SOA records, the same process is performed on the 'origin' instead of 'name'.
Please note, fqname will not expand the right hand side of a record (ie,
CNAME, SOA, MX, etc). The user must expand these values via the above method.
=item ttl_to_int
Takes a single parameter, a string representing a valid record TTL.
Returns an integer representing the number of seconds the TTL represents.
Note, this does not take into account any leap-years, leap-seconds, DST
changes, etc. It is simply the count of the number of seconds in the specified
period of time.
=item new_serial
C incriments the Zone serial number. It will generate a
date-based serial number. Or you can pass a positive number to add to the
current serial number.
Examples:
$zonefile->new_serial();
# generates a new serial number based on date:
# YYYYmmddHH format, incriments current serial
# by 1 if the new serial is still smaller
$zonefile->new_serial(50);
# adds 50 to the original serial number
=item output
C