File Coverage

blib/lib/Object/Accessor/XS.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Object::Accessor::XS;
2              
3 2     2   36287 use strict;
  2         7  
  2         99  
4 2     2   11 use Carp qw[carp];
  2         4  
  2         131  
5 2     2   24 use vars qw[$FATAL $DEBUG $VERSION];
  2         6  
  2         204  
6              
7             $VERSION = '0.03';
8              
9 2     2   13 use base 'Object::Accessor';
  2         3  
  2         8084  
10              
11             *FATAL = *Object::Accessor::FATAL;
12             *DEBUG = *Object::Accessor::DEBUG;
13              
14             require XSLoader;
15             XSLoader::load('Object::Accessor::XS', $VERSION);
16              
17             if ($Object::Accessor::VERSION =~ /0.0[1-3](?:_\d+)?/) {
18             *Object::Accessor::DESTROY = *Object::Accessor::XS::DESTROY;
19             }
20              
21             if ($Object::Accessor::VERSION =~ /0.0[2-3](?:_\d+)?/) {
22             *Object::Accessor::_debug = *Object::Accessor::XS::_debug;
23             }
24              
25             if ($Object::Accessor::VERSION eq '0.03') {
26             *Object::Accessor::new = *Object::Accessor::XS::new;
27             *Object::Accessor::mk_accessors = *Object::Accessor::XS::mk_accessors;
28             *Object::Accessor::mk_flush = *Object::Accessor::XS::mk_flush;
29             *Object::Accessor::ls_accessors = *Object::Accessor::XS::ls_accessors;
30             } else { _mismatch_exactly('0.03'); }
31              
32             sub _mismatch_exactly {
33 2     2   4 my $required = shift;
34 2         122 warn "Object::Accessor::XS $Object::Accessor::XS::VERSION requires Object::Accessor $required, found $Object::Accessor::VERSION; reverting to non-XS methods.\n";
35             }
36              
37             =head1 NAME
38              
39             Object::Accessor::XS
40              
41             =head1 SYNOPSIS
42              
43             ### load the XS routines
44             use Object::Accessor::XS;
45              
46             ### using the object
47             $object = Object::Accessor->new; # create object
48              
49             =head1 DESCRIPTION
50              
51             C provides a transparent, API-compatible
52             interface to C. When loaded, it replaces
53             several O:A routines with their XS equivalents; you may then
54             continue to use C as before.
55              
56             =cut
57              
58             =head1 AUTHOR
59              
60             This module by
61             Richard Soderberg Ersod@cpan.orgE.
62              
63             =head1 COPYRIGHT
64              
65             This module was
66             copyright (c) 2004 Jos Boumans Ekane@cpan.orgE.
67             All rights reserved.
68              
69             This library is free software;
70             you may redistribute and/or modify it under the same
71             terms as Perl itself.
72              
73             =cut
74              
75             1;