File Coverage

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


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