Svc.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 53 CC 4 SCAR 18.3
CC
4
Cov
0%
AUTOLOAD
12.0
_connect
6.0
login
2.0
CRAP 6.2
1 package Xpriori::XMS::Svc;
2  
3 use Xpriori::XMS::Http;
4 our $CstNeoCoreURL;
5 our $CstNeoCoreUsr;
6 our $CstNeoCorePwd;
7  
8 sub _connect(;$)
9 {
10 my ($sConn) = @_;
11 require 'Xpriori::XMS/NeoCoreSvc.cfg' if(!defined($CstNeoCoreURL));
12 return new Xpriori::XMS::Http(
13 $CstNeoCoreURL,
14 $CstNeoCoreUsr,
15 $CstNeoCorePwd, $sConn);
16 }
17 sub login($)
18 {
19 my ($oSelf) = @_;
20 my $oXpH = _connect();
21 my $sRes = $oXpH->getSID();
22 return $sRes;
23 }
24 sub logout($$)
25 {
26 my ($oSelf, $sConn) = @_;
27 my $oXpH = _connect($sConn);
28 return $oXpH->logout();
29 }
30 sub AUTOLOAD($$@)
31 {
32 my($oSelf, $sConn, @aPrm) = @_;
33 my $sPref = ref($oSelf);
34 $sPref ||= $oSelf;
35 $sPref .= '::';
36  
37 my $sMethod = $AUTOLOAD;
38 $sMethod = substr($sMethod, length($sPref));
39 if (grep {$_ eq $sMethod}
40 qw(
41 setTraceLevels getTraceLevels setIsolationLevel
42 startTransaction commitTransaction rollbackTransaction
43 queryXML deleteXML insertXML modifyXML copyXML
44 queryFlatXML queryXMLUpdateIntent queryCountXML queryTreeXML
45 queryDataContextXML getServerStatistics clearServerStatistics
46 getServerVersion storeXML
47 ))
48 {
49 my $oXpH = _connect($sConn);
50 my $sRes = $oXpH->$sMethod(@aPrm);
51 $oXpH->logout() unless($sConn);
52 return $sRes;
53 }
54 else
55 {
56 return "ERROR: No Method : >$sMethod< >>$sPref<<";
57 }
58 }
59 1;
60 __END__