File Coverage

blib/lib/Language/Basic/Common.pm
Criterion Covered Total %
statement 11 17 64.7
branch n/a
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 15 23 65.2


line stmt bran cond sub pod time code
1             # Stuff used by all the Language::Basic packages
2             package Language::Basic::Common;
3              
4 16     16   91 use strict;
  16         36  
  16         646  
5 16     16   87 use vars qw(@ISA @EXPORT @EXPORT_OK);
  16         37  
  16         1147  
6              
7             BEGIN{
8 16     16   85 use Exporter ();
  16         54  
  16         566  
9 16     16   280 @ISA = qw(Exporter);
10 16         2436 @EXPORT = qw(
11             &Exit_Error
12             );
13             }
14              
15             # Declare some "type" packages, String, Boolean, Numeric.
16             # Need to declare them here because several sets of classes inherit
17             # from them. E.g., LB::Variables and LB::Expressions
18             {
19             package Language::Basic::String;
20             package Language::Basic::Boolean;
21             package Language::Basic::Numeric;
22             }
23              
24             # THis sub prints out an error and exits the program.
25             sub Exit_Error {
26 0     0 0   my $err = shift;
27 0           my $prog = &Language::Basic::Program::current_program;
28 0           my $error_line = $prog->current_line_number;
29              
30 0           STDOUT->flush; # in case we're in the middle of a PRINT statement...
31 0           warn "\nError in line $error_line: $err\n";
32             # TODO change to "set_goto_line(undef)" so we can continue on
33             # another program if we're running two simultaneously!
34 0           exit (1);
35             }
36              
37             1;