Hi all,

I have implemented a bug fix and would appreciate your advice on how to
include it correctly into the official version.
The new Inline.pm file can be downloaded here:
http://yaakovnet.net/Inline-0.45.pm
...
sub md5_checksum {
    my $o=shift; my $config=$o->{CONFIG};
    require Digest::MD5;
    my $md5=Digest::MD5->new;
    for my $key (sort keys %$config) {   # include all config options
        next if $key eq "FORCE_BUILD";   # ... but skip FORCE_BUILD
        my $value=$config->{$key};
        if(ref($value) eq "ARRAY") {     # some values are arrays
            $md5->add("*$key: [EMAIL PROTECTED]");
        }
        elsif(ref($value)) {             # this should not happen
            $md5->add("*$key: ??\0");    #    this is not perfect but works
        }
        else {                           # most values are strings
            $md5->add("*$key=$value\0");
        }
    }
    $md5->add("code: ".$o->{API}{code}); # include the source code
    return $md5->hexdigest;
};


My understanding is that this will affect all Inline modules, right?.
Are the keys in %config only the options that Inline.pm knows about or
do they include all config keys? For example, if I set DEBUG => 1
while using Inline::Java and later remove it, will that trigger a
rebuild?

Patrick


Some comments:

* I include all options from $o->{CONFIG} except FORCE_BUILD.
* Most options are strings: they are included directly in the checksum.
* Some options are arrays: they are expanded.
* If an option has another reference type, the option name is included,
   but the value is ignored.
* If an option has the value undef, a warning will appear with -w.

Somebody who knows all the configuration options of Inline might comment
on whether this is "the right thing":

* Maybe some config options are in different places.
* Maybe some optional config options are stored as hash tables.
* Maybe some config options should be excluded from the checksum.

In any of the cases, I will be happy to adjust the code accordingly.

Best regards,

Yaakov Belch

# from Eric Wilhelm
# on 01/03/2007 07:26 PM
> I think you're correct that all (well, mostly all) of the config options
> should be checksummed somehow.  Is the .inl file ever checksummed?  If
> so, just adding LIBS there would do the trick.  If not, I would be
> inclined to simply serialize most the config into the MD5 call.
>
> The one exception might be FORCE_BUILD (and maybe a few others.)  Adding
> FORCE_BUILD to the config should force a build anyway, but removing it
> should not.
>
> --Eric



--
=====================
Patrick LeBoutillier
Laval, Québec, Canada

Reply via email to