File Coverage

blib/lib/Siebel/Srvrmgr/Regexes.pm
Criterion Covered Total %
statement 7 7 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 7 7 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             package Siebel::Srvrmgr::Regexes;
2              
3             require Exporter;
4             our @ISA = qw(Exporter);
5             our @EXPORT_OK =
6             qw(SRVRMGR_PROMPT LOAD_PREF_RESP LOAD_PREF_CMD CONN_GREET SIEBEL_ERROR ROWS_RETURNED SIEBEL_SERVER);
7              
8             =pod
9              
10             =head1 NAME
11              
12             Siebel::Srvrmgr::Regexes - common regular expressions to match things in srvrmgr output
13              
14             =head1 SYNOPSIS
15              
16             use Siebel::Srvrmgr::Regexes qw(SRVRMGR_PROMPT);
17              
18             if($line =~ /SRVRMGR_PROMPT/) {
19              
20             #do something
21              
22             }
23              
24             =head1 DESCRIPTION
25              
26             This modules exports several pre-compiled regular expressions by demand.
27              
28             =head1 EXPORTS
29              
30             =head2 SRVRMGR_PROMPT
31              
32             Regular expression to match the C<srvrmgr> prompt, with or without any command. It will match the server name, if included.
33              
34             =cut
35              
36             sub SRVRMGR_PROMPT {
37              
38 13156     13156 1 228549 return qr/^srvrmgr(\:[\w\_\-]+)?>\s(.*)?$/;
39              
40             }
41              
42             =head2 SIEBEL_SERVER
43              
44             Regular expression to match a valid Siebel Server name.
45              
46             =cut
47              
48             sub SIEBEL_SERVER {
49              
50 8     8 1 86 return qr/^([\w\_\-]+)$/;
51              
52             }
53              
54             =pod
55              
56             =head2 LOAD_PREF_RESP
57              
58             Regular expression to match the C<load preferences> response once the command is submitted.
59              
60             =cut
61              
62             sub LOAD_PREF_RESP {
63 38     38 1 257 return qr/^(srvrmgr(\:[\w\_\-]+)?>)?\s?File\:\s.*\.pref$/;
64             }
65              
66             =pod
67              
68             =head2 LOAD_PREF_CMD
69              
70             Regular expression to match the C<load preferences> command when submitted.
71              
72             =cut
73              
74 3     3 1 17 sub LOAD_PREF_CMD { return qr/^(srvrmgr(\:[\w\_\-]+)?>)?\s?load preferences$/; }
75              
76             =pod
77              
78             =head2 CONN_GREET
79              
80             Regular expression to match the first line submitted by a Siebel enterprise when the C<srvrmgr> connects to it. It will look like something like this:
81              
82             Siebel Enterprise Applications Siebel Server Manager, Version 8.0.0.7 [20426] LANG_INDEPENDENT
83              
84             It is a known issue that UTF-8 data with BOM character will cause this regular expression to B<not> match.
85              
86             =cut
87              
88             sub CONN_GREET {
89             return
90 188     188 1 1083 qr/^Siebel\sEnterprise\sApplications\sSiebel\sServer\sManager\,\sVersion.*/;
91             }
92              
93             =pod
94              
95             =head2 ROWS_RETURNED
96              
97             This regular expression should match the last but one line returned by a command, for example:
98              
99             136 rows returned.
100              
101             This line indicated how many rows were returned by a command.
102              
103             =cut
104              
105             sub ROWS_RETURNED {
106              
107 1369     1369 1 9519 return qr/^\d+\srows?\sreturned\./;
108              
109             }
110              
111             =pod
112              
113             =head2 SIEBEL_ERROR
114              
115             This regular expression should match errors from Siebel like, for example:
116              
117             SBL-SSM-00003: Error opening SISNAPI connection.
118             SBL-NET-01218: The connection was refused by server foobar. No component is listening on port 49170.
119              
120             The regular expression matches the default error code.
121              
122             =cut
123              
124             sub SIEBEL_ERROR {
125              
126 6     6 1 19 return qr/^SBL\-\w{3}\-\d+/;
127              
128             }
129              
130             =head1 AUTHOR
131              
132             Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>
133              
134             =head1 COPYRIGHT AND LICENSE
135              
136             This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>
137              
138             This file is part of Siebel Monitoring Tools.
139              
140             Siebel Monitoring Tools is free software: you can redistribute it and/or modify
141             it under the terms of the GNU General Public License as published by
142             the Free Software Foundation, either version 3 of the License, or
143             (at your option) any later version.
144              
145             Siebel Monitoring Tools is distributed in the hope that it will be useful,
146             but WITHOUT ANY WARRANTY; without even the implied warranty of
147             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
148             GNU General Public License for more details.
149              
150             You should have received a copy of the GNU General Public License
151             along with Siebel Monitoring Tools. If not, see <http://www.gnu.org/licenses/>.
152              
153             =cut
154              
155             1;