initial commit [141.14.140.180,mike]
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
Revision history for Perl extension MD5.
|
||||
|
||||
*** 96/06/20 Version 1.7
|
||||
|
||||
MD5 is now completely 64-bit clean (I hope). The basic MD5 code uses
|
||||
32-bit quantities and requires a typedef UINT4 to be defined in
|
||||
global.h. Perl configuration data (the value of BYTEORDER) is used to
|
||||
determine if unsigned longs have 4 or 8 bytes. On 64-bit platforms (eg
|
||||
DEC Alpha) then it assumes that "unsigned int" will be a 32-bit type.
|
||||
If this is incorrect then adding -DUINT4_IS_LONG to the DEFINES line in
|
||||
Makefile.PL will override this.
|
||||
|
||||
On some machines (at least Cray that I know of) there is no 32-bit
|
||||
integer type. In this case defining TRUNCATE_UINT4 (which is done
|
||||
automatically for a Cray) will ensure that 64-bit values are masked
|
||||
down to 32 bits. I have done my best to test this but without easy
|
||||
access to a true 64-bit machine I can not totally guarantee it (unless
|
||||
anyone wants to lend me a spare Cray :-)
|
||||
|
||||
There is one remaining limitation for 64-bit enabled processors. The
|
||||
amount of data passed to any single call to the underlying MD5
|
||||
routines is limited to (2^32 - 1) bytes -- that's 4 gigabytes. I'm
|
||||
sorry if that's a real problem for you ...
|
||||
|
||||
And finally, a minor complilation warning (unsigned char * used with
|
||||
function having char * prototype) has also been eliminated.
|
||||
|
||||
*** 96/04/09 Version 1.6
|
||||
|
||||
Re-generated module framework using h2xs to pick up the latest module
|
||||
conventions for versions etc. You can now say "use MD5 1.6;" and things
|
||||
should work correctly. MD5.pod has been integrated into MD5.pm and
|
||||
CHANGES renamed to Changes. There is a fairly comprehensive test.pl
|
||||
which can be invoked via "make test". There are no functional changes
|
||||
to the MD5 routines themselves.
|
||||
|
||||
*** 96/03/14 Version 1.5.3
|
||||
|
||||
Fixed addfile method to accept type-glob references for the file-handle
|
||||
(eg \*STDOUT). This is more consistent with other routines and is now the
|
||||
recommended way of passing file-handles. The documentation now gives more
|
||||
examples as to how the routines might be used.
|
||||
|
||||
*** 96/03/12 Version 1.5.2
|
||||
|
||||
Minor fixes from Christopher J Madsen <madsen@computek.net> to provide
|
||||
support for building on OS/2 (and to work arround a perl -w bug).
|
||||
|
||||
Remove warning about possible difference between add('foo', 'bar') and
|
||||
add('foobar'). This is not true (it may have been true in the earliest
|
||||
version of the module but is no longer the case).
|
||||
|
||||
*** 96/03/08 Version 1.5.1
|
||||
|
||||
Add CHANGES file to make it easier for people to figure out what has
|
||||
been going on. (Meant to do this as part of 1.5)
|
||||
|
||||
*** 96/03/05 Version 1.5
|
||||
|
||||
Add hash() and hexhash() methods at the suggestion/request of Gary
|
||||
Howland <gary@kampai.euronet.nl> before inclusion in a wider library
|
||||
of cryptography modules.
|
||||
|
||||
*** 96/02/27 Version 1.4
|
||||
|
||||
Finally fixed the pesky Solaris dynamic loading bug. All kudos to Ken
|
||||
Pizzini <kenp@spry.com>!
|
||||
|
||||
*** 95/11/29 Version 1.3.1
|
||||
|
||||
Add explanations of current known problems.
|
||||
|
||||
*** 95/06/02 Version 1.3
|
||||
|
||||
Fix problems with scope resolution in addfile() reported by
|
||||
Jean-Claude Giese <Jean-Claude.Giese@loria.fr>. Basically ARGV is
|
||||
always implicitly in package main while other filehandles aren't.
|
||||
|
||||
*** 95/05/23 Version 1.2.1
|
||||
|
||||
[Changes pre 1.2.1 not recorded]
|
||||
|
||||
SCCS ID @(#)Changes 1.5 96/06/28
|
||||
@@ -0,0 +1,13 @@
|
||||
README Guess what?
|
||||
MANIFEST This file
|
||||
MD5.pm MD5 Perl Module
|
||||
MD5.xs MD5 Perl 'XS' source file
|
||||
typemap Supplementary typemap
|
||||
Makefile.PL Perl Makefile builder
|
||||
md5c.c MD5 C source from RFC 1321
|
||||
md5.h Header for above
|
||||
global.h ditto
|
||||
test.pl Test suite using standard Perl conventions
|
||||
Changes Version history
|
||||
examples/mddriver.pl Example driver script after mddriver.c in RFC 1321
|
||||
examples/twdigest.pl Example code to format a digest like Tripwire
|
||||
@@ -0,0 +1,263 @@
|
||||
# SCCS ID @(#)MD5.pm 1.9 96/06/28
|
||||
package MD5;
|
||||
|
||||
use strict;
|
||||
use vars qw($VERSION @ISA @EXPORT);
|
||||
|
||||
require Exporter;
|
||||
require DynaLoader;
|
||||
require AutoLoader;
|
||||
|
||||
@ISA = qw(Exporter AutoLoader DynaLoader);
|
||||
# Items to export into callers namespace by default. Note: do not export
|
||||
# names by default without a very good reason. Use EXPORT_OK instead.
|
||||
# Do not simply export all your public functions/methods/constants.
|
||||
@EXPORT = qw(
|
||||
|
||||
);
|
||||
$VERSION = '1.7';
|
||||
|
||||
bootstrap MD5 $VERSION;
|
||||
|
||||
# Preloaded methods go here.
|
||||
|
||||
sub addfile
|
||||
{
|
||||
no strict 'refs'; # Countermand any strct refs in force so that we
|
||||
# can still handle file-handle names.
|
||||
|
||||
my ($self, $handle) = @_;
|
||||
my ($package, $file, $line) = caller;
|
||||
my ($data) = '';
|
||||
|
||||
if (!ref($handle))
|
||||
{
|
||||
# Old-style passing of filehandle by name. We need to add
|
||||
# the calling package scope qualifier, if there is not one
|
||||
# supplied already.
|
||||
|
||||
$handle = $package . '::' . $handle unless ($handle =~ /(\:\:|\')/);
|
||||
}
|
||||
|
||||
while (read($handle, $data, 1024))
|
||||
{
|
||||
$self->add($data);
|
||||
}
|
||||
}
|
||||
|
||||
sub hexdigest
|
||||
{
|
||||
my ($self) = shift;
|
||||
|
||||
unpack("H*", ($self->digest()));
|
||||
}
|
||||
|
||||
sub hash
|
||||
{
|
||||
my ($self, $data) = @_;
|
||||
|
||||
if (ref($self))
|
||||
{
|
||||
# This is an instance method call so reset the current context
|
||||
|
||||
$self->reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
# This is a static method invocation, create a temporary MD5 context
|
||||
|
||||
$self = new MD5;
|
||||
}
|
||||
|
||||
# Now do the hash
|
||||
|
||||
$self->add($data);
|
||||
$self->digest();
|
||||
}
|
||||
|
||||
sub hexhash
|
||||
{
|
||||
my ($self, $data) = @_;
|
||||
|
||||
unpack("H*", ($self->hash($data)));
|
||||
}
|
||||
|
||||
# Autoload methods go after =cut, and are processed by the autosplit program.
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MD5 - Perl interface to the RSA Data Security Inc. MD5 Message-Digest Algorithm
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use MD5;
|
||||
|
||||
$context = new MD5;
|
||||
$context->reset();
|
||||
|
||||
$context->add(LIST);
|
||||
$context->addfile(HANDLE);
|
||||
|
||||
$digest = $context->digest();
|
||||
$string = $context->hexdigest();
|
||||
|
||||
$digest = MD5->hash(SCALAR);
|
||||
$string = MD5->hexhash(SCALAR);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<MD5> module allows you to use the RSA Data Security Inc. MD5
|
||||
Message Digest algorithm from within Perl programs.
|
||||
|
||||
A new MD5 context object is created with the B<new> operation.
|
||||
Multiple simultaneous digest contexts can be maintained, if desired.
|
||||
The context is updated with the B<add> operation which adds the
|
||||
strings contained in the I<LIST> parameter. Note, however, that
|
||||
C<add('foo', 'bar')>, C<add('foo')> followed by C<add('bar')> and
|
||||
C<add('foobar')> should all give the same result.
|
||||
|
||||
The final message digest value is returned by the B<digest> operation
|
||||
as a 16-byte binary string. This operation delivers the result of
|
||||
B<add> operations since the last B<new> or B<reset> operation. Note
|
||||
that the B<digest> operation is effectively a destructive, read-once
|
||||
operation. Once it has been performed, the context must be B<reset>
|
||||
before being used to calculate another digest value.
|
||||
|
||||
Several convenience functions are also provided. The B<addfile>
|
||||
operation takes an open file-handle and reads it until end-of file in
|
||||
1024 byte blocks adding the contents to the context. The file-handle
|
||||
can either be specified by name or passed as a type-glob reference, as
|
||||
shown in the examples below. The B<hexdigest> operation calls
|
||||
B<digest> and returns the result as a printable string of hexdecimal
|
||||
digits. This is exactly the same operation as performed by the
|
||||
B<unpack> operation in the examples below.
|
||||
|
||||
The B<hash> operation can act as either a static member function (ie
|
||||
you invoke it on the MD5 class as in the synopsis above) or as a
|
||||
normal virtual function. In both cases it performs the complete MD5
|
||||
cycle (reset, add, digest) on the supplied scalar value. This is
|
||||
convenient for handling small quantities of data. When invoked on the
|
||||
class a temporary context is created. When invoked through an already
|
||||
created context object, this context is used. The latter form is
|
||||
slightly more efficient. The B<hexhash> operation is analogous to
|
||||
B<hexdigest>.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
use MD5;
|
||||
|
||||
$md5 = new MD5;
|
||||
$md5->add('foo', 'bar');
|
||||
$md5->add('baz');
|
||||
$digest = $md5->digest();
|
||||
|
||||
print("Digest is " . unpack("H*", $digest) . "\n");
|
||||
|
||||
The above example would print out the message
|
||||
|
||||
Digest is 6df23dc03f9b54cc38a0fc1483df6e21
|
||||
|
||||
provided that the implementation is working correctly.
|
||||
|
||||
Remembering the Perl motto ("There's more than one way to do it"), the
|
||||
following should all give the same result:
|
||||
|
||||
use MD5;
|
||||
$md5 = new MD5;
|
||||
|
||||
die "Can't open /etc/passwd ($!)\n" unless open(P, "/etc/passwd");
|
||||
|
||||
seek(P, 0, 0);
|
||||
$md5->reset;
|
||||
$md5->addfile(P);
|
||||
$d = $md5->hexdigest;
|
||||
print "addfile (handle name) = $d\n";
|
||||
|
||||
seek(P, 0, 0);
|
||||
$md5->reset;
|
||||
$md5->addfile(\*P);
|
||||
$d = $md5->hexdigest;
|
||||
print "addfile (type-glob reference) = $d\n";
|
||||
|
||||
seek(P, 0, 0);
|
||||
$md5->reset;
|
||||
while (<P>)
|
||||
{
|
||||
$md5->add($_);
|
||||
}
|
||||
$d = $md5->hexdigest;
|
||||
print "Line at a time = $d\n";
|
||||
|
||||
seek(P, 0, 0);
|
||||
$md5->reset;
|
||||
$md5->add(<P>);
|
||||
$d = $md5->hexdigest;
|
||||
print "All lines at once = $d\n";
|
||||
|
||||
seek(P, 0, 0);
|
||||
$md5->reset;
|
||||
while (read(P, $data, (rand % 128) + 1))
|
||||
{
|
||||
$md5->add($data);
|
||||
}
|
||||
$d = $md5->hexdigest;
|
||||
print "Random chunks = $d\n";
|
||||
|
||||
seek(P, 0, 0);
|
||||
$md5->reset;
|
||||
undef $/;
|
||||
$data = <P>;
|
||||
$d = $md5->hexhash($data);
|
||||
print "Single string = $d\n";
|
||||
|
||||
close(P);
|
||||
|
||||
=head1 NOTE
|
||||
|
||||
The MD5 extension may be redistributed under the same terms as Perl.
|
||||
The MD5 algorithm is defined in RFC1321. The basic C code implementing
|
||||
the algorithm is derived from that in the RFC and is covered by the
|
||||
following copyright:
|
||||
|
||||
=over 8
|
||||
|
||||
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
Algorithm" in all material mentioning or referencing this software
|
||||
or this function.
|
||||
|
||||
License is also granted to make and use derivative works provided
|
||||
that such works are identified as "derived from the RSA Data
|
||||
Security, Inc. MD5 Message-Digest Algorithm" in all material
|
||||
mentioning or referencing the derived work.
|
||||
|
||||
RSA Data Security, Inc. makes no representations concerning either
|
||||
the merchantability of this software or the suitability of this
|
||||
software for any particular purpose. It is provided "as is"
|
||||
without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this
|
||||
documentation and/or software.
|
||||
|
||||
=back
|
||||
|
||||
This copyright does not prohibit distribution of any version of Perl
|
||||
containing this extension under the terms of the GNU or Artistic
|
||||
licences.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
The MD5 interface was written by Neil Winton
|
||||
(C<N.Winton@axion.bt.co.uk>).
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
perl(1).
|
||||
|
||||
=cut
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
** Perl Extension for the
|
||||
**
|
||||
** RSA Data Security Inc. MD5 Message-Digest Algorithm
|
||||
**
|
||||
** This module by Neil Winton (N.Winton@axion.bt.co.uk)
|
||||
** SCCS ID @(#)MD5.xs 1.7 96/06/28
|
||||
**
|
||||
** This extension may be distributed under the same terms
|
||||
** as Perl. The MD5 code is covered by separate copyright and
|
||||
** licence, but this does not prohibit distribution under the
|
||||
** GNU or Artistic licences. See the file md5c.c or MD5.pm
|
||||
** for more details.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "md5.h"
|
||||
|
||||
/*
|
||||
** The following macro re-definitions added to work around a problem on
|
||||
** Solaris where the original MD5 routines are already in /lib/libnsl.a.
|
||||
** This causes dynamic linking of the module to fail.
|
||||
** Thanks to Ken Pizzini (ken@spry.com) for finally nailing this one!
|
||||
*/
|
||||
|
||||
#define MD5Init MD5Init_perl
|
||||
#define MD5Update MD5Update_perl
|
||||
#define MD5Final MD5Final_perl
|
||||
|
||||
typedef MD5_CTX *MD5;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
MODULE = MD5 PACKAGE = MD5
|
||||
|
||||
PROTOTYPES: DISABLE
|
||||
|
||||
MD5
|
||||
new(packname = "MD5")
|
||||
char * packname
|
||||
CODE:
|
||||
{
|
||||
RETVAL = (MD5_CTX *)safemalloc(sizeof(MD5_CTX));
|
||||
MD5Init(RETVAL);
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
DESTROY(context)
|
||||
MD5 context
|
||||
CODE:
|
||||
{
|
||||
safefree((char *)context);
|
||||
}
|
||||
|
||||
void
|
||||
reset(context)
|
||||
MD5 context
|
||||
CODE:
|
||||
{
|
||||
MD5Init(context);
|
||||
}
|
||||
|
||||
void
|
||||
add(context, ...)
|
||||
MD5 context
|
||||
CODE:
|
||||
{
|
||||
SV *svdata;
|
||||
STRLEN len;
|
||||
unsigned char *data;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < items; i++)
|
||||
{
|
||||
data = (unsigned char *)(SvPV(ST(i), len));
|
||||
MD5Update(context, data, len);
|
||||
}
|
||||
}
|
||||
|
||||
SV *
|
||||
digest(context)
|
||||
MD5 context
|
||||
CODE:
|
||||
{
|
||||
unsigned char digeststr[16];
|
||||
|
||||
MD5Final(digeststr, context);
|
||||
ST(0) = sv_2mortal(newSVpv((char *)digeststr, 16));
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# SCCS ID @(#)Makefile.PL 1.10 96/06/28
|
||||
use ExtUtils::MakeMaker;
|
||||
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
||||
# the contents of the Makefile that is written.
|
||||
WriteMakefile(
|
||||
'NAME' => 'MD5',
|
||||
'VERSION_FROM' => 'MD5.pm', # finds $VERSION
|
||||
'LIBS' => [''], # e.g., '-lm'
|
||||
'CONFIG' => ['byteorder'], # Used to determine 64-bitness
|
||||
'DEFINE' => '-DPERL_BYTEORDER=$(BYTEORDER)',
|
||||
'INC' => '', # e.g., '-I/usr/include/other'
|
||||
'OBJECT' => q[MD5$(OBJ_EXT) md5c$(OBJ_EXT)],
|
||||
);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
MD5 Extension Version 1.7
|
||||
|
||||
This is a Perl5 extension interface to the RSA Data Security Inc. MD5
|
||||
Message Digest algorithm. Documentation is in MD5.pod.
|
||||
|
||||
To build the extension, unpack this distribution under the ext/
|
||||
directory of your Perl source distribution, create the Makefile using
|
||||
'perl Makefile.PL' and do a 'make'.
|
||||
|
||||
Note that the MD5.xs file uses the "PROTOTYPES: DISABLE" facility
|
||||
which only became available in late betas pf perl 5.002. If you are
|
||||
using a version which does not support this then merely remove
|
||||
this line.
|
||||
|
||||
The mddriver.pl script gives a simple example of how to use the
|
||||
routines. In particular 'perl mddriver.pl -x' will perform a quick
|
||||
test of the routines to see if they produce the expected output. The
|
||||
use of "make test" will perform a more comprehensive test. (WARNING:
|
||||
You should not run mddriver.pl directly in the MD5 directory when using
|
||||
dynamic linking as on some systems it will dynamically link to object
|
||||
files in the current directory which may not give the correct
|
||||
behaviour. This is believed to affect at least AIX and IRIX. A similar
|
||||
caveat applies to the direct use of the test.pl script).
|
||||
|
||||
The module is known to work (using static or dynamic linking) on at
|
||||
least AIX, Solaris, HP-UX and IRIX. It should work on other
|
||||
"reasonable" UNIX-like platforms (for an unspecified definition of the
|
||||
word "reasonable" :-)
|
||||
|
||||
Support is also provided for 64-bit platforms. This should be detected
|
||||
and handled automatically. See the entry for version 1.7 in the
|
||||
Changes file for further details.
|
||||
|
||||
Bugs, queries, plaudits to
|
||||
|
||||
Neil Winton
|
||||
|
||||
* Neil Winton Post Point P5 *
|
||||
* N.Winton@axion.bt.co.uk BT Laboratories *
|
||||
* Tel +44 1473 646079 Martlesham Heath *
|
||||
* Fax +44 1473 643306 IPSWICH IP5 7RE, UK *
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
#!/usr/local/bin/perl
|
||||
# SCCS ID @(#)mddriver.pl 1.3 95/05/01
|
||||
|
||||
require 'getopts.pl';
|
||||
use MD5;
|
||||
sub DoTest;
|
||||
|
||||
&Getopts('s:x');
|
||||
|
||||
$md5 = new MD5;
|
||||
|
||||
if (defined($opt_s))
|
||||
{
|
||||
$md5->add($opt_s);
|
||||
$digest = $md5->digest();
|
||||
print("MD5(\"$opt_s\") = " . unpack("H*", $digest) . "\n");
|
||||
}
|
||||
elsif ($opt_x)
|
||||
{
|
||||
DoTest("", "d41d8cd98f00b204e9800998ecf8427e");
|
||||
DoTest("a", "0cc175b9c0f1b6a831c399e269772661");
|
||||
DoTest("abc", "900150983cd24fb0d6963f7d28e17f72");
|
||||
DoTest("message digest", "f96b697d7cb7938d525a2f31aaf161d0");
|
||||
DoTest("abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b");
|
||||
DoTest("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
||||
"d174ab98d277d9f5a5611c2c9f419d9f");
|
||||
DoTest("12345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
||||
"57edf4a22be3c955ac49da2e2107b67a");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($#ARGV >= 0)
|
||||
{
|
||||
foreach $ARGV (@ARGV)
|
||||
{
|
||||
die "Can't open file '$ARGV' ($!)\n" unless open(ARGV, $ARGV);
|
||||
|
||||
$md5->reset();
|
||||
$md5->addfile(ARGV);
|
||||
$hex = $md5->hexdigest();
|
||||
print "MD5($ARGV) = $hex\n";
|
||||
|
||||
close(ARGV);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$md5->reset();
|
||||
$md5->addfile(STDIN);
|
||||
$hex = $md5->hexdigest();
|
||||
|
||||
print "$hex\n";
|
||||
}
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
sub DoTest
|
||||
{
|
||||
my ($str, $expect) = @_;
|
||||
my ($digest, $hex);
|
||||
my $md5 = new MD5;
|
||||
|
||||
$md5->add($str);
|
||||
$digest = $md5->digest();
|
||||
$hex = unpack("H*", $digest);
|
||||
|
||||
print "MD5(\"$str\") =>\nEXPECT: $expect\nRESULT: $hex\n"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/usr/local/bin/perl
|
||||
|
||||
use MD5;
|
||||
|
||||
#
|
||||
# twdigest -- format MD5 digest like TripWire does
|
||||
#
|
||||
# This converts the md5->digest binary string to
|
||||
# 64-radix ascii, given the base-vector:
|
||||
# 0 - 9, A - Z, a - z, :, .
|
||||
#
|
||||
|
||||
sub twdigest {
|
||||
my($digest) = @_;
|
||||
my(@chunks, $bits);
|
||||
|
||||
# Convert to ASCII bit-string
|
||||
$bits = unpack("B*", $digest);
|
||||
|
||||
# Round up length to multiple of 6 by prepending zeros
|
||||
$bits = ("0" x ((6 - (length($bits) % 6)) % 6)) . $bits;
|
||||
|
||||
# Split into 6-bit chunks
|
||||
@chunks = grep {$_ ne ''} (split(/(.{6})/, $bits, -1));
|
||||
|
||||
# Convert each 6-bit value to a single character
|
||||
foreach (@chunks)
|
||||
{
|
||||
$_ = pack("B8", "00" . $_);
|
||||
tr/\000-\011\012-\043\044-\075\076\077/0-9A-Za-z:./;
|
||||
}
|
||||
|
||||
# Join all of the chunks into one string
|
||||
join('', @chunks);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* GLOBAL.H - RSAREF types and constants
|
||||
*/
|
||||
|
||||
/* PROTOTYPES should be set to one if and only if the compiler supports
|
||||
function argument prototyping.
|
||||
The following makes PROTOTYPES default to 0 if it has not already
|
||||
been defined with C compiler flags.
|
||||
*/
|
||||
#ifndef PROTOTYPES
|
||||
#define PROTOTYPES 0
|
||||
#endif
|
||||
|
||||
/* POINTER defines a generic pointer type */
|
||||
typedef unsigned char *POINTER;
|
||||
|
||||
/* UINT2 defines a two byte word */
|
||||
typedef unsigned short int UINT2;
|
||||
|
||||
/* UINT4 defines a four byte word.
|
||||
We use the Perl byte-order definition to discover if a long has more than
|
||||
4 bytes. If so we will try to use an unsigned int. This is OK for DEC
|
||||
Alpha but may not work everywhere. See the TO32 definition below.
|
||||
*/
|
||||
#if (PERL_BYTEORDER <= 4321) || defined(UINT4_IS_LONG)
|
||||
typedef unsigned long UINT4;
|
||||
#else
|
||||
typedef unsigned int UINT4;
|
||||
#endif
|
||||
|
||||
/* TO32 ensures that UINT4 values are truncated to 32 bits.
|
||||
A Cray has short, int and long all at 64 bits so we need to apply this
|
||||
macro to reduce UINT4 values to 32 bits at appropriate places. If UINT4
|
||||
really does have 32 bits then this is a no-op.
|
||||
*/
|
||||
#if defined(cray) || defined(TRUNCATE_UINT4)
|
||||
#define TO32(x) ((x) & 0xffffffff)
|
||||
#else
|
||||
#define TO32(x) (x)
|
||||
#endif
|
||||
|
||||
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
|
||||
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
|
||||
returns an empty list.
|
||||
*/
|
||||
#if PROTOTYPES
|
||||
#define PROTO_LIST(list) list
|
||||
#else
|
||||
#define PROTO_LIST(list) ()
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
/* MD5.H - header file for MD5C.C
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
Algorithm" in all material mentioning or referencing this software
|
||||
or this function.
|
||||
|
||||
License is also granted to make and use derivative works provided
|
||||
that such works are identified as "derived from the RSA Data
|
||||
Security, Inc. MD5 Message-Digest Algorithm" in all material
|
||||
mentioning or referencing the derived work.
|
||||
|
||||
RSA Data Security, Inc. makes no representations concerning either
|
||||
the merchantability of this software or the suitability of this
|
||||
software for any particular purpose. It is provided "as is"
|
||||
without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this
|
||||
documentation and/or software.
|
||||
*/
|
||||
|
||||
/* MD5 context. */
|
||||
typedef struct {
|
||||
UINT4 state[4]; /* state (ABCD) */
|
||||
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
||||
unsigned char buffer[64]; /* input buffer */
|
||||
} MD5_CTX;
|
||||
|
||||
void MD5Init PROTO_LIST ((MD5_CTX *));
|
||||
void MD5Update PROTO_LIST
|
||||
((MD5_CTX *, unsigned char *, unsigned long));
|
||||
void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
|
||||
@@ -0,0 +1,351 @@
|
||||
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
Algorithm" in all material mentioning or referencing this software
|
||||
or this function.
|
||||
|
||||
License is also granted to make and use derivative works provided
|
||||
that such works are identified as "derived from the RSA Data
|
||||
Security, Inc. MD5 Message-Digest Algorithm" in all material
|
||||
mentioning or referencing the derived work.
|
||||
|
||||
RSA Data Security, Inc. makes no representations concerning either
|
||||
the merchantability of this software or the suitability of this
|
||||
software for any particular purpose. It is provided "as is"
|
||||
without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this
|
||||
documentation and/or software.
|
||||
*/
|
||||
|
||||
/*
|
||||
** The following macro re-definitions added to work around a problem on
|
||||
** Solaris where the original MD5 routines are already in /lib/libnsl.a.
|
||||
** This causes dynamic linking of the module to fail.
|
||||
**
|
||||
** Thanks to Ken Pizzini (ken@spry.com) for finally nailing this one!
|
||||
*/
|
||||
|
||||
#define MD5Init MD5Init_perl
|
||||
#define MD5Update MD5Update_perl
|
||||
#define MD5Final MD5Final_perl
|
||||
|
||||
#include "global.h"
|
||||
#include "md5.h"
|
||||
|
||||
/* Constants for MD5Transform routine.
|
||||
*/
|
||||
|
||||
#define S11 7
|
||||
#define S12 12
|
||||
#define S13 17
|
||||
#define S14 22
|
||||
#define S21 5
|
||||
#define S22 9
|
||||
#define S23 14
|
||||
#define S24 20
|
||||
#define S31 4
|
||||
#define S32 11
|
||||
#define S33 16
|
||||
#define S34 23
|
||||
#define S41 6
|
||||
#define S42 10
|
||||
#define S43 15
|
||||
#define S44 21
|
||||
|
||||
static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
|
||||
static void Encode PROTO_LIST
|
||||
((unsigned char *, UINT4 *, unsigned long));
|
||||
static void Decode PROTO_LIST
|
||||
((UINT4 *, unsigned char *, unsigned long));
|
||||
static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned long));
|
||||
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned long));
|
||||
|
||||
static unsigned char PADDING[64] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/* F, G, H and I are basic MD5 functions.
|
||||
*/
|
||||
#define F(x, y, z) TO32((((x) & (y)) | ((~x) & (z))))
|
||||
#define G(x, y, z) TO32((((x) & (z)) | ((y) & (~z))))
|
||||
#define H(x, y, z) TO32(((x) ^ (y) ^ (z)))
|
||||
#define I(x, y, z) TO32(((y) ^ ((x) | (~z))))
|
||||
|
||||
/* ROTATE_LEFT rotates x left n bits.
|
||||
*/
|
||||
#define ROTATE_LEFT(x, n) TO32((((x) << (n)) | (TO32((x)) >> (32-(n)))))
|
||||
|
||||
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
|
||||
Rotation is separate from addition to prevent recomputation.
|
||||
*/
|
||||
#define FF(a, b, c, d, x, s, ac) { \
|
||||
(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
||||
(a) = ROTATE_LEFT ((a), (s)); \
|
||||
(a) += (b); \
|
||||
TO32((a)); \
|
||||
}
|
||||
#define GG(a, b, c, d, x, s, ac) { \
|
||||
(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
||||
(a) = ROTATE_LEFT ((a), (s)); \
|
||||
(a) += (b); \
|
||||
TO32((a)); \
|
||||
}
|
||||
#define HH(a, b, c, d, x, s, ac) { \
|
||||
(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
||||
(a) = ROTATE_LEFT ((a), (s)); \
|
||||
(a) += (b); \
|
||||
TO32((a)); \
|
||||
}
|
||||
#define II(a, b, c, d, x, s, ac) { \
|
||||
(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
||||
(a) = ROTATE_LEFT ((a), (s)); \
|
||||
(a) += (b); \
|
||||
TO32((a)); \
|
||||
}
|
||||
|
||||
/* MD5 initialization. Begins an MD5 operation, writing a new context.
|
||||
*/
|
||||
void MD5Init (context)
|
||||
MD5_CTX *context; /* context */
|
||||
{
|
||||
context->count[0] = context->count[1] = 0;
|
||||
/* Load magic initialization constants.
|
||||
*/
|
||||
context->state[0] = 0x67452301;
|
||||
context->state[1] = 0xefcdab89;
|
||||
context->state[2] = 0x98badcfe;
|
||||
context->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
/* MD5 block update operation. Continues an MD5 message-digest
|
||||
operation, processing another message block, and updating the
|
||||
context.
|
||||
*/
|
||||
void MD5Update (context, input, inputLen)
|
||||
MD5_CTX *context; /* context */
|
||||
unsigned char *input; /* input block */
|
||||
unsigned long inputLen; /* length of input block */
|
||||
{
|
||||
unsigned long i, index, partLen;
|
||||
|
||||
/* Compute number of bytes mod 64 */
|
||||
index = (unsigned long)((context->count[0] >> 3) & 0x3F);
|
||||
|
||||
/* Update number of bits */
|
||||
if (TO32(context->count[0] += (inputLen << 3))
|
||||
< TO32(inputLen << 3))
|
||||
context->count[1]++;
|
||||
context->count[1] += (inputLen >> 29);
|
||||
|
||||
partLen = 64 - index;
|
||||
|
||||
/* Transform as many times as possible.
|
||||
*/
|
||||
if (inputLen >= partLen) {
|
||||
MD5_memcpy
|
||||
((POINTER)&context->buffer[index], (POINTER)input, partLen);
|
||||
MD5Transform (context->state, context->buffer);
|
||||
|
||||
for (i = partLen; i + 63 < inputLen; i += 64)
|
||||
MD5Transform (context->state, &input[i]);
|
||||
|
||||
index = 0;
|
||||
}
|
||||
else
|
||||
i = 0;
|
||||
|
||||
/* Buffer remaining input */
|
||||
MD5_memcpy
|
||||
((POINTER)&context->buffer[index], (POINTER)&input[i],
|
||||
inputLen-i);
|
||||
}
|
||||
|
||||
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
|
||||
the message digest and zeroizing the context.
|
||||
*/
|
||||
void MD5Final (digest, context)
|
||||
unsigned char digest[16]; /* message digest */
|
||||
MD5_CTX *context; /* context */
|
||||
{
|
||||
unsigned char bits[8];
|
||||
unsigned long index, padLen;
|
||||
|
||||
/* Save number of bits */
|
||||
Encode (bits, context->count, 8);
|
||||
|
||||
/* Pad out to 56 mod 64.
|
||||
*/
|
||||
index = (unsigned long)((context->count[0] >> 3) & 0x3f);
|
||||
padLen = (index < 56) ? (56 - index) : (120 - index);
|
||||
MD5Update (context, PADDING, padLen);
|
||||
|
||||
/* Append length (before padding) */
|
||||
MD5Update (context, bits, 8);
|
||||
|
||||
/* Store state in digest */
|
||||
Encode (digest, context->state, 16);
|
||||
|
||||
/* Zeroize sensitive information.
|
||||
*/
|
||||
MD5_memset ((POINTER)context, 0, sizeof (*context));
|
||||
}
|
||||
|
||||
/* MD5 basic transformation. Transforms state based on block.
|
||||
*/
|
||||
static void MD5Transform (state, block)
|
||||
UINT4 state[4];
|
||||
unsigned char block[64];
|
||||
{
|
||||
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
|
||||
|
||||
Decode (x, block, 64);
|
||||
|
||||
/* Round 1 */
|
||||
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
|
||||
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
|
||||
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
|
||||
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
|
||||
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
|
||||
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
|
||||
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
|
||||
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
|
||||
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
|
||||
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
|
||||
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
|
||||
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
|
||||
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
|
||||
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
|
||||
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
|
||||
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
|
||||
|
||||
/* Round 2 */
|
||||
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
|
||||
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
|
||||
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
|
||||
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
|
||||
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
|
||||
GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
|
||||
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
|
||||
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
|
||||
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
|
||||
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
|
||||
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
|
||||
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
|
||||
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
|
||||
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
|
||||
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
|
||||
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
|
||||
|
||||
/* Round 3 */
|
||||
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
|
||||
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
|
||||
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
|
||||
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
|
||||
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
|
||||
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
|
||||
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
|
||||
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
|
||||
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
|
||||
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
|
||||
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
|
||||
HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
|
||||
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
|
||||
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
|
||||
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
|
||||
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
|
||||
|
||||
/* Round 4 */
|
||||
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
|
||||
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
|
||||
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
|
||||
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
|
||||
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
|
||||
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
|
||||
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
|
||||
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
|
||||
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
|
||||
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
|
||||
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
|
||||
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
|
||||
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
|
||||
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
|
||||
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
|
||||
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
|
||||
|
||||
state[0] += a; TO32(state[0]);
|
||||
state[1] += b; TO32(state[1]);
|
||||
state[2] += c; TO32(state[2]);
|
||||
state[3] += d; TO32(state[3]);
|
||||
|
||||
/* Zeroize sensitive information.
|
||||
*/
|
||||
MD5_memset ((POINTER)x, 0, sizeof (x));
|
||||
}
|
||||
|
||||
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
|
||||
a multiple of 4.
|
||||
*/
|
||||
static void Encode (output, input, len)
|
||||
unsigned char *output;
|
||||
UINT4 *input;
|
||||
unsigned long len;
|
||||
{
|
||||
unsigned long i, j;
|
||||
|
||||
for (i = 0, j = 0; j < len; i++, j += 4) {
|
||||
output[j] = (unsigned char)(input[i] & 0xff);
|
||||
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
|
||||
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
|
||||
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
|
||||
a multiple of 4.
|
||||
*/
|
||||
static void Decode (output, input, len)
|
||||
UINT4 *output;
|
||||
unsigned char *input;
|
||||
unsigned long len;
|
||||
{
|
||||
unsigned long i, j;
|
||||
|
||||
for (i = 0, j = 0; j < len; i++, j += 4)
|
||||
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
|
||||
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
|
||||
}
|
||||
|
||||
/* Note: Replace "for loop" with standard memcpy if possible.
|
||||
*/
|
||||
|
||||
static void MD5_memcpy (output, input, len)
|
||||
POINTER output;
|
||||
POINTER input;
|
||||
unsigned long len;
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
output[i] = input[i];
|
||||
}
|
||||
|
||||
/* Note: Replace "for loop" with standard memset if possible.
|
||||
*/
|
||||
static void MD5_memset (output, value, len)
|
||||
POINTER output;
|
||||
int value;
|
||||
unsigned long len;
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
((char *)output)[i] = (char)value;
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
# SCCS ID @(#)test.pl 1.1 96/04/09
|
||||
# Before `make install' is performed this script should be runnable with
|
||||
# `make test'. After `make install' it should work as `perl test.pl'
|
||||
|
||||
######################### We start with some black magic to print on failure.
|
||||
|
||||
# Change 1..1 below to 1..last_test_to_print .
|
||||
# (It may become useful if the test is moved to ./t subdirectory.)
|
||||
|
||||
BEGIN {print "1..14\n";}
|
||||
END {print "not ok 1\n" unless $loaded;}
|
||||
use MD5;
|
||||
$loaded = 1;
|
||||
print "ok 1\n";
|
||||
|
||||
######################### End of black magic.
|
||||
|
||||
# Insert your test code below (better if it prints "ok 13"
|
||||
# (correspondingly "not ok 13") depending on the success of chunk 13
|
||||
# of the test code):
|
||||
|
||||
package MD5Test;
|
||||
|
||||
# 2: Constructor
|
||||
|
||||
print (($md5 = new MD5) ? "ok 2\n" : "not ok 2\n");
|
||||
|
||||
# 3: Basic test data as defined in RFC 1321
|
||||
|
||||
%data = (
|
||||
"" => "d41d8cd98f00b204e9800998ecf8427e",
|
||||
"a" => "0cc175b9c0f1b6a831c399e269772661",
|
||||
"abc" => "900150983cd24fb0d6963f7d28e17f72",
|
||||
"message digest"
|
||||
=> "f96b697d7cb7938d525a2f31aaf161d0",
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
=> "c3fcd3d76192e4007dfb496cca67e13b",
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||
=> "d174ab98d277d9f5a5611c2c9f419d9f",
|
||||
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
||||
=> "57edf4a22be3c955ac49da2e2107b67a",
|
||||
);
|
||||
|
||||
$failed = 0;
|
||||
foreach (sort(keys(%data)))
|
||||
{
|
||||
$md5->reset;
|
||||
$md5->add($_);
|
||||
$digest = $md5->digest;
|
||||
$hex = unpack("H*", $digest);
|
||||
if ($hex ne $data{$_})
|
||||
{
|
||||
$failed++;
|
||||
}
|
||||
}
|
||||
print ($failed ? "not ok 3\n" : "ok 3\n");
|
||||
|
||||
# 4: Various flavours of file-handle to addfile
|
||||
|
||||
open(F, "<$0");
|
||||
|
||||
$md5->reset;
|
||||
|
||||
$md5->addfile(F);
|
||||
$hex = $md5->hexdigest;
|
||||
print ($hex ne '' ? "ok 4\n" : "not ok 4\n");
|
||||
|
||||
$orig = $hex;
|
||||
|
||||
# 5: Fully qualified with ' operator
|
||||
|
||||
seek(F, 0, 0);
|
||||
$md5->reset;
|
||||
$md5->addfile(MD5Test'F);
|
||||
$hex = $md5->hexdigest;
|
||||
print ($hex eq $orig ? "ok 5\n" : "not ok 5\n");
|
||||
|
||||
# 6: Fully qualified with :: operator
|
||||
|
||||
seek(F, 0, 0);
|
||||
$md5->reset;
|
||||
$md5->addfile(MD5Test::F);
|
||||
$hex = $md5->hexdigest;
|
||||
print ($hex eq $orig ? "ok 6\n" : "not ok 6\n");
|
||||
|
||||
# 7: Type glob
|
||||
|
||||
seek(F, 0, 0);
|
||||
$md5->reset;
|
||||
$md5->addfile(*F);
|
||||
$hex = $md5->hexdigest;
|
||||
print ($hex eq $orig ? "ok 7\n" : "not ok 7\n");
|
||||
|
||||
# 8: Type glob reference (the prefered mechanism)
|
||||
|
||||
seek(F, 0, 0);
|
||||
$md5->reset;
|
||||
$md5->addfile(\*F);
|
||||
$hex = $md5->hexdigest;
|
||||
print ($hex eq $orig ? "ok 8\n" : "not ok 8\n");
|
||||
|
||||
# 9: File-handle passed by name (really the same as 6)
|
||||
|
||||
seek(F, 0, 0);
|
||||
$md5->reset;
|
||||
$md5->addfile("MD5Test::F");
|
||||
$hex = $md5->hexdigest;
|
||||
print ($hex eq $orig ? "ok 9\n" : "not ok 9\n");
|
||||
|
||||
# 10: Other ways of reading the data -- line at a time
|
||||
|
||||
seek(F, 0, 0);
|
||||
$md5->reset;
|
||||
while (<F>)
|
||||
{
|
||||
$md5->add($_);
|
||||
}
|
||||
$hex = $md5->hexdigest;
|
||||
print ($hex eq $orig ? "ok 10\n" : "not ok 10\n");
|
||||
|
||||
# 11: Input lines as a list to add()
|
||||
|
||||
seek(F, 0, 0);
|
||||
$md5->reset;
|
||||
$md5->add(<F>);
|
||||
$hex = $md5->hexdigest;
|
||||
print ($hex eq $orig ? "ok 11\n" : "not ok 11\n");
|
||||
|
||||
# 12: Random chunks up to 128 bytes
|
||||
|
||||
seek(F, 0, 0);
|
||||
$md5->reset;
|
||||
while (read(F, $hexata, (rand % 128) + 1))
|
||||
{
|
||||
$md5->add($hexata);
|
||||
}
|
||||
$hex = $md5->hexdigest;
|
||||
print ($hex eq $orig ? "ok 12\n" : "not ok 12\n");
|
||||
|
||||
# 13: All the data at once
|
||||
|
||||
seek(F, 0, 0);
|
||||
$md5->reset;
|
||||
undef $/;
|
||||
$data = <F>;
|
||||
$hex = $md5->hexhash($data);
|
||||
print ($hex eq $orig ? "ok 13\n" : "not ok 13\n");
|
||||
|
||||
close(F);
|
||||
|
||||
# 14: Using static member function
|
||||
|
||||
$hex = MD5->hexhash($data);
|
||||
print ($hex eq $orig ? "ok 14\n" : "not ok 14\n");
|
||||
@@ -0,0 +1,3 @@
|
||||
# SCCS ID @(#)typemap 1.2 94/11/07
|
||||
TYPEMAP
|
||||
MD5 T_PTROBJ
|
||||
@@ -0,0 +1,6 @@
|
||||
Revision history for Perl extension mwx.
|
||||
|
||||
0.01 Sun Jun 1 18:30:04 2003
|
||||
- original version; created by h2xs 1.21 with options
|
||||
-X -n mwx
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Changes
|
||||
Makefile.PL
|
||||
MANIFEST
|
||||
mwx.pm
|
||||
README
|
||||
test.pl
|
||||
@@ -0,0 +1,17 @@
|
||||
use ExtUtils::MakeMaker;
|
||||
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
||||
# the contents of the Makefile that is written.
|
||||
|
||||
WriteMakefile(
|
||||
'NAME' => 'mwx',
|
||||
'VERSION_FROM' => 'mwx.pm', # finds $VERSION
|
||||
'PREREQ_PM' => { Net::SMTP => 0,
|
||||
MD5 => 0,
|
||||
Net::NIS => 0,
|
||||
Math::BigInt => 0,
|
||||
Time::HiRes => 0,
|
||||
Term::ReadKey => 0},
|
||||
($] >= 5.005 ? ## Add these new keywords supported since 5.005
|
||||
(ABSTRACT_FROM => 'mwx.pm', # retrieve abstract from module
|
||||
AUTHOR => 'M.Wesemann <mwx@gmx.de>') : ()),
|
||||
);
|
||||
@@ -0,0 +1,864 @@
|
||||
# This Makefile is for the mwx extension to perl.
|
||||
#
|
||||
# It was generated automatically by MakeMaker version
|
||||
# 7.0401 (Revision: 70401) from the contents of
|
||||
# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
|
||||
#
|
||||
# ANY CHANGES MADE HERE WILL BE LOST!
|
||||
#
|
||||
# MakeMaker ARGV: ()
|
||||
#
|
||||
|
||||
# MakeMaker Parameters:
|
||||
|
||||
# ABSTRACT_FROM => q[mwx.pm]
|
||||
# AUTHOR => [q[M.Wesemann <mwx@gmx.de>]]
|
||||
# BUILD_REQUIRES => { }
|
||||
# CONFIGURE_REQUIRES => { }
|
||||
# NAME => q[mwx]
|
||||
# PREREQ_PM => { MD5=>q[0], Math::BigInt=>q[0], Net::NIS=>q[0], Net::SMTP=>q[0], Term::ReadKey=>q[0], Time::HiRes=>q[0] }
|
||||
# TEST_REQUIRES => { }
|
||||
# VERSION_FROM => q[mwx.pm]
|
||||
|
||||
# --- MakeMaker post_initialize section:
|
||||
|
||||
|
||||
# --- MakeMaker const_config section:
|
||||
|
||||
# These definitions are from config.sh (via /usr/lib/x86_64-linux-gnu/perl/5.22/Config.pm).
|
||||
# They may have been overridden via Makefile.PL or on the command line.
|
||||
AR = ar
|
||||
CC = x86_64-linux-gnu-gcc
|
||||
CCCDLFLAGS = -fPIC
|
||||
CCDLFLAGS = -Wl,-E
|
||||
DLEXT = so
|
||||
DLSRC = dl_dlopen.xs
|
||||
EXE_EXT =
|
||||
FULL_AR = /usr/bin/ar
|
||||
LD = x86_64-linux-gnu-gcc
|
||||
LDDLFLAGS = -shared -L/usr/local/lib -fstack-protector-strong
|
||||
LDFLAGS = -fstack-protector-strong -L/usr/local/lib
|
||||
LIBC = libc-2.23.so
|
||||
LIB_EXT = .a
|
||||
OBJ_EXT = .o
|
||||
OSNAME = linux
|
||||
OSVERS = 3.16.0
|
||||
RANLIB = :
|
||||
SITELIBEXP = /usr/local/share/perl/5.22.1
|
||||
SITEARCHEXP = /usr/local/lib/x86_64-linux-gnu/perl/5.22.1
|
||||
SO = so
|
||||
VENDORARCHEXP = /usr/lib/x86_64-linux-gnu/perl5/5.22
|
||||
VENDORLIBEXP = /usr/share/perl5
|
||||
|
||||
|
||||
# --- MakeMaker constants section:
|
||||
AR_STATIC_ARGS = cr
|
||||
DIRFILESEP = /
|
||||
DFSEP = $(DIRFILESEP)
|
||||
NAME = mwx
|
||||
NAME_SYM = mwx
|
||||
VERSION = 1.21
|
||||
VERSION_MACRO = VERSION
|
||||
VERSION_SYM = 1_21
|
||||
DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
|
||||
XS_VERSION = 1.21
|
||||
XS_VERSION_MACRO = XS_VERSION
|
||||
XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
|
||||
INST_ARCHLIB = blib/arch
|
||||
INST_SCRIPT = blib/script
|
||||
INST_BIN = blib/bin
|
||||
INST_LIB = blib/lib
|
||||
INST_MAN1DIR = blib/man1
|
||||
INST_MAN3DIR = blib/man3
|
||||
MAN1EXT = 1p
|
||||
MAN3EXT = 3pm
|
||||
INSTALLDIRS = site
|
||||
DESTDIR =
|
||||
PREFIX = $(SITEPREFIX)
|
||||
PERLPREFIX = /usr
|
||||
SITEPREFIX = /usr/local
|
||||
VENDORPREFIX = /usr
|
||||
INSTALLPRIVLIB = /usr/share/perl/5.22
|
||||
DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB)
|
||||
INSTALLSITELIB = /usr/local/share/perl/5.22.1
|
||||
DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB)
|
||||
INSTALLVENDORLIB = /usr/share/perl5
|
||||
DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB)
|
||||
INSTALLARCHLIB = /usr/lib/x86_64-linux-gnu/perl/5.22
|
||||
DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB)
|
||||
INSTALLSITEARCH = /usr/local/lib/x86_64-linux-gnu/perl/5.22.1
|
||||
DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH)
|
||||
INSTALLVENDORARCH = /usr/lib/x86_64-linux-gnu/perl5/5.22
|
||||
DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH)
|
||||
INSTALLBIN = /usr/bin
|
||||
DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN)
|
||||
INSTALLSITEBIN = /usr/local/bin
|
||||
DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN)
|
||||
INSTALLVENDORBIN = /usr/bin
|
||||
DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN)
|
||||
INSTALLSCRIPT = /usr/bin
|
||||
DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT)
|
||||
INSTALLSITESCRIPT = /usr/local/bin
|
||||
DESTINSTALLSITESCRIPT = $(DESTDIR)$(INSTALLSITESCRIPT)
|
||||
INSTALLVENDORSCRIPT = /usr/bin
|
||||
DESTINSTALLVENDORSCRIPT = $(DESTDIR)$(INSTALLVENDORSCRIPT)
|
||||
INSTALLMAN1DIR = /usr/share/man/man1
|
||||
DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR)
|
||||
INSTALLSITEMAN1DIR = /usr/local/man/man1
|
||||
DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR)
|
||||
INSTALLVENDORMAN1DIR = /usr/share/man/man1
|
||||
DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR)
|
||||
INSTALLMAN3DIR = /usr/share/man/man3
|
||||
DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR)
|
||||
INSTALLSITEMAN3DIR = /usr/local/man/man3
|
||||
DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR)
|
||||
INSTALLVENDORMAN3DIR = /usr/share/man/man3
|
||||
DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR)
|
||||
PERL_LIB = /usr/share/perl/5.22
|
||||
PERL_ARCHLIB = /usr/lib/x86_64-linux-gnu/perl/5.22
|
||||
PERL_ARCHLIBDEP = /usr/lib/x86_64-linux-gnu/perl/5.22
|
||||
LIBPERL_A = libperl.a
|
||||
FIRST_MAKEFILE = Makefile
|
||||
MAKEFILE_OLD = Makefile.old
|
||||
MAKE_APERL_FILE = Makefile.aperl
|
||||
PERLMAINCC = $(CC)
|
||||
PERL_INC = /usr/lib/x86_64-linux-gnu/perl/5.22/CORE
|
||||
PERL_INCDEP = /usr/lib/x86_64-linux-gnu/perl/5.22/CORE
|
||||
PERL = "/usr/bin/perl"
|
||||
FULLPERL = "/usr/bin/perl"
|
||||
ABSPERL = $(PERL)
|
||||
PERLRUN = $(PERL)
|
||||
FULLPERLRUN = $(FULLPERL)
|
||||
ABSPERLRUN = $(ABSPERL)
|
||||
PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
|
||||
FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
|
||||
ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
|
||||
PERL_CORE = 0
|
||||
PERM_DIR = 755
|
||||
PERM_RW = 644
|
||||
PERM_RWX = 755
|
||||
|
||||
MAKEMAKER = /usr/share/perl/5.22/ExtUtils/MakeMaker.pm
|
||||
MM_VERSION = 7.0401
|
||||
MM_REVISION = 70401
|
||||
|
||||
# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
|
||||
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
|
||||
# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
|
||||
# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
|
||||
MAKE = make
|
||||
FULLEXT = mwx
|
||||
BASEEXT = mwx
|
||||
PARENT_NAME =
|
||||
DLBASE = $(BASEEXT)
|
||||
VERSION_FROM = mwx.pm
|
||||
OBJECT =
|
||||
LDFROM = $(OBJECT)
|
||||
LINKTYPE = dynamic
|
||||
BOOTDEP =
|
||||
|
||||
# Handy lists of source code files:
|
||||
XS_FILES =
|
||||
C_FILES =
|
||||
O_FILES =
|
||||
H_FILES =
|
||||
MAN1PODS =
|
||||
MAN3PODS = mwx.pm
|
||||
|
||||
# Where is the Config information that we are using/depend on
|
||||
CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_INCDEP)$(DFSEP)config.h
|
||||
|
||||
# Where to build things
|
||||
INST_LIBDIR = $(INST_LIB)
|
||||
INST_ARCHLIBDIR = $(INST_ARCHLIB)
|
||||
|
||||
INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT)
|
||||
INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
|
||||
|
||||
INST_STATIC =
|
||||
INST_DYNAMIC =
|
||||
INST_BOOT =
|
||||
|
||||
# Extra linker info
|
||||
EXPORT_LIST =
|
||||
PERL_ARCHIVE =
|
||||
PERL_ARCHIVEDEP =
|
||||
PERL_ARCHIVE_AFTER =
|
||||
|
||||
|
||||
TO_INST_PM = mwx.pm
|
||||
|
||||
PM_TO_BLIB = mwx.pm \
|
||||
$(INST_LIB)/mwx.pm
|
||||
|
||||
|
||||
# --- MakeMaker platform_constants section:
|
||||
MM_Unix_VERSION = 7.0401
|
||||
PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc
|
||||
|
||||
|
||||
# --- MakeMaker tool_autosplit section:
|
||||
# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
|
||||
AUTOSPLITFILE = $(ABSPERLRUN) -e 'use AutoSplit; autosplit($$$$ARGV[0], $$$$ARGV[1], 0, 1, 1)' --
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker tool_xsubpp section:
|
||||
|
||||
|
||||
# --- MakeMaker tools_other section:
|
||||
SHELL = /bin/sh
|
||||
CHMOD = chmod
|
||||
CP = cp
|
||||
MV = mv
|
||||
NOOP = $(TRUE)
|
||||
NOECHO = @
|
||||
RM_F = rm -f
|
||||
RM_RF = rm -rf
|
||||
TEST_F = test -f
|
||||
TOUCH = touch
|
||||
UMASK_NULL = umask 0
|
||||
DEV_NULL = > /dev/null 2>&1
|
||||
MKPATH = $(ABSPERLRUN) -MExtUtils::Command -e 'mkpath' --
|
||||
EQUALIZE_TIMESTAMP = $(ABSPERLRUN) -MExtUtils::Command -e 'eqtime' --
|
||||
FALSE = false
|
||||
TRUE = true
|
||||
ECHO = echo
|
||||
ECHO_N = echo -n
|
||||
UNINST = 0
|
||||
VERBINST = 0
|
||||
MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e 'install([ from_to => {@ARGV}, verbose => '\''$(VERBINST)'\'', uninstall_shadows => '\''$(UNINST)'\'', dir_mode => '\''$(PERM_DIR)'\'' ]);' --
|
||||
DOC_INSTALL = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'perllocal_install' --
|
||||
UNINSTALL = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'uninstall' --
|
||||
WARN_IF_OLD_PACKLIST = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'warn_if_old_packlist' --
|
||||
MACROSTART =
|
||||
MACROEND =
|
||||
USEMAKEFILE = -f
|
||||
FIXIN = $(ABSPERLRUN) -MExtUtils::MY -e 'MY->fixin(shift)' --
|
||||
CP_NONEMPTY = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'cp_nonempty' --
|
||||
|
||||
|
||||
# --- MakeMaker makemakerdflt section:
|
||||
makemakerdflt : all
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
# --- MakeMaker dist section:
|
||||
TAR = tar
|
||||
TARFLAGS = cvf
|
||||
ZIP = zip
|
||||
ZIPFLAGS = -r
|
||||
COMPRESS = gzip --best
|
||||
SUFFIX = .gz
|
||||
SHAR = shar
|
||||
PREOP = $(NOECHO) $(NOOP)
|
||||
POSTOP = $(NOECHO) $(NOOP)
|
||||
TO_UNIX = $(NOECHO) $(NOOP)
|
||||
CI = ci -u
|
||||
RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
|
||||
DIST_CP = best
|
||||
DIST_DEFAULT = tardist
|
||||
DISTNAME = mwx
|
||||
DISTVNAME = mwx-1.21
|
||||
|
||||
|
||||
# --- MakeMaker macro section:
|
||||
|
||||
|
||||
# --- MakeMaker depend section:
|
||||
|
||||
|
||||
# --- MakeMaker cflags section:
|
||||
|
||||
|
||||
# --- MakeMaker const_loadlibs section:
|
||||
|
||||
|
||||
# --- MakeMaker const_cccmd section:
|
||||
|
||||
|
||||
# --- MakeMaker post_constants section:
|
||||
|
||||
|
||||
# --- MakeMaker pasthru section:
|
||||
|
||||
PASTHRU = LIBPERL_A="$(LIBPERL_A)"\
|
||||
LINKTYPE="$(LINKTYPE)"\
|
||||
LD="$(LD)"\
|
||||
PREFIX="$(PREFIX)"
|
||||
|
||||
|
||||
# --- MakeMaker special_targets section:
|
||||
.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
|
||||
|
||||
.PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker c_o section:
|
||||
|
||||
|
||||
# --- MakeMaker xs_c section:
|
||||
|
||||
|
||||
# --- MakeMaker xs_o section:
|
||||
|
||||
|
||||
# --- MakeMaker top_targets section:
|
||||
all :: pure_all manifypods
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
pure_all :: config pm_to_blib subdirs linkext
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
subdirs :: $(MYEXTLIB)
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
config :: $(FIRST_MAKEFILE) blibdirs
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
help :
|
||||
perldoc ExtUtils::MakeMaker
|
||||
|
||||
|
||||
# --- MakeMaker blibdirs section:
|
||||
blibdirs : $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
# Backwards compat with 6.18 through 6.25
|
||||
blibdirs.ts : blibdirs
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
$(INST_LIBDIR)$(DFSEP).exists :: Makefile.PL
|
||||
$(NOECHO) $(MKPATH) $(INST_LIBDIR)
|
||||
$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_LIBDIR)
|
||||
$(NOECHO) $(TOUCH) $(INST_LIBDIR)$(DFSEP).exists
|
||||
|
||||
$(INST_ARCHLIB)$(DFSEP).exists :: Makefile.PL
|
||||
$(NOECHO) $(MKPATH) $(INST_ARCHLIB)
|
||||
$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_ARCHLIB)
|
||||
$(NOECHO) $(TOUCH) $(INST_ARCHLIB)$(DFSEP).exists
|
||||
|
||||
$(INST_AUTODIR)$(DFSEP).exists :: Makefile.PL
|
||||
$(NOECHO) $(MKPATH) $(INST_AUTODIR)
|
||||
$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_AUTODIR)
|
||||
$(NOECHO) $(TOUCH) $(INST_AUTODIR)$(DFSEP).exists
|
||||
|
||||
$(INST_ARCHAUTODIR)$(DFSEP).exists :: Makefile.PL
|
||||
$(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
|
||||
$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_ARCHAUTODIR)
|
||||
$(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)$(DFSEP).exists
|
||||
|
||||
$(INST_BIN)$(DFSEP).exists :: Makefile.PL
|
||||
$(NOECHO) $(MKPATH) $(INST_BIN)
|
||||
$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_BIN)
|
||||
$(NOECHO) $(TOUCH) $(INST_BIN)$(DFSEP).exists
|
||||
|
||||
$(INST_SCRIPT)$(DFSEP).exists :: Makefile.PL
|
||||
$(NOECHO) $(MKPATH) $(INST_SCRIPT)
|
||||
$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_SCRIPT)
|
||||
$(NOECHO) $(TOUCH) $(INST_SCRIPT)$(DFSEP).exists
|
||||
|
||||
$(INST_MAN1DIR)$(DFSEP).exists :: Makefile.PL
|
||||
$(NOECHO) $(MKPATH) $(INST_MAN1DIR)
|
||||
$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_MAN1DIR)
|
||||
$(NOECHO) $(TOUCH) $(INST_MAN1DIR)$(DFSEP).exists
|
||||
|
||||
$(INST_MAN3DIR)$(DFSEP).exists :: Makefile.PL
|
||||
$(NOECHO) $(MKPATH) $(INST_MAN3DIR)
|
||||
$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_MAN3DIR)
|
||||
$(NOECHO) $(TOUCH) $(INST_MAN3DIR)$(DFSEP).exists
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker linkext section:
|
||||
|
||||
linkext :: $(LINKTYPE)
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
# --- MakeMaker dlsyms section:
|
||||
|
||||
|
||||
# --- MakeMaker dynamic_bs section:
|
||||
|
||||
BOOTSTRAP =
|
||||
|
||||
|
||||
# --- MakeMaker dynamic section:
|
||||
|
||||
dynamic :: $(FIRST_MAKEFILE) $(BOOTSTRAP) $(INST_DYNAMIC)
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
# --- MakeMaker dynamic_lib section:
|
||||
|
||||
|
||||
# --- MakeMaker static section:
|
||||
|
||||
## $(INST_PM) has been moved to the all: target.
|
||||
## It remains here for awhile to allow for old usage: "make static"
|
||||
static :: $(FIRST_MAKEFILE) $(INST_STATIC)
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
# --- MakeMaker static_lib section:
|
||||
|
||||
|
||||
# --- MakeMaker manifypods section:
|
||||
|
||||
POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--"
|
||||
POD2MAN = $(POD2MAN_EXE)
|
||||
|
||||
|
||||
manifypods : pure_all \
|
||||
mwx.pm
|
||||
$(NOECHO) $(POD2MAN) --section=$(MAN3EXT) --perm_rw=$(PERM_RW) -u \
|
||||
mwx.pm $(INST_MAN3DIR)/mwx.$(MAN3EXT)
|
||||
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker processPL section:
|
||||
|
||||
|
||||
# --- MakeMaker installbin section:
|
||||
|
||||
|
||||
# --- MakeMaker subdirs section:
|
||||
|
||||
# none
|
||||
|
||||
# --- MakeMaker clean_subdirs section:
|
||||
clean_subdirs :
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
# --- MakeMaker clean section:
|
||||
|
||||
# Delete temporary files but do not touch installed files. We don't delete
|
||||
# the Makefile here so a later make realclean still has a makefile to use.
|
||||
|
||||
clean :: clean_subdirs
|
||||
- $(RM_F) \
|
||||
$(BASEEXT).bso $(BASEEXT).def \
|
||||
$(BASEEXT).exp $(BASEEXT).x \
|
||||
$(BOOTSTRAP) $(INST_ARCHAUTODIR)/extralibs.all \
|
||||
$(INST_ARCHAUTODIR)/extralibs.ld $(MAKE_APERL_FILE) \
|
||||
*$(LIB_EXT) *$(OBJ_EXT) \
|
||||
*perl.core MYMETA.json \
|
||||
MYMETA.yml blibdirs.ts \
|
||||
core core.*perl.*.? \
|
||||
core.[0-9] core.[0-9][0-9] \
|
||||
core.[0-9][0-9][0-9] core.[0-9][0-9][0-9][0-9] \
|
||||
core.[0-9][0-9][0-9][0-9][0-9] lib$(BASEEXT).def \
|
||||
mon.out perl \
|
||||
perl$(EXE_EXT) perl.exe \
|
||||
perlmain.c pm_to_blib \
|
||||
pm_to_blib.ts so_locations \
|
||||
tmon.out
|
||||
- $(RM_RF) \
|
||||
blib
|
||||
$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
|
||||
- $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
|
||||
|
||||
|
||||
# --- MakeMaker realclean_subdirs section:
|
||||
realclean_subdirs :
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
# --- MakeMaker realclean section:
|
||||
# Delete temporary files (via clean) and also delete dist files
|
||||
realclean purge :: clean realclean_subdirs
|
||||
- $(RM_F) \
|
||||
$(MAKEFILE_OLD) $(FIRST_MAKEFILE)
|
||||
- $(RM_RF) \
|
||||
$(DISTVNAME)
|
||||
|
||||
|
||||
# --- MakeMaker metafile section:
|
||||
metafile : create_distdir
|
||||
$(NOECHO) $(ECHO) Generating META.yml
|
||||
$(NOECHO) $(ECHO) '---' > META_new.yml
|
||||
$(NOECHO) $(ECHO) 'abstract: '\''mikes perl tools'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'author:' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' - '\''M.Wesemann <mwx@gmx.de>'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'build_requires:' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: '\''0'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'configure_requires:' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' ExtUtils::MakeMaker: '\''0'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'dynamic_config: 1' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'generated_by: '\''ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'license: unknown' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'meta-spec:' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' url: http://module-build.sourceforge.net/META-spec-v1.4.html' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' version: '\''1.4'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'name: mwx' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'no_index:' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' directory:' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' - t' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' - inc' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'requires:' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' MD5: '\''0'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' Math::BigInt: '\''0'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' Net::NIS: '\''0'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' Net::SMTP: '\''0'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' Term::ReadKey: '\''0'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) ' Time::HiRes: '\''0'\''' >> META_new.yml
|
||||
$(NOECHO) $(ECHO) 'version: '\''1.21'\''' >> META_new.yml
|
||||
-$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml
|
||||
$(NOECHO) $(ECHO) Generating META.json
|
||||
$(NOECHO) $(ECHO) '{' > META_new.json
|
||||
$(NOECHO) $(ECHO) ' "abstract" : "mikes perl tools",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "author" : [' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "M.Wesemann <mwx@gmx.de>"' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' ],' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "dynamic_config" : 1,' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "license" : [' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "unknown"' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' ],' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "meta-spec" : {' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "version" : "2"' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' },' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "name" : "mwx",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "no_index" : {' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "directory" : [' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "t",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "inc"' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' ]' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' },' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "prereqs" : {' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "build" : {' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "requires" : {' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "ExtUtils::MakeMaker" : "0"' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' }' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' },' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "configure" : {' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "requires" : {' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "ExtUtils::MakeMaker" : "0"' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' }' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' },' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "runtime" : {' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "requires" : {' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "MD5" : "0",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "Math::BigInt" : "0",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "Net::NIS" : "0",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "Net::SMTP" : "0",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "Term::ReadKey" : "0",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "Time::HiRes" : "0"' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' }' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' }' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' },' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "release_status" : "stable",' >> META_new.json
|
||||
$(NOECHO) $(ECHO) ' "version" : "1.21"' >> META_new.json
|
||||
$(NOECHO) $(ECHO) '}' >> META_new.json
|
||||
-$(NOECHO) $(MV) META_new.json $(DISTVNAME)/META.json
|
||||
|
||||
|
||||
# --- MakeMaker signature section:
|
||||
signature :
|
||||
cpansign -s
|
||||
|
||||
|
||||
# --- MakeMaker dist_basics section:
|
||||
distclean :: realclean distcheck
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
distcheck :
|
||||
$(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
|
||||
|
||||
skipcheck :
|
||||
$(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
|
||||
|
||||
manifest :
|
||||
$(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
|
||||
|
||||
veryclean : realclean
|
||||
$(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker dist_core section:
|
||||
|
||||
dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
|
||||
$(NOECHO) $(ABSPERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \
|
||||
-e ' if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';' --
|
||||
|
||||
tardist : $(DISTVNAME).tar$(SUFFIX)
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
uutardist : $(DISTVNAME).tar$(SUFFIX)
|
||||
uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu
|
||||
$(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)_uu'
|
||||
|
||||
$(DISTVNAME).tar$(SUFFIX) : distdir
|
||||
$(PREOP)
|
||||
$(TO_UNIX)
|
||||
$(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
|
||||
$(RM_RF) $(DISTVNAME)
|
||||
$(COMPRESS) $(DISTVNAME).tar
|
||||
$(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)'
|
||||
$(POSTOP)
|
||||
|
||||
zipdist : $(DISTVNAME).zip
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
$(DISTVNAME).zip : distdir
|
||||
$(PREOP)
|
||||
$(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
|
||||
$(RM_RF) $(DISTVNAME)
|
||||
$(NOECHO) $(ECHO) 'Created $(DISTVNAME).zip'
|
||||
$(POSTOP)
|
||||
|
||||
shdist : distdir
|
||||
$(PREOP)
|
||||
$(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
|
||||
$(RM_RF) $(DISTVNAME)
|
||||
$(NOECHO) $(ECHO) 'Created $(DISTVNAME).shar'
|
||||
$(POSTOP)
|
||||
|
||||
|
||||
# --- MakeMaker distdir section:
|
||||
create_distdir :
|
||||
$(RM_RF) $(DISTVNAME)
|
||||
$(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
|
||||
-e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
|
||||
|
||||
distdir : create_distdir distmeta
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker dist_test section:
|
||||
disttest : distdir
|
||||
cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
|
||||
cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
|
||||
cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker dist_ci section:
|
||||
|
||||
ci :
|
||||
$(PERLRUN) "-MExtUtils::Manifest=maniread" \
|
||||
-e "@all = keys %{ maniread() };" \
|
||||
-e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \
|
||||
-e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"
|
||||
|
||||
|
||||
# --- MakeMaker distmeta section:
|
||||
distmeta : create_distdir metafile
|
||||
$(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'exit unless -e q{META.yml};' \
|
||||
-e 'eval { maniadd({q{META.yml} => q{Module YAML meta-data (added by MakeMaker)}}) }' \
|
||||
-e ' or print "Could not add META.yml to MANIFEST: $$$${'\''@'\''}\n"' --
|
||||
$(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'exit unless -f q{META.json};' \
|
||||
-e 'eval { maniadd({q{META.json} => q{Module JSON meta-data (added by MakeMaker)}}) }' \
|
||||
-e ' or print "Could not add META.json to MANIFEST: $$$${'\''@'\''}\n"' --
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker distsignature section:
|
||||
distsignature : create_distdir
|
||||
$(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) }' \
|
||||
-e ' or print "Could not add SIGNATURE to MANIFEST: $$$${'\''@'\''}\n"' --
|
||||
$(NOECHO) cd $(DISTVNAME) && $(TOUCH) SIGNATURE
|
||||
cd $(DISTVNAME) && cpansign -s
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker install section:
|
||||
|
||||
install :: pure_install doc_install
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
install_perl :: pure_perl_install doc_perl_install
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
install_site :: pure_site_install doc_site_install
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
install_vendor :: pure_vendor_install doc_vendor_install
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
pure_install :: pure_$(INSTALLDIRS)_install
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
doc_install :: doc_$(INSTALLDIRS)_install
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
pure__install : pure_site_install
|
||||
$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
|
||||
|
||||
doc__install : doc_site_install
|
||||
$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
|
||||
|
||||
pure_perl_install :: all
|
||||
$(NOECHO) umask 022; $(MOD_INSTALL) \
|
||||
"$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \
|
||||
"$(INST_ARCHLIB)" "$(DESTINSTALLARCHLIB)" \
|
||||
"$(INST_BIN)" "$(DESTINSTALLBIN)" \
|
||||
"$(INST_SCRIPT)" "$(DESTINSTALLSCRIPT)" \
|
||||
"$(INST_MAN1DIR)" "$(DESTINSTALLMAN1DIR)" \
|
||||
"$(INST_MAN3DIR)" "$(DESTINSTALLMAN3DIR)"
|
||||
$(NOECHO) $(WARN_IF_OLD_PACKLIST) \
|
||||
"$(SITEARCHEXP)/auto/$(FULLEXT)"
|
||||
|
||||
|
||||
pure_site_install :: all
|
||||
$(NOECHO) umask 02; $(MOD_INSTALL) \
|
||||
read "$(SITEARCHEXP)/auto/$(FULLEXT)/.packlist" \
|
||||
write "$(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist" \
|
||||
"$(INST_LIB)" "$(DESTINSTALLSITELIB)" \
|
||||
"$(INST_ARCHLIB)" "$(DESTINSTALLSITEARCH)" \
|
||||
"$(INST_BIN)" "$(DESTINSTALLSITEBIN)" \
|
||||
"$(INST_SCRIPT)" "$(DESTINSTALLSITESCRIPT)" \
|
||||
"$(INST_MAN1DIR)" "$(DESTINSTALLSITEMAN1DIR)" \
|
||||
"$(INST_MAN3DIR)" "$(DESTINSTALLSITEMAN3DIR)"
|
||||
$(NOECHO) $(WARN_IF_OLD_PACKLIST) \
|
||||
"$(PERL_ARCHLIB)/auto/$(FULLEXT)"
|
||||
|
||||
pure_vendor_install :: all
|
||||
$(NOECHO) umask 022; $(MOD_INSTALL) \
|
||||
"$(INST_LIB)" "$(DESTINSTALLVENDORLIB)" \
|
||||
"$(INST_ARCHLIB)" "$(DESTINSTALLVENDORARCH)" \
|
||||
"$(INST_BIN)" "$(DESTINSTALLVENDORBIN)" \
|
||||
"$(INST_SCRIPT)" "$(DESTINSTALLVENDORSCRIPT)" \
|
||||
"$(INST_MAN1DIR)" "$(DESTINSTALLVENDORMAN1DIR)" \
|
||||
"$(INST_MAN3DIR)" "$(DESTINSTALLVENDORMAN3DIR)"
|
||||
|
||||
|
||||
doc_perl_install :: all
|
||||
|
||||
doc_site_install :: all
|
||||
$(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLSITEARCH)/perllocal.pod"
|
||||
-$(NOECHO) umask 02; $(MKPATH) "$(DESTINSTALLSITEARCH)"
|
||||
-$(NOECHO) umask 02; $(DOC_INSTALL) \
|
||||
"Module" "$(NAME)" \
|
||||
"installed into" $(INSTALLSITELIB) \
|
||||
LINKTYPE "$(LINKTYPE)" \
|
||||
VERSION "$(VERSION)" \
|
||||
EXE_FILES "$(EXE_FILES)" \
|
||||
>> "$(DESTINSTALLSITEARCH)/perllocal.pod"
|
||||
|
||||
doc_vendor_install :: all
|
||||
|
||||
|
||||
uninstall :: uninstall_from_$(INSTALLDIRS)dirs
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
uninstall_from_perldirs ::
|
||||
|
||||
uninstall_from_sitedirs ::
|
||||
$(NOECHO) $(UNINSTALL) "$(SITEARCHEXP)/auto/$(FULLEXT)/.packlist"
|
||||
|
||||
uninstall_from_vendordirs ::
|
||||
|
||||
|
||||
# --- MakeMaker force section:
|
||||
# Phony target to force checking subdirectories.
|
||||
FORCE :
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
# --- MakeMaker perldepend section:
|
||||
|
||||
|
||||
# --- MakeMaker makefile section:
|
||||
# We take a very conservative approach here, but it's worth it.
|
||||
# We move Makefile to Makefile.old here to avoid gnu make looping.
|
||||
$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
|
||||
$(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?"
|
||||
$(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
|
||||
-$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
|
||||
-$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
|
||||
- $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL)
|
||||
$(PERLRUN) Makefile.PL
|
||||
$(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
|
||||
$(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <=="
|
||||
$(FALSE)
|
||||
|
||||
|
||||
|
||||
# --- MakeMaker staticmake section:
|
||||
|
||||
# --- MakeMaker makeaperl section ---
|
||||
MAP_TARGET = perl
|
||||
FULLPERL = "/usr/bin/perl"
|
||||
|
||||
$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
|
||||
$(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@
|
||||
|
||||
$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib
|
||||
$(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
|
||||
$(NOECHO) $(PERLRUNINST) \
|
||||
Makefile.PL DIR="" \
|
||||
MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
|
||||
MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=
|
||||
|
||||
|
||||
# --- MakeMaker test section:
|
||||
|
||||
TEST_VERBOSE=0
|
||||
TEST_TYPE=test_$(LINKTYPE)
|
||||
TEST_FILE = test.pl
|
||||
TEST_FILES =
|
||||
TESTDB_SW = -d
|
||||
|
||||
testdb :: testdb_$(LINKTYPE)
|
||||
|
||||
test :: $(TEST_TYPE) subdirs-test
|
||||
|
||||
subdirs-test ::
|
||||
$(NOECHO) $(NOOP)
|
||||
|
||||
|
||||
test_dynamic :: pure_all
|
||||
PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE)
|
||||
|
||||
testdb_dynamic :: pure_all
|
||||
PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE)
|
||||
|
||||
test_ : test_dynamic
|
||||
|
||||
test_static :: test_dynamic
|
||||
testdb_static :: testdb_dynamic
|
||||
|
||||
|
||||
# --- MakeMaker ppd section:
|
||||
# Creates a PPD (Perl Package Description) for a binary distribution.
|
||||
ppd :
|
||||
$(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="$(VERSION)">' > $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <ABSTRACT>mikes perl tools</ABSTRACT>' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <AUTHOR>M.Wesemann <mwx@gmx.de></AUTHOR>' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <IMPLEMENTATION>' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <REQUIRE NAME="MD5::" />' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <REQUIRE NAME="Math::BigInt" />' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <REQUIRE NAME="Net::NIS" />' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <REQUIRE NAME="Net::SMTP" />' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <REQUIRE NAME="Term::ReadKey" />' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <REQUIRE NAME="Time::HiRes" />' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <ARCHITECTURE NAME="x86_64-linux-gnu-thread-multi-5.22" />' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' <CODEBASE HREF="" />' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) ' </IMPLEMENTATION>' >> $(DISTNAME).ppd
|
||||
$(NOECHO) $(ECHO) '</SOFTPKG>' >> $(DISTNAME).ppd
|
||||
|
||||
|
||||
# --- MakeMaker pm_to_blib section:
|
||||
|
||||
pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
|
||||
$(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', q[$(PM_FILTER)], '\''$(PERM_DIR)'\'')' -- \
|
||||
mwx.pm $(INST_LIB)/mwx.pm
|
||||
$(NOECHO) $(TOUCH) pm_to_blib
|
||||
|
||||
|
||||
# --- MakeMaker selfdocument section:
|
||||
|
||||
|
||||
# --- MakeMaker postamble section:
|
||||
|
||||
|
||||
# End.
|
||||
@@ -0,0 +1,35 @@
|
||||
mwx version 0.01
|
||||
================
|
||||
|
||||
The README is used to introduce the module and provide instructions on
|
||||
how to install the module, any machine dependencies it may have (for
|
||||
example C compilers and installed libraries) and any other information
|
||||
that should be provided before the module is installed.
|
||||
|
||||
A README file is required for CPAN modules since CPAN extracts the
|
||||
README file from a module distribution so that people browsing the
|
||||
archive can use it get an idea of the modules uses. It is usually a
|
||||
good idea to provide version information here so that people can
|
||||
decide whether fixes for the module are worth downloading.
|
||||
|
||||
INSTALLATION
|
||||
|
||||
To install this module type the following:
|
||||
|
||||
perl Makefile.PL
|
||||
make
|
||||
make test
|
||||
make install
|
||||
|
||||
DEPENDENCIES
|
||||
|
||||
This module requires these other modules and libraries:
|
||||
|
||||
blah blah blah
|
||||
|
||||
COPYRIGHT AND LICENCE
|
||||
|
||||
Put the correct copyright and licence information here.
|
||||
|
||||
Copyright (C) 2003 A. U. Thor blah blah blah
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
######################################### mikes perl tools (mwx,11.09.03) #####
|
||||
package mwx;
|
||||
|
||||
use 5.006;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
require Exporter;
|
||||
use AutoLoader qw(AUTOLOAD);
|
||||
|
||||
our $VERSION = '1.21';
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
|
||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
||||
|
||||
our @EXPORT = qw(
|
||||
sendmail
|
||||
md5
|
||||
gnfip
|
||||
tosql
|
||||
tsd
|
||||
fsd
|
||||
mkdatequery
|
||||
mknumquery
|
||||
mkquery
|
||||
uniqid
|
||||
shortstr
|
||||
);
|
||||
|
||||
################################################################### TOOLS #####
|
||||
|
||||
sub sendmail { ##### send mail #####
|
||||
my($from,$to,$subject,$message,$server)=@_;
|
||||
use Net::SMTP;
|
||||
my($smtp)=Net::SMTP->new("mail",Debug=>0);
|
||||
$smtp->mail("<$from>");
|
||||
$smtp->recipient($to);$smtp->data();
|
||||
$smtp->datasend("To: $to\n");
|
||||
$smtp->datasend("From: $from\n");
|
||||
$smtp->datasend("Subject: $subject\n");
|
||||
$smtp->datasend("$message\n");
|
||||
$smtp->dataend();
|
||||
$smtp->quit();
|
||||
}
|
||||
|
||||
sub md5() { ##### calculate md5 checksum #####
|
||||
my($file)=@_;
|
||||
use Digest::MD5;
|
||||
open(FILE,$file);binmode(FILE);
|
||||
my($md5)=Digest::MD5->new->addfile(*FILE)->hexdigest;
|
||||
close(FILE);
|
||||
return($md5);
|
||||
}
|
||||
|
||||
sub gnfip { ##### find hostname for given IP (bug fixed version) #####
|
||||
my($ip)=@_;
|
||||
use Net::DNS;
|
||||
if ($ip!~/\d+\.\d+\.\d+\.\d+/) {;return $ip;}
|
||||
my($res) = new Net::DNS::Resolver;
|
||||
my($query)=$res->query($ip);
|
||||
if ($query) {
|
||||
for ($query->answer) {
|
||||
if ($_->type eq 'PTR') {
|
||||
my($ip)=$_->ptrdname;
|
||||
return("$ip");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {;return("$ip");}
|
||||
}
|
||||
|
||||
sub tosql { ##### convert string for SQL #####
|
||||
my($str)=@_;my($a)="'";my($b)="`";if(!defined($str)) {;$str="";}
|
||||
$str=~s/$b/$a$a/g;$str=~s/$a/$a$a/g;$str=~s/\s*$//g;$str=~s/^\s*//g;
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub tsd { ##### format date/time to MySQL date/time #####
|
||||
my($tmp)=@_;my($y);
|
||||
$tmp=~s/^\s*//;$tmp=~s/\s*$//;$tmp=~s/\s+/ / ;
|
||||
if ($tmp=~/^(\d+)\.(\d+)\.(\d+)\s+(\d+)\:(\d+)$/) {
|
||||
$y=$3;if ($3>=0 && $3<100) {;$y=$3+2000;}
|
||||
return sprintf("%04d-%02d-%02d %02d:%02d",$y,$2,$1,$4,$5);
|
||||
}
|
||||
if ($tmp=~/^(\d+)\.(\d+)\.(\d+)\s+(\d+)\:(\d+)\:(\d+)$/) {
|
||||
$y=$3;if ($3>=0 && $3<100) {;$y=$3+2000;}
|
||||
return sprintf("%04d-%02d-%02d %02d:%02d:%02d",$y,$2,$1,$4,$5,$6);
|
||||
}
|
||||
elsif ($tmp=~/^(\d+)\.(\d+)\.(\d+)$/) {
|
||||
$y=$3;if ($3>=0 && $3<100) {;$y=$3+2000;}
|
||||
return sprintf("%04d-%02d-%02d",$y,$2,$1);
|
||||
}
|
||||
elsif ($tmp=~/^(\d+)\:(\d+)$/) {
|
||||
return sprintf("%02d:%02d",$1,$2);
|
||||
}
|
||||
else {;return("");}
|
||||
}
|
||||
|
||||
sub fsd { ########################### format MySQL date/time to date/time #####
|
||||
my($tmp,$mode)=@_;if (!defined($mode)) {;$mode="";}
|
||||
$tmp=~s/^\s*//;$tmp=~s/\s*$//;$tmp=~s/\s+/ / ;
|
||||
if ($tmp=~/(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)/) {
|
||||
if ($tmp eq '0000-00-00 00:00:00') {;return("");}
|
||||
if ($mode eq 'date') {
|
||||
return sprintf("%d\.%d\.%04d",$3,$2,$1);
|
||||
}
|
||||
elsif ($mode eq 'time') {
|
||||
return sprintf("%d\:%02d",$4,$5);
|
||||
}
|
||||
else {
|
||||
return sprintf("%d\.%d\.%04d %d\:%02d",$3,$2,$1,$4,$5);
|
||||
}
|
||||
}
|
||||
elsif ($tmp=~/(\d+)\-(\d+)\-(\d+)/) {
|
||||
if ($tmp eq '0000-00-00' || $mode eq 'time') {;return("");}
|
||||
return sprintf("%d\.%d\.%04d",$3,$2,$1);
|
||||
}
|
||||
if ($tmp=~/(\d+)\:(\d+)\:(\d+)/) {
|
||||
if ($mode eq 'date') {;return("");}
|
||||
return sprintf("%d\:%02d",$1,$2);
|
||||
}
|
||||
else {;return("");}
|
||||
}
|
||||
|
||||
sub mkdatequery { ###################### make query string for date range #####
|
||||
my($datestr,$field)=@_;
|
||||
my(@list)=split(",",$datestr);
|
||||
my($tmp)="";my($da,$db);
|
||||
for (@list) {
|
||||
if (/^\s*([^\s]+)\s*\-\s*([^\s]+)\s*$/) {
|
||||
$da=$1;$db=$2;
|
||||
$da=~s/(\d+)\.(\d+)\.(\d+)/$3\-$2\-$1/;
|
||||
$db=~s/(\d+)\.(\d+)\.(\d+)/$3\-$2\-$1/;
|
||||
$tmp.=" $field BETWEEN '$da' AND '$db' OR ";
|
||||
}
|
||||
elsif (/^\s*([\>\<])\s*(.*)/) {
|
||||
$da=$1;$db=$2;$db=~s/(\d+)\.(\d+)\.(\d+)/$3\-$2\-$1/;
|
||||
$tmp.=" $field $da '$db' OR ";
|
||||
}
|
||||
elsif (/^\s*\-(\d+)$/) {
|
||||
$tmp.=" UNIX_TIMESTAMP($field)>UNIX_TIMESTAMP(now())-(86400*$1) OR ";
|
||||
}
|
||||
elsif (/^\s*([^\s]+)\s*$/) {
|
||||
$da=$1;$da=~s/(\d+)\.(\d+)\.(\d+)/$3\-$2\-$1/;
|
||||
$tmp.=" $field='$da' OR ";
|
||||
}
|
||||
}
|
||||
$tmp=~s/\s*or\s*$//i;$tmp=~s/^\s//i;$tmp=~s/\s+/ /g;
|
||||
if ($tmp=~/^\s*$/) {;return "";}
|
||||
return "($tmp)";
|
||||
}
|
||||
|
||||
sub mknumquery { ##################### make query string for number range #####
|
||||
my($numstr,$field)=@_;
|
||||
my($tmp)="";
|
||||
my(@list)=split(",",$numstr);
|
||||
for (@list) {
|
||||
if (/^\s*(\d+)\s*\-\s*(\d+)\s*$/) {
|
||||
$tmp.=" $field BETWEEN $1 AND $2 OR ";
|
||||
}
|
||||
elsif (/^\s*([\>\<])\s*(\d+)/) {
|
||||
$tmp.=" $field $1 $2 OR ";
|
||||
}
|
||||
elsif (/^\s*(\d+)\s*$/) {
|
||||
$tmp.=" $field=$1 OR ";
|
||||
}
|
||||
}
|
||||
$tmp=~s/\s*or\s*$//i;$tmp=~s/^\s//i;$tmp=~s/\s+/ /g;
|
||||
return "($tmp)";
|
||||
}
|
||||
|
||||
sub mkquery { ############################### make query string for field #####
|
||||
my($query,$mode,@fields)=@_;if (!defined($query)) {;$query="";}
|
||||
my(@list,$tmp,$field,@field);
|
||||
use Text::ParseWords;
|
||||
|
||||
$query=~s/\s*\(\s*/ \( /g;$query=~s/\s*\)\s*/ \) /g;
|
||||
@list="ewords(' ',0,$query);
|
||||
$query="";
|
||||
my($notflag)=0;
|
||||
for (@list) {
|
||||
if (!/^\s*and\s*$/i && !/^\s*or\s*$/i &&
|
||||
!/^\s*andnot\s*$/i && !/^\s*ornot\s*$/i &&
|
||||
!/^\s*\(\s*$/ && !/^\s*\)\s*$/ && !/^\s*$/) {
|
||||
s/^\s*\'//;s/\'\s*$//;
|
||||
|
||||
if ($query=~/\)\s*$/) {;$query.=" AND (";}
|
||||
else {;$query.="(";}
|
||||
for $field (@fields) {
|
||||
$tmp=$_;if($mode==1) {;$tmp=" $_ ";}
|
||||
if ($notflag) {;$query.=" NOT($field LIKE '%$tmp%') ";$notflag=0;}
|
||||
else {;$query.=" $field LIKE '%$tmp%' ";}
|
||||
$query.="OR ";
|
||||
}
|
||||
$query=~s/\s*or\s*$/\)/i;
|
||||
}
|
||||
else {
|
||||
if ($_=~/^\s*andnot\s*$/i) {;$query.=" AND ";$notflag=1;}
|
||||
elsif ($_=~/^\s*andnot\s*$/i) {;$query.=" OR ";$notflag=1;}
|
||||
else {;$query.=" $_ ";}
|
||||
}
|
||||
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
sub base62() { ################################################### Base62 #####
|
||||
my($s)=@_;
|
||||
my(@c)=('0'..'9','a'..'z','A'..'Z');
|
||||
my(@p,$u,$v,$i,$n);
|
||||
my($m)=20;
|
||||
$p[0]=1;
|
||||
for $i (1..$m) {
|
||||
$p[$i]=Math::BigInt->new($p[$i-1]);
|
||||
$p[$i]=$p[$i]->bmul(62);
|
||||
}
|
||||
|
||||
$v=Math::BigInt->new($s);
|
||||
for ($i=$m;$i>=0;$i--) {
|
||||
$v=Math::BigInt->new($v);
|
||||
($n,$v)=$v->bdiv($p[$i]);
|
||||
$u.=$c[$n];
|
||||
}
|
||||
$u=~s/^0+//;
|
||||
|
||||
return($u);
|
||||
}
|
||||
|
||||
sub uniqid { ############################################## get unique id #####
|
||||
use Math::BigInt;
|
||||
use Sys::Hostname;
|
||||
use Time::HiRes qw( gettimeofday usleep );
|
||||
my($s,$us)=gettimeofday();
|
||||
my($ia,$ib,$ic,$id)=unpack("C4", (gethostbyname(hostname()))[4]);
|
||||
my($v)=sprintf("%06d%10d%06d%03d%03d%03d%03d",$us,$s,$$,$ia,$ib,$ic,$id);
|
||||
return(&base62($v));
|
||||
}
|
||||
|
||||
sub shortstr() { ########################### make short string with '...' #####
|
||||
my($str,$len)=@_;
|
||||
if (length($str)>$len) {
|
||||
my($tmp)=substr($str,0,$len-3) . "...";
|
||||
return $tmp;
|
||||
} else {;return ($str);}
|
||||
}
|
||||
|
||||
##################################################################### END #####
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
mwx - mikes perl tools
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use mwx;
|
||||
|
||||
sendmail($from,$to,$subject,$message,$server);
|
||||
|
||||
$md5 = md5($file);
|
||||
|
||||
$name = gnfip($ip);
|
||||
|
||||
$str = tosql($str);
|
||||
$sqldate = tsd($date);
|
||||
$date = fsd($date);
|
||||
|
||||
$subsql = mkdatequery($datestr,$columnname);
|
||||
$subsql = mknumquery($numstr,$columnname);
|
||||
$subsql = mkquery($querystr,$mode,@columnnames);
|
||||
|
||||
$id = uniqid();
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Mike Wesemann, E<lt>mwx@gmx.deE<gt>
|
||||
|
||||
=cut
|
||||
@@ -0,0 +1,45 @@
|
||||
use Test;
|
||||
BEGIN { plan tests => 25 };
|
||||
use mwx;
|
||||
use strict;
|
||||
#&sendmail('mike@fhi-berlin.mpg.de','mike@fhi-berlin.mpg.de','test','MSG','mail');
|
||||
|
||||
ok(&md5('Makefile.PL'),'a37560d14c32201defbecaa17f23628c');
|
||||
|
||||
ok(&fsd('2000-10-18 09:54:01'),'18.10.2000 9:54');
|
||||
ok(&fsd('0000-00-00 00:00:00'),'');
|
||||
ok(&fsd('1999-09-19'),'19.9.1999');
|
||||
ok(&fsd('0000-00-00'),'');
|
||||
ok(&fsd('08:53:02'),'8:53');
|
||||
ok(&fsd('00:00:00'),'0:00');
|
||||
ok(&fsd('2000-10-18 09:54:01','date'),'18.10.2000');
|
||||
ok(&fsd('2000-10-18 09:54:01','time'),'9:54');
|
||||
ok(&tsd('23.12.2002'),'2002-12-23');
|
||||
ok(&tsd('24.11.2001 14:12'),'2001-11-24 14:12');
|
||||
ok(&tsd('24.11.2001 14:12:23'),'2001-11-24 14:12:23');
|
||||
ok(&tsd('0:1'),'00:01');
|
||||
|
||||
ok(&gnfip('141.14.141.141'),'root.RZ-Berlin.MPG.DE');
|
||||
|
||||
ok(&mkdatequery("1.1.2002 , 2.2.2003","date"),
|
||||
"(date='2002-1-1' OR date='2003-2-2')");
|
||||
ok(&mkdatequery("1.11.2002 - 7.11.2002","date"),
|
||||
"(date BETWEEN '2002-11-1' AND '2002-11-7')");
|
||||
ok(&mkdatequery("> 1.11.2002","date"),"(date > '2002-11-1')");
|
||||
|
||||
ok(&mknumquery(" 2 - 5 ","number"),"(number BETWEEN 2 AND 5)");
|
||||
ok(&mknumquery("11,22 ,33","number"),"(number=11 OR number=22 OR number=33)");
|
||||
|
||||
ok(&mkquery("tee or cafe",0,'string'),
|
||||
"( string LIKE '%tee%') or ( string LIKE '%cafe%')");
|
||||
ok(&mkquery("'tee or cafe'",0,'string'),"( string LIKE '%tee or cafe%')");
|
||||
|
||||
ok(&tosql(' test '),'test');
|
||||
ok(&tosql("a'b"),"a''b");
|
||||
|
||||
ok(&shortstr('0123456789',10),'0123456789');
|
||||
ok(&shortstr('0123456789',8),'01234...');
|
||||
|
||||
print &uniqid() . " " . &uniqid() . " " . &uniqid() . "\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user