1package # hide from PAUSE 2 Class::XSAccessor::Heavy; 3 4use 5.008; 5use strict; 6use warnings; 7use Carp; 8 9our $VERSION = '1.19'; 10our @CARP_NOT = qw( 11 Class::XSAccessor 12 Class::XSAccessor::Array 13); 14 15# TODO Move more duplicated code from XSA and XSA::Array here 16 17 18sub check_sub_existence { 19 my $subname = shift; 20 21 my $sub_package = $subname; 22 $sub_package =~ s/([^:]+)$// or die; 23 my $bare_subname = $1; 24 25 my $sym; 26 { 27 no strict 'refs'; 28 $sym = \%{"$sub_package"}; 29 } 30 no warnings; 31 local *s = $sym->{$bare_subname}; 32 my $coderef = *s{CODE}; 33 if ($coderef) { 34 $sub_package =~ s/::$//; 35 Carp::croak("Cannot replace existing subroutine '$bare_subname' in package '$sub_package' with an XS implementation. If you wish to force a replacement, add the 'replace => 1' parameter to the arguments of 'use ".(caller())[0]."'."); 36 } 37} 38 391; 40 41__END__ 42 43=head1 NAME 44 45Class::XSAccessor::Heavy - Guts you don't care about 46 47=head1 SYNOPSIS 48 49 use Class::XSAccessor! 50 51=head1 DESCRIPTION 52 53Common guts for Class::XSAccessor and Class::XSAccessor::Array. 54No user-serviceable parts inside! 55 56=head1 SEE ALSO 57 58L<Class::XSAccessor> 59L<Class::XSAccessor::Array> 60 61=head1 AUTHOR 62 63Steffen Mueller, E<lt>smueller@cpan.orgE<gt> 64 65chocolateboy, E<lt>chocolate@cpan.orgE<gt> 66 67=head1 COPYRIGHT AND LICENSE 68 69Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by Steffen Mueller 70 71This library is free software; you can redistribute it and/or modify 72it under the same terms as Perl itself, either Perl version 5.8 or, 73at your option, any later version of Perl 5 you may have available. 74 75=cut 76 77