v0.2.0
[language-befunge-vector-xs.git] / lib / Language / Befunge / Vector / XS.pm
blob75831aa524c61991f79a6a598ffa0a68f50aa677
2 # This file is part of Language::Befunge::Vector::XS.
3 # Copyright (c) 2008 Jerome Quelin, all rights reserved.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the same terms as Perl itself.
10 package Language::Befunge::Vector::XS;
12 use strict;
13 use warnings;
15 use overload
16 '=' => \&copy,
17 '+' => \&_add,
18 '-' => \&_substract,
19 'neg' => \&_invert,
20 '+=' => \&_add_inplace,
21 '-=' => \&_substract_inplace,
22 '<=>' => \&_compare,
23 '""' => \&as_string;
25 our $VERSION = '0.2.0';
27 require XSLoader;
28 XSLoader::load('Language::Befunge::Vector::XS', $VERSION);
30 # Preloaded methods go here.
32 sub as_string {
33 my $self = shift;
34 local $" = ',';
35 return "(@$self)";
40 __END__
42 =head1 NAME
44 Language::Befunge::Vector::XS - Language::Befunge::Vector rewritten for speed
48 =head1 DESCRIPTION
50 The C<Language::Befunge> module makes heavy use of n-dims vectors,
51 mapped to the C<Language::Befunge::Vector> class. This allows to
52 abstract the funge dimension while still keeping the same code for the
53 operations.
55 However, such an heavy usage does have some impact on the performances.
56 Therefore, this modules is basically a rewrite of LBV in XS. If
57 installed, then LBV will automagically load it and replace its own
58 functions with the XS ones.
62 =head1 METHODS
64 This module implements exactly the same api as LBV. Please refer to this
65 module for more information on the following methods:
67 =over 4
69 =item new()
71 =item new_zeroes()
73 =item copy()
75 =item as_string()
77 =item get_dims()
79 =item get_component()
81 =item get_all_components()
83 =item clear()
85 =item set_component()
87 =item bounds_check()
89 =item standard mathematical operations
91 =item inplace mathematical operations
93 =item comparison operations
95 =back
98 =head1 SEE ALSO
100 L<Language::Befunge::Vector>
103 =head1 AUTHOR
105 Jerome Quelin, E<lt>jquelin@cpan.orgE<gt>
107 Development is discussed on E<lt>language-befunge@mongueurs.netE<gt>
110 =head1 COPYRIGHT & LICENSE
112 Copyright (c) 2008 Jerome Quelin, all rights reserved.
114 This program is free software; you can redistribute it and/or modify
115 it under the same terms as Perl itself.
118 =cut