----- Original Message -----
From: "Jan Dubois"
>
> Try writing it like this:
>
> package Foo;
> use strict;
> use warnings;
>
> use Exporter;
> use DynaLoader;
>
> BEGIN {
> @Foo::ISA = qw(Exporter DynaLoader);
> @Foo::EXPORT_OK = qw(VALUE);
>
> $Foo::VERSION = '0.01';
>
> bootstrap Foo $Foo::VERSION;
> }
>
> use constant VALUE => foo();
>
> 1;
>
> I haven't actually tested this, so maybe I overlooked some other issue.
> Let us know if it works! :)
>
Good thinking - that works fine.
I had tried moving the 'use constant ... ' to the bottom of the file (to no
avail), but hadn't thought to try bootstrapping in a BEGIN{} block.
The following also works:
package Foo;
use strict;
use warnings;
BEGIN{
require Exporter;
require DynaLoader;
@Foo::ISA = qw(Exporter DynaLoader);
@Foo::EXPORT_OK = qw(VALUE);
$Foo::VERSION = '0.01';
bootstrap Foo $Foo::VERSION;
}
use constant VALUE => foo();
1;
and there are perhaps other variations on the same theme that work just as
well.
Cheers,
Rob
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs