[Padre-dev] Padre, Alien::wxWidgets and wxWidgets 2.8.10

Cezary Morga cm at therek.net
Sun Mar 22 01:51:23 PDT 2009


Gabor Szabo wrote:
> > --- inc/Module/Install/PRIVATE/Padre.pm.orig    2009-03-21
> > 20:36:42.000000000 +0100
> > +++ inc/Module/Install/PRIVATE/Padre.pm 2009-03-21
> > 20:50:20.000000000 +0100
> > @@ -59,9 +59,10 @@
> >        unless ( $widgets ) {
> >                nono("Alien::wxWidgets was unable to determine the
> > wxWidgets version");
> >        }
> > -       my $widgets_human = $widgets;
> > -       $widgets_human =~ s/^(\d\.\d\d\d)(\d\d\d)$/$1.$2/;
> > -       $widgets_human =~ s/0//g;
> > +       my ($widgets_human, $w2, $w3) = $widgets =~ /(\d)\.(\d\d\d)
> > (\d\d\d)/;
> > +       $w2 =~ s/^0+//;
> > +       $w3 =~ s/^0+//;
> > +       $widgets_human .= ".$w2.$w3";
> >        print "Found wxWidgets $widgets_human\n";
> >        unless ( $widgets >= 2.008008 ) {
> >                nono("Padre needs at least version 2.8.8 of
> > wxWidgets. You have wxWidgets $widgets_human");
>
> I am not sure why removing the leading 0s would help here?

The version returned from Alien::wxWidgets->version is
2.008010. Originally the conversion to human readable version number was 
done by first adding . (dot) so we have 2.008.010 and then by removing 
all zeros (s/0//g) which leaves 2.8.1 because also the trailing zero is 
removed.

What I sent you was an attempt to remove only the leading zeros.

Receiving 2.8.1 instead of 2.8.10 is slightly misleading now, but when 
wxWidgets version number bumps to 2.10.1 you'll receive 2.1.1 which 
will pose a bigger problem.

Here's a better idea:
        $widgets_human =~ s/^(\d\.\d\d\d)(\d\d\d)$/$1.$2/;
-       $widgets_human =~ s/0//g;
+       $widgets_human =~ s/\.0*/./g;
        print "Found wxWidgets $widgets_human\n";
        unless ( $widgets >= 2.008008 ) {
-- 
Cezary Morga
"Nah, a database recovery, some system tuning and a couple of helpdesk 
calls - nothing that can't wait..." (BOFH @theregister.co.uk)


More information about the Padre-dev mailing list