aboutsummaryrefslogtreecommitdiffstats
path: root/misc/xs/Botan.pm
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-17 22:31:08 +0000
committerlloyd <[email protected]>2008-09-17 22:31:08 +0000
commitbd5bc359e18058ca5cbb4b8ae404b76652b63699 (patch)
treedbba21a01b8a89cbf13344aeb104fe3f9de5ebb5 /misc/xs/Botan.pm
parent02bef612526398febe10a40b80777d4d13544f40 (diff)
Add Botan-XS 0.01, a Botan module for Perl5, by Vaclav Ovsik <[email protected]>
This has been sitting around on my hard drive for a long time, and may have bit-rotten due to changes in Botan and/or Perl (I haven't tested it yet). Sorry about the wait Vaclav.
Diffstat (limited to 'misc/xs/Botan.pm')
-rw-r--r--misc/xs/Botan.pm117
1 files changed, 117 insertions, 0 deletions
diff --git a/misc/xs/Botan.pm b/misc/xs/Botan.pm
new file mode 100644
index 000000000..ac4ad91fb
--- /dev/null
+++ b/misc/xs/Botan.pm
@@ -0,0 +1,117 @@
+package Botan;
+
+use strict;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
+
+require DynaLoader;
+require AutoLoader;
+use Carp;
+
+@ISA = qw(DynaLoader);
+$VERSION = '0.01';
+
+@EXPORT_OK = qw(
+ NONE
+ IGNORE_WS
+ FULL_CHECK
+);
+
+%EXPORT_TAGS = (
+ 'all' => [ @EXPORT_OK ],
+ 'decoder_checking' => [ qw(
+ NONE
+ IGNORE_WS
+ FULL_CHECK
+ )],
+
+);
+
+
+sub AUTOLOAD
+{
+ # This AUTOLOAD is used to 'autoload' constants from the constant()
+ # XS function. If a constant is not found then control is passed
+ # to the AUTOLOAD in AutoLoader.
+
+ my $constname = $AUTOLOAD;
+ $constname =~ s/.*:://;
+ croak '& not defined' if $constname eq 'constant';
+# my $val = constant($constname, @_ ? $_[0] : 0);
+ my $val = constant($constname);
+ if ($! != 0) {
+ if ( $! =~ /Invalid/ )
+ {
+ $AutoLoader::AUTOLOAD = $AUTOLOAD;
+ goto &AutoLoader::AUTOLOAD;
+ }
+ else
+ {
+ croak "Your vendor has not defined Botan symbol $constname";
+ }
+ }
+ no strict 'refs';
+ *$AUTOLOAD = sub { $val };
+ goto &$AUTOLOAD;
+}
+
+
+bootstrap Botan $VERSION;
+
+# to setup inheritance...
+
+package Botan::Filter;
+use vars qw(@ISA);
+@ISA = qw();
+
+package Botan::Chain;
+use vars qw(@ISA);
+@ISA = qw( Botan::Filter );
+
+package Botan::Fork;
+use vars qw(@ISA);
+@ISA = qw( Botan::Filter );
+
+package Botan::Hex_Encoder;
+use vars qw(@ISA);
+@ISA = qw( Botan::Filter );
+
+package Botan::Hex_Decoder;
+use vars qw(@ISA);
+@ISA = qw( Botan::Filter );
+
+package Botan::Base64_Decoder;
+use vars qw(@ISA);
+@ISA = qw( Botan::Filter );
+
+package Botan::Base64_Encoder;
+use vars qw(@ISA);
+@ISA = qw( Botan::Filter );
+
+
+package Botan;
+
+1;
+__END__
+
+=head1 NAME
+
+Botan - Perl extension for access to Botan ...
+
+=head1 SYNOPSIS
+
+ use Botan;
+ blah blah blah
+
+=head1 DESCRIPTION
+
+Blah blah blah.
+
+=head1 AUTHOR
+
+Vaclav Ovsik <[email protected]>
+
+=head1 SEE ALSO
+
+Bla
+
+=cut