ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenSSL/OpenSSL/BN.pm
Revision: 1.1
Committed: Mon Oct 29 05:38:05 2001 UTC (22 years, 6 months ago) by stefan
Branch: MAIN
CVS Tags: BEFORE_5_8_REGEX_FIX, HEAD
Log Message:
*** empty log message ***

File Contents

# Content
1 package OpenSSL::BN;
2
3 use 5.006;
4 use strict;
5 use warnings;
6 use Carp;
7
8 require Exporter;
9 require DynaLoader;
10 use AutoLoader;
11 use OpenSSL;
12
13 our @ISA = qw(Exporter DynaLoader);
14 our %EXPORT_TAGS = ( 'all' => [ qw(
15
16 ) ] );
17
18 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
19
20 our @EXPORT = qw(
21
22 );
23 our $VERSION = '0.01';
24
25 sub o($) {
26 return new OpenSSL::BN($_[0]) unless ref $_[0];
27 return $_[0] if ref($_[0]) eq __PACKAGE__;
28 $_[0]->can('as_number') ? $_[0]->as_number : new OpenSSL::BN($_[0]);
29
30 ref $_[0] ? $_[0] : new OpenSSL::BN($_[0]);
31 }
32
33 use overload
34 '=' => sub { $_[0]->clone },
35 '+' => sub { $_[0]->add (o($_[1])) },
36 '++' => sub { $_[0]->inc },
37 '-' => sub { $_[0]->sub (o($_[1])) },
38 '--' => sub { $_[0]->dec },
39 '*' => sub { $_[0]->mul (o($_[1])) },
40 '**' => sub { $_[0]->exp (o($_[1])) },
41 '/' => sub { $_[0]->div(o($_[1])) },
42 '%' => sub { $_[0]->mod(o($_[1])) },
43 '<<' => sub { $_[0]->lshift(int $_[1]) },
44 '>>' => sub { $_[0]->rshift(int $_[1]) },
45 '""' => sub { $_[0]->stringify },
46 '<=>' => sub { $_[2] ? $_[1]->icmp(o($_[0])) : $_[0]->icmp(o($_[1])) },
47 'cmp' => sub { $_[2] ? $_[1] cmp $_[0]->stringify : $_[0]->stringify cmp $_[1] },
48 "bool" => sub { $_[0]->bnbool },
49 '0+' => sub { $_[0]->stringify };
50
51
52
53 1;
54 __END__
55 # Below is stub documentation for your module. You better edit it!
56
57 =head1 NAME
58
59 OpenSSL::BN - Perl extension for blah blah blah
60
61 =head1 SYNOPSIS
62
63 use OpenSSL::BN;
64 blah blah blah
65
66 =head1 DESCRIPTION
67
68 Stub documentation for OpenSSL::BN, created by h2xs. It looks like the
69 author of the extension was negligent enough to leave the stub
70 unedited.
71
72 Blah blah blah.
73
74 =head2 EXPORT
75
76 None by default.
77
78
79
80 =head1 SEE ALSO
81
82 Mention other useful documentation such as the documentation of
83 related modules or operating system documentation (such as man pages
84 in UNIX), or any relevant external documentation such as RFCs or
85 standards.
86
87 If you have a mailing list set up for your module, mention it here.
88
89 If you have a web site set up for your module, mention it here.
90
91 =head1 AUTHOR
92
93 root, E<lt>root@sime.comE<gt>
94
95 =head1 COPYRIGHT AND LICENSE
96
97 Copyright 2001 by root
98
99 This library is free software; you can redistribute it and/or modify
100 it under the same terms as Perl itself.
101
102 =cut