Package "Bit::Vector" Version 7.1
=====================================
Copyright (c) 1995 - 2009 by Steffen Beyer.
All rights reserved.
+ Prerequisites
+ Preliminary steps for use with Perl prior to version 5.002
+ Preliminary steps for use with ActiveState's port of Perl 5
+ Installation
Perl version 5.000 or higher, and an ANSI C compiler. (!)
^^^^^^ Module "Carp::Clan" version 5.3 or higher.
Optionally, module "Storable" version 2.21 or newer.
Note that in order to compile Perl modules which contain C (and/or XS) code (such as this one), you always HAVE to use the very same compiler your Perl itself was compiled with.
Many vendors nowadays ship their operating system already comprising a precompiled version of Perl. Many times the compilers used to compile this version of Perl are not available to or not usually used by the users of these operating systems.
In such cases building this module (or any other Perl module containing C and/or XS code) will not work. You will either have to get the compiler which was used to compile Perl itself (see for example the section "Compiler:" in the output of the command "perl -V"), or to build your own Perl with the compiler of your choice (which also allows you to take advantage of the various compiletime switches Perl offers).
Note that Sun Solaris and Red Hat Linux frequently were reported to suffer from this kind of problem.
Moreover, you usually cannot build any modules under Windows 95/98 since the Win 95/98 command shell doesn't support the "&&" operator. You will need the Windows NT command shell ("cmd.exe") or the "4DOS" shell to be installed on your Windows 95/98 system first. Note that Windows NT, Windows 2000 and Windows XP are not affected and just work fine. I don't know about Windows Vista and Windows 7, however.
Note that ActiveState provides precompiled binaries of this module for their Win32 port of Perl ("ActivePerl") on their web site, which you should be able to install simply by typing "ppm install Bit-Vector" in your MS-DOS command shell (but note the "-" instead of "::" in the package name!). This also works under Windows 95/98 (!).
If your firewall prevents "ppm" from downloading this package, you can also download it manually from http://www.activestate.com/ppmpackages/5.005/zips/ or http://www.activestate.com/ppmpackages/5.6/zips/. Follow the installation instructions included in the "zip" archive.
Edit the file "Makefile.PL" and change the line
'VERSION_FROM' => 'Vector.pm', to
'VERSION' => '7.1',
Then edit the file "Vector.pm" and change the line
bootstrap Bit::Vector $VERSION;
to
bootstrap Bit::Vector;
Also edit the file "t/00____version.t" and change the line
use Bit::Vector 7.1;
to
use Bit::Vector;
Finally, edit the file "Vector.xs" and delete the line
PROTOTYPES: DISABLE
(For the Win32 platform)
Edit the file "Makefile.PL" and remove all of the "#" characters which currently comment out the lines involved with the setting of the attributes "ABSTRACT", "AUTHOR" and "CAPI".
UNIX: Win32/Borland C++: Win32/MS Visual C++:
===== ================== ====================
% perl Makefile.PL % perl Makefile.PL % perl Makefile.PL
% make % dmake % nmake
% make test % dmake test % nmake test
% make install % dmake install % nmake install
This will create a "Makefile" with the appropriate parameters for your system (for instance, where the install directories are, and so on).
See "man ExtUtils::MakeMaker" or "perldoc ExtUtils::MakeMaker" for other useful options to this command, like setting a different installation PREFIX.
(For installation under Windows NT/95, use "dmake" (Borland C++) or "nmake" (MS Visual C++) instead!)
This will create a dynamically linkable library file that will be linked to Perl later, at runtime, provided your system supports dynamic linking.
Please refer to the MakeMaker documentation for instructions on how to build a new Perl with statically linked libraries (invoke "perldoc ExtUtils::MakeMaker" for this), if your system does NOT support dynamic linking!
Should you encounter any compiler warnings or errors (like the redefinition of certain types already defined by your system), please contact me via e-mail at <STBEY@cpan.org>, sending me your compiler output (both STDOUT and STDERR). Thank you!
BEWARE that you need an ANSI C compiler in order to successfully compile this package!
Also note that problems may arise with the c89 compiler of HP, although it allegedly supports ANSI C!
I recommend the GNU C compiler ("gcc"), which is freely available on the Internet (see ftp://ftp.gnu.org/pub/gnu/ and mirror sites thereof).
(HP users are strongly recommended to install the GNU assembler "gas" first before installing the GNU C compiler "gcc", according to GNU.)
Should you get the error messages
Vector.c: 15: Unable to find include file 'EXTERN.h'. Vector.c: 16: Unable to find include file 'perl.h'. Vector.c: 17: Unable to find include file 'XSUB.h'.
then edit the file "Makefile.PL" and add a line similar to the following so that it points to your Perl 5 distribution tree:
'INC' => '-I/usr/ctr/dlt/private/perl/perl5.003',
Then start over with the generation of the "Makefile" at 2).
The output should look somewhat like this:
PERL_DL_NONLAZY=1 /v/guest/sw/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00_____version.t .. ok t/01_________new.t .. ok t/02_____destroy.t .. ok t/03__operations.t .. ok t/04___functions.t .. ok t/05______primes.t .. ok t/06______subset.t .. ok t/07_____compare.t .. ok t/08______resize.t .. ok t/09__parameters.t .. ok t/10___intervals.t .. ok t/11_______shift.t .. ok t/12______string.t .. ok t/13___increment.t .. ok t/14_______empty.t .. ok t/15_________add.t .. ok t/16____subtract.t .. ok t/17_________gcd.t .. ok t/28___chunklist.t .. ok t/30__overloaded.t .. ok t/40___auxiliary.t .. ok t/50_freeze_thaw.t .. ok t/51_file_nstore.t .. ok All tests successful. Files=23, Tests=91963, 16 wallclock secs (13.63 usr 0.23 sys + 2.91 cusr 0.56 csys = 17.34 CPU) Result: PASS
(Note that the exact number of tests will depend on the number of bits of a machine word/an unsigned long on your system!)
It will ask you to enter a number which will serve as an upper limit for the calculation of all prime numbers up to that limit, using the algorithm known as "The Sieve of Erathostenes".
On my machine (SUN SPARCstation 20/61), calculating all the prime numbers up to one million takes about 1 minute 30 seconds to 2 minutes (depending on the load) when the algorithm is programmed in Perl. If the internal method "Primes()" is used instead (implemented in C), the same machine only takes about 1 second for this task.