On 2012-10-20 21:50, Dan Espen wrote:
Philippe Grégoire<gregoi...@hotmail.com>  writes:

Hi,

I am working on a window placement module in perl and \
noticed a discrepancy between the documentation and the \
implementation.

In 'FVWM::Tracker::GlobalConfig', it is said that the \
observable is "value updated". However, the code uses \
"value changed". As such, modules that use this tracker \
do not receive updates. Here is a patch for the documen- \
tation:

--- fvwm-snap-20121011/perllib/FVWM/Tracker/GlobalConfig.pm
2009-03-17 13:09:15.000000000 -0400
+++ fvwm-snap-20121011p/perllib/FVWM/Tracker/GlobalConfig.pm
2012-10-18 16:52:54.000000000 -0400
@@ -100,7 +100,7 @@ __END__
  This is a subclass of B<FVWM::Tracker>  that enables to read the global
  FVWM configuration.

-    "value updated"
+    "value changed"

  =head1 SYNOPSYS

Changed vs Updated, I'm failing to see the difference.


Based on the current documentation, a module like this:

my $fvwm = new FVWM::Module();
my $trac = $fvwm->track('GlobalConfig');
$trac>observe('value updated', sub {
        my ($self, $track, $hash, $name) = @_;
        print("GlobalConfig: $name\n");
});
$fvwm->eventLoops();

and doing 'DesktopName 0 x' in FvwmConsole should print
'GlobalConfig: DesktopName 0' in '~/.xsession-errors', but it doesn't.

The problem lies in the fact that the GlobalConfig code dispatch the event "value changed", not "value updated". GlobalConfig.pm contains both the implementation and the documentation, and they don't match. To
prove it, in the code above, use 'value changed'.

Now you can change the implementation to match the documentation, but assuming that no code respecting the documentation works and that those that made their code work checked the implementation, you should change the documentation.

Reply via email to