| 1 | package OzDB; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.008006; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Benchmark; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | # Start the benchmark timer | ||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | my $t0 = new Benchmark; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | # Items to export into callers namespace by default. Note: do not export | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # names by default without a very good reason. Use EXPORT_OK instead. | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # Do not simply export all your public functions/methods/constants. | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | # This allows declaration use OzDB ':all'; | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # will save memory. | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | ) ] ); | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||||||||||||||||
| 33 | # 5/20/2005, NeXeN: Yet another versioning scheme. Altho PAUSE/CPAN | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # allows for x.y.z versioning schema, we'll move to x.yz so it'll show | ||||||||||||||||||||||||||||||||||||||||||
| 35 | # the minor version number correctly, with the revision point as the | ||||||||||||||||||||||||||||||||||||||||||
| 36 | # last digit. | ||||||||||||||||||||||||||||||||||||||||||
| 37 | # | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | # 5/19/2005, NeXeN: The new versioning scheme has been reset back to | ||||||||||||||||||||||||||||||||||||||||||
| 41 | # 0.0.1 for distribution with cpan. Please see the | ||||||||||||||||||||||||||||||||||||||||||
| 42 | # Changes file for more information. | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # our $VERSION = '0.1.3'; | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | # methods. | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | # my $t0 = new Benchmark; | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $package = shift; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return bless( {}, $package ); | |||||||||||||||||||||||||||||||||||||||||
| 53 | # my $t1 = new Benchmark; | ||||||||||||||||||||||||||||||||||||||||||
| 54 | # my $td = timediff($t1, $t0); | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # print "Your OzDB Request took aproximately ", timestr($td),"\n\nThe results of your request are as follows:\n\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub verbose { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verbose: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $self->{'verbose'} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | return $self->{'verbose'}; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub add_user { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_user: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | # add_user method allows for 4 arguments exactly like authenticate. The only | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # difference is the second argument is ignored, and the third and forth must | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # be string and integer respectively. First argument is the name of the db file | ||||||||||||||||||||||||||||||||||||||||||
| 72 | # | ||||||||||||||||||||||||||||||||||||||||||
| 73 | # This is a cumulative database. No remove functionality is implemented. | ||||||||||||||||||||||||||||||||||||||||||
| 74 | # | ||||||||||||||||||||||||||||||||||||||||||
| 75 | # format, add_user("userfile", "ignored", "user", "authlevel") | ||||||||||||||||||||||||||||||||||||||||||
| 76 | # authlevel being numeric value, ignored meaning the arg is not used | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | open( USRDB, "<$_[0]" ) or die "error opening user file: $_[0]\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my @lines = <USRDB>; # Read it into an array | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | close(USRDB); | |||||||||||||||||||||||||||||||||||||||||
| 81 | # check for correct syntax | ||||||||||||||||||||||||||||||||||||||||||
| 82 | # if ($_[3] !~ /^\d+$/ or $_[2] !~ /^[A-Za-z]+$/) | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if (not defined $_[3] or not defined $_[2] or $_[3] !~ /^\d+$/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $_[3] && defined $_[2] && $_[3] =~ /^\d+$/
defined $_[3] and defined $_[2]
MC/DC0%0/3
defined $_[3] && defined $_[2] && $_[3] =~ /^\d+$/
defined $_[3]
defined $_[2]
$_[3] =~ /^\d+$/
Truth table0%0/4
A and B && C
A= defined $_[3]B= defined $_[2]C= $_[3] =~ /^\d+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | { | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | print "The <username> must be letters only and the <auth_lvl> must be a number between 1 and 500\n"; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | return "0 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | else | ||||||||||||||||||||||||||||||||||||||||||
| 90 | { | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my $test; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | for $test (@lines) | |||||||||||||||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||||||||||||||||
| 94 | # skip lines that are comments or blank lines | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ($test =~ /^s*#/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | { | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | if ($test =~ /^$/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | { | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | # still in the for loop | ||||||||||||||||||||||||||||||||||||||||||
| 104 | # split the line up into into it's seporate values, delimited by space | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my (@words) = split(/ /, $test); | |||||||||||||||||||||||||||||||||||||||||
| 106 | # evaluate if the entry exists, if it does, exit the loop and give 'already exists' message | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if ($words[0] eq $_[2]) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | print "The user, $words[0], already exists.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | return "1 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | # ok, the user didn't match, so what do we do now? | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 115 | # go to the next one, duh | ||||||||||||||||||||||||||||||||||||||||||
| 116 | # still looping | ||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | # no longer in loop, but still else | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | # the entry doesnt exist, lets make one | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | print "Adding user $_[2] at authlevel $_[3].\n"; | |||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | # re-opening of the file, this time in append mode | ||||||||||||||||||||||||||||||||||||||||||
| 124 | # doesn't seem to be too much of an IO drain, I get 0 ms execution | ||||||||||||||||||||||||||||||||||||||||||
| 125 | # times tested up to 25mb file. Until sockets are implemented, | ||||||||||||||||||||||||||||||||||||||||||
| 126 | # this should be fine. | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | open(USRDB, ">>$_[0]") or die "could not open $_[0] for append!\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | # print our data to the file | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | print USRDB "$_[2] $_[3]\n"; | |||||||||||||||||||||||||||||||||||||||||
| 130 | # close the file | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | close(USRDB); | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | return "2 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | # still in the else meaning valid syntax with data left to handle | ||||||||||||||||||||||||||||||||||||||||||
| 135 | # open(USRDB, ">>authuser.db"); | ||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | # still in the sub, outside the else | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub add_command { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_command: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub authenticate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
authenticate: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | # format, authenticate("userfile", "commandfile", "user", "command") | ||||||||||||||||||||||||||||||||||||||||||
| 146 | # authlevel being numeric value | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | open( USRDB, "<$_[0]" ) or die "error opening user file: $_[0]\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my @users = <USRDB>; # Read it into an array | |||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | open( CMDDB, "<$_[1]" ) or die "error opening command file: $_[1]\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my @commands = <CMDDB>; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | close(USRDB); | |||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | close(CMDDB); | |||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $userset; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if (not defined $ARGV[0] or not defined $ARGV[1]) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $ARGV[0] and defined $ARGV[1]
MC/DC0%0/2
defined $ARGV[0] and defined $ARGV[1]
defined $ARGV[0]
defined $ARGV[1]
Truth table0%0/3
A and B
A= defined $ARGV[0]B= defined $ARGV[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | print "Wrong Syntax\n"; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | return "0 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | for $userset (@users) | |||||||||||||||||||||||||||||||||||||||||
| 162 | { | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | if ( $userset =~ /^s*#/ ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if ( $userset =~ /^$/ ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | { | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my (@userlist) = split( / /, $userset ); | |||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ( $userlist[0] eq $_[2] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | { | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my $command; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | for $command (@commands) | |||||||||||||||||||||||||||||||||||||||||
| 179 | { | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | chomp($command); | |||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | if ( $command =~ /^s*#/ ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | { | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | if ( $command =~ /^$/ ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | { | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my (@cmmd) = split( / /, $command ); | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ( $cmmd[0] eq $_[3] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | # command exists | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ( $userlist[1] >= $cmmd[1] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | { | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | if ( defined $cmmd[2] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | { | ||||||||||||||||||||||||||||||||||||||||||
| 202 | # authenticated, but what type of command? | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if ( $cmmd[2] eq "." ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | { | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | print "$userlist[0] authenticated for $cmmd[0] which does: @cmmd[3..$#cmmd]\n"; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | return "1.0 $_[2] $_[3] @cmmd[3..$#cmmd]"; | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | else | ||||||||||||||||||||||||||||||||||||||||||
| 211 | { | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if ( $cmmd[2] eq "]" ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | print "$userlist[0] authenticated for $cmmd[0] which does: @cmmd[3..$#cmmd]\n"; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | for ( @cmmd[ 3 .. $#cmmd ], $_[2] ) { s/[\x0A\x0D]//g; s/[\r\n]//; } | |||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | return "1.1 $_[2] $_[3] @cmmd[3..$#cmmd]"; | |||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | #print "second time @cmmd[3..$#cmmd] test\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | else | ||||||||||||||||||||||||||||||||||||||||||
| 225 | { | ||||||||||||||||||||||||||||||||||||||||||
| 226 | { | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | print "$userlist[0] authenticated for $cmmd[0]\n"; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | return "1.2 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | # I'm too lazy to track down the iteration of this loop | ||||||||||||||||||||||||||||||||||||||||||
| 233 | # therefore, I will add this print statement... | ||||||||||||||||||||||||||||||||||||||||||
| 234 | # If anyone sees the following message, please report | ||||||||||||||||||||||||||||||||||||||||||
| 235 | # it to the author's email address. | ||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | print "why did this happen?\n"; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | return "0 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | print "User $_[2] Not Authenticated\n"; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | return "2 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | # looping through the commands | ||||||||||||||||||||||||||||||||||||||||||
| 246 | #print "why did this happen3?\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | print "Command $_[3] doesn't exist\n"; | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | return "3 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return "0 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | print "User $_[2] doesn't exist\n"; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | return "4 $_[2] $_[3]"; | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | #end of sub | ||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | # see if we can get a different timer result | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | print "OzDB Driver version $VERSION\n"; | |||||||||||||||||||||||||||||||||||||||||
| 263 | # set a stop timer | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 1 | my $t1 = new Benchmark; | |||||||||||||||||||||||||||||||||||||||||
| 265 | # calculate time difference | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | my $td = timediff($t1, $t0); | |||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | print "Your OzDB Request took aproximately ", timestr($td),"\nThe results of your request are as follows:\n"; | |||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 270 | __END__ | ||||||||||||||||||||||||||||||||||||||||||