blib/lib/Language/Befunge/Vector/XS.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 24 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« XS.xs ↑ Summary
1 #
2 # This file is part of Language::Befunge::Vector::XS.
3 # Copyright (c) 2008 Jerome Quelin, all rights reserved.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the same terms as Perl itself.
7 #
8 #
9  
10 package Language::Befunge::Vector::XS;
11  
12 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 use overload
16 3 ▶ '=' => \&copy,
Subroutine BEGIN: called CC=1 SCAR=0.0
17 '+' => \&_add,
18 '-' => \&_substract,
19 'neg' => \&_invert,
20 '+=' => \&_add_inplace,
21 '-=' => \&_substract_inplace,
22 '<=>' => \&_compare,
23 'eq' => \&_compare_string,
24 3 '""' => \&as_string;
25  
26 3 our $VERSION = '1.1.1';
27  
28 3 require XSLoader;
29 3 XSLoader::load('Language::Befunge::Vector::XS', $VERSION);
30  
31 # Preloaded methods go here.
32  
33 128 ▶sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
34 128 my $self = shift;
35 128 local $" = ',';
36 128 return "(@$self)";
37 }
38  
39 #
40 # my $bool = $v->_compare($string);
41 # my $bool = $v eq $string;
42 #
43 # Check whether the vector stringifies to $string.
44 #
45 54 ▶sub _compare_string {
Subroutine _compare_string: called CC=1 SCAR=0.0
46 54 my ($self, $str) = @_;
47 54 return $self->as_string eq $str;
48 }
49  
50  
51 3 1;
52 __END__
« XS.xs ↑ Summary