Glenn Linderman wrote:
Given:
In GFfP.pm:
our $VERSION = '0.1';
Later in a script:
use GFfP;
print "GFfP::VERSION: $GFfP::VERSION -- ", $GFfP::VERSION + 0, " -- ", ( $GFfP::VERSION >= 0.199999999 ), "\n";
Why do I get the output:
GFfP::VERSION: 0.1 -- 0 -- 1
I would have expected something similar to:
GFfP::VERSION: 0.1 -- 0.1 --
That's also what I would expect - and it's what I get (though I haven't actually tested with GFfp.pm). I wondered whether it was the 'our' that was doing something strange ... but it's not that. Then I wondered if it was the single quotes around 0.1 that was creating the problem ... but it doesn't seem to be that either. eg bytes.pm has:
our $VERSION = '1.01';
and there's no problem with it.
use bytes; print $bytes::VERSION, " ", $bytes::VERSION + 0, "\n";
# prints "1.01 1.01" for me on perl 5.8.
Thanks for discovering that. I hadn't thought to do that sort of investigation. I had, on the other hand, cloned my VERSION definition from a different existing module.
Does enabling warnings shed any light on the matter ?
I think warnings and strict are both on, in the script, and in the module. Yep, just checked.
As regards *my* capacity to help, it's pretty much a case of "If I can't reproduce it, then I can't fix it" :-)
Sure, I understand that. I could actually provide the module, and a sample script, but it is 1MB is size... Maybe I should write a shorter sample script first, and see if it is my script doing something weird, vs. the module.
And even better, what should I code to determine that $GFfP::VERSION is greater or less than '0.2', which I am about to change it to, so that the script can knowledgeably use either version of the module?
Not sure that I fully understand the situation but normally you would just use the numeric comparison operators for determining such things.
Yep. That's what I thought. Since it is floating point, I didn't want to say $GFfP::VERSION == 0.2 hence the >= 0.1999999 bit.
I can change next version of the module (it is mine) but can't really retrofit the current version, if the line in GFfP.pm should be changed. Have I dug a hole for my module?
If there's a line in GFfp.pm that needs changing, then it looks to me that it aint the one you've quoted :-)
There's not much more. GFfP.pm is just a placeholder for a bunch of XS code. Here is the module in its entirety (except for the leading comments).
package GFfP;
use strict; use warnings;
require DynaLoader;
our $VERSION = '0.1';
our @ISA = qw( DynaLoader );
bootstrap GFfP $VERSION;
############################################################################### # PUBLIC METHODS # (@)PACKAGE:GFfP
########################################################################### # (@)METHOD:Version() # Returns the module version number.
sub Version
{ return $VERSION;
}
-- Glenn -- http://nevcal.com/ =========================== The best part about procrastination is that you are never bored, because you have all kinds of things that you should be doing. _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
