[gimp-perl] strict and warnings, and tidy-up.



commit 6ab0d4520eb20ca4452d6bec2dcbbe4d4d387936
Author: Ed J <edj src gnome org>
Date:   Sat May 24 17:37:29 2014 +0100

    strict and warnings, and tidy-up.

 examples/Makefile.PL             |   10 +-
 examples/Perl-Console            |    1 +
 examples/Perl-Server             |    1 +
 examples/animate_cells           |    2 +-
 examples/autosave2               |    1 +
 examples/billboard               |    3 +-
 examples/blowinout               |    1 +
 examples/bricks                  |   10 +-
 examples/burst                   |  351 +++++++++++++++++++-------------------
 examples/centerguide             |    2 +
 examples/colorhtml               |    2 +
 examples/dataurl                 |    4 +-
 examples/ditherize               |    1 +
 examples/dots                    |    1 +
 examples/dust                    |    2 +
 examples/example-extension       |    1 +
 examples/example-extension-no-fu |    2 +
 examples/example-fu              |    1 +
 examples/example-net             |    2 +
 examples/example-no-fu           |    4 +-
 examples/exceptiontest           |    2 +
 examples/fade-alpha              |    1 +
 examples/feedback                |    2 +
 examples/frame_filter            |    1 +
 examples/frame_reshuffle         |    1 +
 examples/gallery                 |    2 +
 examples/gimp-make-img-map       |    3 +
 examples/glowing_steel           |    1 +
 examples/goldenmean              |   12 +-
 examples/gouge                   |    2 +
 examples/guidegrid               |    2 +
 examples/guides_to_selection     |    4 +-
 examples/iland                   |    2 +
 examples/image_tile              |    8 +-
 examples/innerbevel              |   14 +-
 examples/layerfuncs              |    2 +
 examples/map_to_gradient         |    2 +
 examples/mirrorsplit             |    1 +
 examples/perlotine               |   34 ++--
 examples/pixelmap                |    4 +-
 examples/prep4gif                |    2 +
 examples/randomart1              |    2 +
 examples/randomblends            |    9 +-
 examples/redeye                  |    2 +
 examples/repdup                  |    6 +-
 examples/scratches               |    2 +
 examples/selective_sharpen       |    2 +
 examples/sethspin                |    1 +
 examples/stampify                |    2 +
 examples/stamps                  |    4 +-
 examples/tex-to-float            |    2 +
 examples/triangle                |    2 +
 examples/view3d                  |    2 +
 examples/warp-sharp              |    2 +
 examples/webify                  |    2 +
 examples/windify                 |    2 +
 examples/xachlego                |    8 +-
 examples/xachshadow              |   10 +-
 examples/xachvision              |   10 +-
 examples/yinyang                 |    2 +
 60 files changed, 337 insertions(+), 239 deletions(-)
---
diff --git a/examples/Makefile.PL b/examples/Makefile.PL
index 1f549d9..cfabd3e 100644
--- a/examples/Makefile.PL
+++ b/examples/Makefile.PL
@@ -1,11 +1,14 @@
 require 5.008;
 use ExtUtils::MakeMaker;
 use File::Basename;
+use strict;
+use warnings;
 
 require '../config.pl';
 
 # list of standard plugins
- pins = qw(
+our %cfg;
+my @pins = qw(
   Perl-Server
   Perl-Console
   dataurl
@@ -59,7 +62,8 @@ $dest : $plugin \$(INST_PLUGINS)\$(DFSEP).exists
 EOF
 }
 
-sub MY::postamble {
+undef &MY::postamble; # suppress warning
+*MY::postamble = sub {
    my $self=shift;
    my $UT = "$cfg{GIMPTOOL} --uninstall-admin-bin";
    <<EOF;
@@ -88,7 +92,7 @@ uninstall ::
        cd \$(INST_PLUGINS); for plugin in *; do $UT "\$\$plugin"; done
 
 EOF
-}
+};
 
 WriteMakefile(
     'NAME'     => 'Gimp',
diff --git a/examples/Perl-Console b/examples/Perl-Console
old mode 100644
new mode 100755
index d7b318b..8e71848
--- a/examples/Perl-Console
+++ b/examples/Perl-Console
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
+use warnings;
 #BEGIN { $Gimp::verbose = 1; }
 use Gimp;
 use Gimp::Fu;
diff --git a/examples/Perl-Server b/examples/Perl-Server
index 8b8ee20..2caa9c6 100755
--- a/examples/Perl-Server
+++ b/examples/Perl-Server
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
+use warnings;
 #BEGIN { $Gimp::verbose = 3; }
 use Gimp;
 use Gimp::Net;
diff --git a/examples/animate_cells b/examples/animate_cells
index fe57b71..fbd30f0 100755
--- a/examples/animate_cells
+++ b/examples/animate_cells
@@ -3,8 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
-
 use strict;
+use warnings;
 
 sub fix_cell_layer {
   my $image = shift; # The image
diff --git a/examples/autosave2 b/examples/autosave2
index 78c6419..6c18271 100755
--- a/examples/autosave2
+++ b/examples/autosave2
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
+use warnings;
 #BEGIN { $Gimp::verbose = 3; }
 use Gimp;
 use Gimp::Fu;
diff --git a/examples/billboard b/examples/billboard
index d7a83e7..78b6354 100755
--- a/examples/billboard
+++ b/examples/billboard
@@ -3,7 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
-
+use strict;
+use warnings;
 use constant PI => 3.14159;
 
 # Uncomment below to spew forth much data about whats going on.
diff --git a/examples/blowinout b/examples/blowinout
index cc941d7..c82774f 100755
--- a/examples/blowinout
+++ b/examples/blowinout
@@ -4,6 +4,7 @@
 use Gimp;
 use Gimp::Fu;
 use strict;
+use warnings;
 
 podregister {
   die "Not a layer\n" unless $drawable->is_layer;
diff --git a/examples/bricks b/examples/bricks
index c104967..2197755 100755
--- a/examples/bricks
+++ b/examples/bricks
@@ -3,6 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
+use strict;
+use warnings;
 #$Gimp::verbose = 1;
 
 podregister {
@@ -42,7 +44,7 @@ podregister {
   # make a copy of it for bump mapping
   $image->selection_all;
   $layer->edit_copy();
-  $border = $image->add_new_layer(0,0,0);
+  my $border = $image->add_new_layer(0,0,0);
   #print "$border\n";
   $border->edit_paste(0)->floating_sel_anchor;
   $image->selection_none;
@@ -55,7 +57,7 @@ podregister {
   while ($h < $imageh) {
     $w = 0; $wo = 0; $wo = ($brickw / 2) if ($j == 1);
     while ($w < $imagew) {
-      $r = int(rand ($skew) - ($skew / 1));
+      my $r = int(rand ($skew) - ($skew / 1));
       if ($r != 0) {
        Gimp::Context->set_foreground ("#ffffff") if ($r > 0);
        Gimp::Context->set_foreground ("#000000") if ($r < 0);
@@ -74,7 +76,7 @@ podregister {
   }
   $image->undo_group_end;
   Gimp::Context->set_background ($color);
-  $layerb = $image->image_add_new_layer(1,BACKGROUND_FILL,0);
+  my $layerb = $image->image_add_new_layer(1,BACKGROUND_FILL,0);
   $image->selection_all;
   if ($borderpatuse) {
     Gimp::Context->set_pattern($borderpattern);
@@ -82,7 +84,7 @@ podregister {
   }
   $border->edit_copy();
   $layerb->add_alpha;
-  $mask = $layerb->create_mask(0);
+  my $mask = $layerb->create_mask(0);
   $layerb->add_mask($mask);
   $mask->edit_paste(0)->floating_sel_anchor;
   $image->selection_none;
diff --git a/examples/burst b/examples/burst
index beaae99..ce408ec 100755
--- a/examples/burst
+++ b/examples/burst
@@ -3,6 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
+use strict;
+use warnings;
 use constant PI => 3.1415926;
 
 # find an equivalent polar value in the range of 0 to 2 pi
@@ -13,190 +15,187 @@ sub find_in_2pi {
 }
 
 podregister {
-    # Special case 360
-    if (abs($arc_angle) == 360) {
-        $end_angle = $start_angle + $arc_angle - abs ($arc_angle/$spokes);
-    } else {
-      $end_angle = $start_angle + $arc_angle;
-    }
+  # Special case 360
+  my $end_angle = $start_angle + $arc_angle -
+    abs($arc_angle) == 360 ? abs ($arc_angle/$spokes) : 0;
 
-    $image->undo_group_start;
+  $image->undo_group_start;
 
-    Gimp->progress_init("Burst");
-    $progress_increment = 1/$spokes;
-    $progress = 0;
+  Gimp->progress_init("Burst");
+  my $progress_increment = 1/$spokes;
+  my $progress = 0;
 
-    my $dumb;
-    ($dumb, $x1, $y1, $x2, $y2) = $image->selection_bounds;
-    # $image->selection_none;
+  my ($dumb, $x1, $y1, $x2, $y2) = $image->selection_bounds;
+  # $image->selection_none;
 
-    $width = $x2 - $x1;
-    $height = $y2 - $y1;
+  my $width = $x2 - $x1;
+  my $height = $y2 - $y1;
 
 #    print "X1 = $x1, X2 = $x2, Y1 = $y1, Y2 = $y2\n";
-    $center_x = $x1 + $width/2;
-    $center_y = $y1 + $height/2;
-
-    if ($start_angle > $end_angle)
-      { # swap them
-        $angle = $end_angle;
-        $end_angle = $start_angle;
-        $start_angle = $angle;
-      }
+  my $center_x = $x1 + $width/2;
+  my $center_y = $y1 + $height/2;
+
+  if ($start_angle > $end_angle)
+    { # swap them
+      my $angle = $end_angle;
+      $end_angle = $start_angle;
+      $start_angle = $angle;
+    }
 
-    if ($shape == 0)
-      { #ellipse
-        # do $spokes worth
-        for ($i = 0;
-             $i < $spokes;
-            #$angle <$end_angle*PI/180-0.01;
-             $i++ )
-          {
-            $angle = $i * abs($start_angle-$end_angle)*PI/($spokes-1)/180;
-            $angle += $start_angle*PI/180;
-
-            # use the major/minor axis description of an ellipse:
-            # x^2   y^2
-            # --- + --- = 1
-            # a^2   b^2
-            #
-            # where a is the x axis, b is the y axis, and the equation of
-            # a line passing through 0 (y=mb).  Solve for x&y, and pick the
-            # correct one for the angle.
-
-            $a = $width/2 - $outside_pixels;
-            $b = $height/2 - $outside_pixels;
-
-            # dimensions for an "inside ellipse"
-            $c = ($a>$b)?$inside_pixels:$inside_pixels*$a/$b;
-            $d = ($a>$b)?$inside_pixels*$b/$a:$inside_pixels;
-
-            # get the slope
-            $m = sin($angle)/cos($angle);
-            if ($m ==0) { $m = 0.000000000001; } #avoid div by 0
-            if ($c ==0) { $c = 0.000000000001; } #avoid div by 0
-            if ($d ==0) { $d = 0.000000000001; } #avoid div by 0
-
-            # find the positive solution of the quadratic for the endpoints
-            $x = sqrt(1/((1/$a/$a)+($m*$m/$b/$b)));
-            $y = sqrt(1/((1/($m*$m*$a*$a))+(1/$b/$b)));
-
-            # and find the starting points in the same manner
-            $x_start = sqrt(1/((1/$c/$c)+($m*$m/$d/$d)));
-            $y_start = sqrt(1/((1/($m*$m*$c*$c))+(1/$d/$d)));
-
-            # pick the right solution of the quadratic
-            if ((find_in_2pi($angle) < PI/2) ||
-                (find_in_2pi($angle) > 3*PI/2))
-              {
-                $x = -$x;
-                $x_start = -$x_start;
-              }
-            if (find_in_2pi($angle) > PI)
-              {
-                $y = -$y;
-                $y_start = -$y_start;
-              }
-            # do translations to center stuff
-            $x = $x + $center_x;
-            $y = $y + $center_y;
-            $x_start = $x_start + $center_x;
-            $y_start = $y_start + $center_y;
-
-            if ($fade_dir == 1)
-              {
-                $drawable->paintbrush_default(4, [$x, $y, $x_start, $y_start]);
-              }
-            else
-              {
-                $drawable->paintbrush_default(4, [$x_start, $y_start, $x, $y]);
-              }
-            $progress += $progress_increment;
-            Gimp->progress_update($progress);
-         }
-      }
-    else
-      { #rectangle
-        # The idea here is to see where the line intersects with the
-        # rightmost line.  If the abs of that is higer than the height,
-        # see where it intersects the top instead.
-
-        #print "width = $width, height = $height\n";
-
-        for ($i = 0;
-             $i < $spokes;
-             $i++ )
-          {
-            $angle = $i * abs($start_angle-$end_angle)*PI/($spokes-1)/180;
-            $angle += $start_angle*PI/180;
-
-            # get the slope
-            $m = sin($angle)/cos($angle);
-            if (abs($m*$width/2) < $height/2)
-              { # draw on the right/left borders
-                $x = $width/2-$outside_pixels;
-                $y = $m*($width/2-$outside_pixels);
-                $x_start = ($width>$height)
-                        ?($inside_pixels)
-                        :($inside_pixels*$width/$height);
-                $y_start = ($width>$height)
-                        ?($m*$inside_pixels)
-                        :($m*$inside_pixels*$width/$height);
-              }
-           else
-             { # draw on the top/bottom borders
-                $y = $height/2-$outside_pixels;
-                $x = ($height/2-$outside_pixels)/$m;
-                $y_start = ($width>$height)
-                        ?($inside_pixels*$height/$width)
-                        :($inside_pixels);
-                $x_start = ($width>$height)
-                        ?($inside_pixels*$height/$width/$m)
-                        :($inside_pixels/$m);
-             }
-          # the method of finding points by lines like above makes picking right
-          # values kinda icky, as shown by these if statements.
-          if ((find_in_2pi($angle) <= PI/2) ||
-             (find_in_2pi($angle) > 3*PI/2))
-            {
-                $x = -abs($x);
-                $x_start = -abs($x_start);
-            }
-          else
-            {
-                $x = abs($x);
-                $x_start = abs($x_start);
-            }
-
-          if (find_in_2pi($angle) > PI)
-            {
-              $y = -abs($y);
-              $y_start = -abs($y_start);
-            }
-          else
-            {
-              $y = abs($y);
-              $y_start = abs($y_start);
-            }
-          # do translations to center stuff
-          $x = $x + $center_x;
-          $y = $y + $center_y;
-          $x_start = $x_start + $center_x;
-          $y_start = $y_start + $center_y;
-          if ($fade_dir == 1)
-            {
-              $drawable->paintbrush_default(4, [$x, $y, $x_start, $y_start]);
-            }
-          else
-            {
-              $drawable->paintbrush_default(4, [$x_start, $y_start, $x, $y]);
-            }
-          $progress += $progress_increment;
-          Gimp->progress_update($progress);
-        }
+  if ($shape == 0)
+    { #ellipse
+      # do $spokes worth
+      for (my $i = 0;
+          $i < $spokes;
+          #$angle <$end_angle*PI/180-0.01;
+          $i++ )
+       {
+         my $angle = $i * abs($start_angle-$end_angle)*PI/($spokes-1)/180;
+         $angle += $start_angle*PI/180;
+
+         # use the major/minor axis description of an ellipse:
+         # x^2   y^2
+         # --- + --- = 1
+         # a^2   b^2
+         #
+         # where a is the x axis, b is the y axis, and the equation of
+         # a line passing through 0 (y=mb).  Solve for x&y, and pick the
+         # correct one for the angle.
+
+         my $a = $width/2 - $outside_pixels;
+         my $b = $height/2 - $outside_pixels;
+
+         # dimensions for an "inside ellipse"
+         my $c = ($a>$b)?$inside_pixels:$inside_pixels*$a/$b;
+         my $d = ($a>$b)?$inside_pixels*$b/$a:$inside_pixels;
+
+         # get the slope
+         my $m = sin($angle)/cos($angle);
+         if ($m ==0) { $m = 0.000000000001; } #avoid div by 0
+         if ($c ==0) { $c = 0.000000000001; } #avoid div by 0
+         if ($d ==0) { $d = 0.000000000001; } #avoid div by 0
+
+         # find the positive solution of the quadratic for the endpoints
+         my $x = sqrt(1/((1/$a/$a)+($m*$m/$b/$b)));
+         my $y = sqrt(1/((1/($m*$m*$a*$a))+(1/$b/$b)));
+
+         # and find the starting points in the same manner
+         my $x_start = sqrt(1/((1/$c/$c)+($m*$m/$d/$d)));
+         my $y_start = sqrt(1/((1/($m*$m*$c*$c))+(1/$d/$d)));
+
+         # pick the right solution of the quadratic
+         if ((find_in_2pi($angle) < PI/2) ||
+              (find_in_2pi($angle) > 3*PI/2))
+           {
+             $x = -$x;
+             $x_start = -$x_start;
+           }
+         if (find_in_2pi($angle) > PI)
+           {
+             $y = -$y;
+             $y_start = -$y_start;
+           }
+         # do translations to center stuff
+         $x = $x + $center_x;
+         $y = $y + $center_y;
+         $x_start = $x_start + $center_x;
+         $y_start = $y_start + $center_y;
+
+         if ($fade_dir == 1)
+           {
+             $drawable->paintbrush_default(4, [$x, $y, $x_start, $y_start]);
+           }
+         else
+           {
+             $drawable->paintbrush_default(4, [$x_start, $y_start, $x, $y]);
+           }
+         $progress += $progress_increment;
+         Gimp->progress_update($progress);
+       }
     }
-  $image->undo_group_end;
-  ();
+  else
+    { #rectangle
+      # The idea here is to see where the line intersects with the
+      # rightmost line.  If the abs of that is higer than the height,
+      # see where it intersects the top instead.
+
+      #print "width = $width, height = $height\n";
+
+      my ($x, $y, $x_start, $y_start);
+      for (my $i = 0;
+          $i < $spokes;
+          $i++ )
+       {
+         my $angle = $i * abs($start_angle-$end_angle)*PI/($spokes-1)/180;
+         $angle += $start_angle*PI/180;
+
+         # get the slope
+         my $m = sin($angle)/cos($angle);
+         if (abs($m*$width/2) < $height/2)
+           { # draw on the right/left borders
+             $x = $width/2-$outside_pixels;
+             $y = $m*($width/2-$outside_pixels);
+             $x_start = ($width>$height)
+                     ?($inside_pixels)
+                     :($inside_pixels*$width/$height);
+             $y_start = ($width>$height)
+                     ?($m*$inside_pixels)
+                     :($m*$inside_pixels*$width/$height);
+           }
+        else
+          { # draw on the top/bottom borders
+             my $y = $height/2-$outside_pixels;
+             my $x = ($height/2-$outside_pixels)/$m;
+             $y_start = ($width>$height)
+                     ?($inside_pixels*$height/$width)
+                     :($inside_pixels);
+             $x_start = ($width>$height)
+                     ?($inside_pixels*$height/$width/$m)
+                     :($inside_pixels/$m);
+          }
+       # the method of finding points by lines like above makes picking right
+       # values kinda icky, as shown by these if statements.
+       if ((find_in_2pi($angle) <= PI/2) ||
+           (find_in_2pi($angle) > 3*PI/2))
+         {
+             $x = -abs($x);
+             $x_start = -abs($x_start);
+         }
+       else
+         {
+             $x = abs($x);
+             $x_start = abs($x_start);
+         }
+
+       if (find_in_2pi($angle) > PI)
+         {
+           $y = -abs($y);
+           $y_start = -abs($y_start);
+         }
+       else
+         {
+           $y = abs($y);
+           $y_start = abs($y_start);
+         }
+       # do translations to center stuff
+       $x = $x + $center_x;
+       $y = $y + $center_y;
+       $x_start = $x_start + $center_x;
+       $y_start = $y_start + $center_y;
+       if ($fade_dir == 1)
+         {
+           $drawable->paintbrush_default(4, [$x, $y, $x_start, $y_start]);
+         }
+       else
+         {
+           $drawable->paintbrush_default(4, [$x_start, $y_start, $x, $y]);
+         }
+       $progress += $progress_increment;
+       Gimp->progress_update($progress);
+      }
+  }
+$image->undo_group_end;
+();
 };
 
 exit main;
diff --git a/examples/centerguide b/examples/centerguide
index 54a1baf..97821b6 100755
--- a/examples/centerguide
+++ b/examples/centerguide
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   my $w = $image->width;
diff --git a/examples/colorhtml b/examples/colorhtml
index 5ebabb8..3a4d5d3 100755
--- a/examples/colorhtml
+++ b/examples/colorhtml
@@ -4,6 +4,8 @@ use Gimp;
 use Gimp::Fu;
 use Gimp::UI;
 use IO::All;
+use strict;
+use warnings;
 my %replace = (
   "&" => "&amp;",
   "<" => "&lt;",
diff --git a/examples/dataurl b/examples/dataurl
index 5884df2..4c62aae 100755
--- a/examples/dataurl
+++ b/examples/dataurl
@@ -6,6 +6,8 @@ use Gimp::UI;
 use MIME::Base64;
 use IO::All;
 use List::Util qw(max);
+use strict;
+use warnings;
 
 my %filetype2info = (
   0 => [
@@ -51,7 +53,7 @@ podregister {
       my $data = io($tmp)->all
        or die __"Unable to read temporary image tile $tmp: $!";
       unlink $tmp;
-      $url = "data:image/$media;base64,".(encode_base64 $data);
+      my $url = "data:image/$media;base64,".(encode_base64 $data);
       $max = max($max, length($url));
       append $fh "<td><img src=\"", $url, "\">";
       Gimp::Progress->update(($y*$w+$x*$tile_y)/($w*$h));
diff --git a/examples/ditherize b/examples/ditherize
index b828580..53fbc42 100755
--- a/examples/ditherize
+++ b/examples/ditherize
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
+use warnings;
 use Gimp;
 use Gimp::Fu;
 
diff --git a/examples/dots b/examples/dots
index 47d0b23..6ab53a5 100755
--- a/examples/dots
+++ b/examples/dots
@@ -4,6 +4,7 @@
 use Gimp;
 use Gimp::Fu;
 use strict;
+use warnings;
 
 podregister {
   my $has_noselection;
diff --git a/examples/dust b/examples/dust
index d5cf70c..c8929cb 100755
--- a/examples/dust
+++ b/examples/dust
@@ -3,6 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
+use strict;
+use warnings;
 
 # this is silly, sorry that I am too dumb to come up with niftier functions :(
 # btw, this should generate something between 1/f and 1/f� noise.
diff --git a/examples/example-extension b/examples/example-extension
index 0f21701..b9bc08e 100755
--- a/examples/example-extension
+++ b/examples/example-extension
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
+use warnings;
 use Gimp;
 #BEGIN { $Gimp::verbose = 3; }
 use Gimp::Fu;
diff --git a/examples/example-extension-no-fu b/examples/example-extension-no-fu
index 2334509..019c558 100755
--- a/examples/example-extension-no-fu
+++ b/examples/example-extension-no-fu
@@ -2,6 +2,8 @@
 
 BEGIN { $Gimp::verbose = 1; }
 use Gimp;
+use strict;
+use warnings;
 
 my $OTHER_EVENTLOOP = 0;
 
diff --git a/examples/example-fu b/examples/example-fu
index d9558c1..23ec4ac 100755
--- a/examples/example-fu
+++ b/examples/example-fu
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
+use warnings;
 use Gimp;
 use Gimp::Fu;
 
diff --git a/examples/example-net b/examples/example-net
index 31e7c54..ba3230a 100755
--- a/examples/example-net
+++ b/examples/example-net
@@ -1,6 +1,8 @@
 #!/usr/bin/perl -w
 
 use Gimp;
+use strict;
+use warnings;
 
 Gimp::on_lib {
    die "Not intended to be run from within GIMP!\n";
diff --git a/examples/example-no-fu b/examples/example-no-fu
index 4a61b7e..84a62d7 100755
--- a/examples/example-no-fu
+++ b/examples/example-no-fu
@@ -1,8 +1,8 @@
 #!/usr/bin/perl -w
 
 use Gimp;
-
-use strict 'vars';
+use strict;
+use warnings;
 
 # 2014/04/20 Ed J: bit of a stir, still same really
 # 12/5/03: <sjburges gimp org>
diff --git a/examples/exceptiontest b/examples/exceptiontest
index ba86d3e..35551a8 100755
--- a/examples/exceptiontest
+++ b/examples/exceptiontest
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 #BEGIN { $Gimp::verbose = 1; }
 
 podregister { die "I DIED\n" };
diff --git a/examples/fade-alpha b/examples/fade-alpha
index 20b34cb..36700a5 100755
--- a/examples/fade-alpha
+++ b/examples/fade-alpha
@@ -3,6 +3,7 @@
 use Gimp;
 use Gimp::Fu;
 use strict;
+use warnings;
 
 # XPM's that I removed the $ and the @'s from (they get interpreted in
 # strings, which makes for nasty problems).
diff --git a/examples/feedback b/examples/feedback
index f939d85..071e6e3 100755
--- a/examples/feedback
+++ b/examples/feedback
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   $image->undo_group_start;
diff --git a/examples/frame_filter b/examples/frame_filter
index a8e7ad7..0057d61 100755
--- a/examples/frame_filter
+++ b/examples/frame_filter
@@ -3,6 +3,7 @@
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use strict;
+use warnings;
 
 podregister {
   my @layers = $image->get_layers;
diff --git a/examples/frame_reshuffle b/examples/frame_reshuffle
index 71529c7..94dd7c8 100755
--- a/examples/frame_reshuffle
+++ b/examples/frame_reshuffle
@@ -3,6 +3,7 @@
 use Gimp;
 use Gimp::Fu;
 use strict;
+use warnings;
 
 podregister {
   $custom = "-i"            if $function == 1;
diff --git a/examples/gallery b/examples/gallery
index c3449a7..a4b13fb 100755
--- a/examples/gallery
+++ b/examples/gallery
@@ -3,6 +3,8 @@
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use Gimp::Util;
+use strict;
+use warnings;
 
 sub printHeader {
   my ($rf,$gf,$bf,$r,$g,$b, $htmlFile,$gallerytitle)= _;
diff --git a/examples/gimp-make-img-map b/examples/gimp-make-img-map
index ad6551b..298a653 100755
--- a/examples/gimp-make-img-map
+++ b/examples/gimp-make-img-map
@@ -1,5 +1,8 @@
 #!/usr/bin/perl -w
 
+use strict;
+use warnings;
+
 BEGIN {
   # Defaults
   $max_height = 64;
diff --git a/examples/glowing_steel b/examples/glowing_steel
index 4e55f0f..62bf387 100755
--- a/examples/glowing_steel
+++ b/examples/glowing_steel
@@ -4,6 +4,7 @@ use Gimp qw(:auto N_);
 use Gimp::Fu;
 use Gimp::Util;
 use strict;
+use warnings;
 
 N_"/Xtns/Render"; N_"/Xtns/Render/Logos"; # i18n workaround
 
diff --git a/examples/goldenmean b/examples/goldenmean
index 57ca79b..b9e3d01 100755
--- a/examples/goldenmean
+++ b/examples/goldenmean
@@ -2,17 +2,19 @@
 
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
-  $long = int(($short * 1.618) + 0.5);
-  $width = $short;
-  $height = $long;
+  my $long = int(($short * 1.618) + 0.5);
+  my $width = $short;
+  my $height = $long;
   if ($type == 1) {
     $width = $long;
     $height = $short;
   }
-  $img = gimp_image_new($width, $height, RGB);
-  $layer = gimp_layer_new($img, $width, $height, RGB_IMAGE, "Layer 1", 100, NORMAL_MODE);
+  my $img = gimp_image_new($width, $height, RGB);
+  my $layer = gimp_layer_new($img, $width, $height, RGB_IMAGE, "Layer 1", 100, NORMAL_MODE);
   gimp_image_insert_layer($layer, 0, -1);
   Gimp::Context->push();
   $layer->gimp_edit_fill(BACKGROUND_FILL);
diff --git a/examples/gouge b/examples/gouge
index 01fdf17..50d54b7 100755
--- a/examples/gouge
+++ b/examples/gouge
@@ -3,6 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use PDL::LiteF;
+use strict;
+use warnings;
 
 sub iterate {
    my ($drawable,$message,$kernel)= _;
diff --git a/examples/guidegrid b/examples/guidegrid
index a8f1eb6..e332c89 100755
--- a/examples/guidegrid
+++ b/examples/guidegrid
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   # Remove all existing guides (this is optional)
diff --git a/examples/guides_to_selection b/examples/guides_to_selection
index 9c6f4a6..9c37201 100755
--- a/examples/guides_to_selection
+++ b/examples/guides_to_selection
@@ -3,13 +3,15 @@
 use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
+use strict;
+use warnings;
 
 podregister {
   my($W,$H) = ($image->width, $image->height);
   Gimp::Context->push;
   Gimp::Context->set_feather($feather);
   Gimp::Context->set_feather_radius($radius, $radius);
-  $i = $image->find_next_guide(0);
+  my $i = $image->find_next_guide(0);
   while ($i) {
     my ($x,$y,$w,$h);
     $x = $image->get_guide_position($i);
diff --git a/examples/iland b/examples/iland
index 0ba5267..3c09f11 100755
--- a/examples/iland
+++ b/examples/iland
@@ -9,6 +9,8 @@
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use PDL::LiteF;
+use strict;
+use warnings;
 
 podregister {
   #gimp_tile_cache_size(20000);
diff --git a/examples/image_tile b/examples/image_tile
index 62344db..3fe4aca 100755
--- a/examples/image_tile
+++ b/examples/image_tile
@@ -4,11 +4,11 @@ use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use Fcntl qw(O_RDWR O_CREAT O_TRUNC);
 use DB_File;
-# use strict;
-# use vars qw($DO_HSV $debug);
+use strict;
+use warnings;
 
-$DO_HSV = 0;
-$debug = 0;
+my $DO_HSV = 0;
+my $debug = 0;
 
 podregister {
   my $subimages = 0;
diff --git a/examples/innerbevel b/examples/innerbevel
index ad44ad6..a042a30 100755
--- a/examples/innerbevel
+++ b/examples/innerbevel
@@ -3,6 +3,8 @@
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use Gimp::Util;
+use strict;
+use warnings;
 #$Gimp::verbose = 1;
 
 N_"/Xtns/Render"; N_"/Xtns/Render/Logos"; # i18n workaround
@@ -12,8 +14,8 @@ podregister {
   Gimp::Context->push();
   Gimp::Context->set_background($color1);
   Gimp::Context->set_foreground($color2);
-  @dims = Gimp->text_get_extents_fontname($text, $fontsize, PIXELS,$font);
-  $img = gimp_image_new($dims[0]+30, $dims[1]+10, RGB);
+  my @dims = Gimp->text_get_extents_fontname($text, $fontsize, PIXELS,$font);
+  my $img = gimp_image_new($dims[0]+30, $dims[1]+10, RGB);
 
   # none of the macro's did quite what I was looking for here.
   # i.e. create a text layer on transparent only...
@@ -22,14 +24,14 @@ podregister {
   $img->add_new_layer(0,TRANSPARENT_FILL);
   $img->text_fontname(-1, 10, 10, $text, 0, 1, $fontsize, PIXELS, $font);
   eval { Gimp::Display->new($img); }; # display the image early
-  $layer = $img->merge_visible_layers(EXPAND_AS_NECESSARY);
-  @pt1 = ($layer->width * 0.5 -1, 0);
-  @pt2 = ($layer->width * 0.5 +1, $layer->height);
+  my $layer = $img->merge_visible_layers(EXPAND_AS_NECESSARY);
+  my @pt1 = ($layer->width * 0.5 -1, 0);
+  my @pt2 = ($layer->width * 0.5 +1, $layer->height);
   # -- step 3 --
   $layer->set_lock_alpha(1);
   $layer->edit_blend(FG_BG_RGB_MODE, NORMAL_MODE, GRADIENT_LINEAR, 100, 0, REPEAT_NONE, 0, 0, 0, 3, 0.20, 
@pt1, @pt2);
   # -- step 4 --
-  $layer2 = $layer->copy(0);     # Can you override these to have a default? (would be nice)
+  my $layer2 = $layer->copy(0);     # Can you override these to have a default? (would be nice)
   $img->insert_layer($layer2, 0, 0);
   # -- step 5 --
   $layer2->set_lock_alpha(1);
diff --git a/examples/layerfuncs b/examples/layerfuncs
index 11c494f..d7d990f 100755
--- a/examples/layerfuncs
+++ b/examples/layerfuncs
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   die "Must have layer selected\n" unless $drawable->is_layer;
diff --git a/examples/map_to_gradient b/examples/map_to_gradient
index 1929357..af8f7eb 100755
--- a/examples/map_to_gradient
+++ b/examples/map_to_gradient
@@ -3,6 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use PDL::LiteF;
+use strict;
+use warnings;
 #BEGIN { $Gimp::verbose = 3; }
 
 # convert to greyscale. could be improved, but should still be fast!
diff --git a/examples/mirrorsplit b/examples/mirrorsplit
index 3228915..0d0017c 100755
--- a/examples/mirrorsplit
+++ b/examples/mirrorsplit
@@ -4,6 +4,7 @@ use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use Gimp::Util;
 use strict;
+use warnings;
 
 podregister {
   my $w = $drawable->width();
diff --git a/examples/perlotine b/examples/perlotine
index ca99565..d20c7d3 100755
--- a/examples/perlotine
+++ b/examples/perlotine
@@ -4,6 +4,8 @@ use File::Path;
 use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
+use strict;
+use warnings;
 
 #$Gimp::verbose = 1;
 
@@ -31,8 +33,8 @@ sub get_orientguides {
 sub dosel {
   my ($image, $savepath, $imgpath, $imgbasename, $extension, $l,$r,$t,$b, $i,$j) = @_;
 #    $filename =~ m/^(.*)\.[^\.]*$/ ;
-  $imgname = "$imgbasename-$i-$j.$extension";
-  $tmpimage = $image->duplicate;
+  my $imgname = "$imgbasename-$i-$j.$extension";
+  my $tmpimage = $image->duplicate;
   # print "Cropping from $l to $r, $t to $b\n";
   $tmpimage->crop($r-$l, $b-$t, $l, $t);
   # Make sure that gif and jpg are of proper type before proceeding.
@@ -51,7 +53,7 @@ sub dosel {
 # HTML Table Generation Functions
 sub html_table_start {
   my ($fn,$cellpadding,$cellspacing,$border,$capitalize_tags) = @_;
-  $str = $capitalize_tags ?
+  my $str = $capitalize_tags ?
 "<TABLE CELLSPACING=$cellspacing CELLPADDING=$cellpadding BORDER=$border>\n" :
 "<table cellspacing=$cellspacing cellpadding=$cellpadding border=$border>\n" ;
   print $fn $str;
@@ -59,13 +61,13 @@ sub html_table_start {
 
 sub html_table_row_start {
   my ($fn, $capitalize_tags) = @_;
-  $str = $capitalize_tags ? "\t<TR>\n" : "\t<tr>\n";
+  my $str = $capitalize_tags ? "\t<TR>\n" : "\t<tr>\n";
   print $fn $str;
 }
 
 sub html_table_entry {
   my ($fn, $imgname, $width, $height, $capitalize_tags) = @_;
-  $str = $capitalize_tags ?
+  my $str = $capitalize_tags ?
 "\t\t<TD><IMG ALT=\" \" SRC=\"$imgname\" WIDTH=\"$width\" HEIGHT=\"$height\"></TD>\n" :
 "\t\t<td><img alt=\" \" src=\"$imgname\" width=\"$width\" height=\"$height\"></td>\n";
   print $fn $str;
@@ -73,13 +75,13 @@ sub html_table_entry {
 
 sub html_table_row_end {
   my ($fn, $capitalize_tags) = @_;
-  $str = $capitalize_tags ? "\t</TR>\n" : "\t</tr>\n";
+  my $str = $capitalize_tags ? "\t</TR>\n" : "\t</tr>\n";
   print $fn $str;
 }
 
 sub html_table_end {
   my ($fn, $capitalize_tags) = @_;
-  $str = $capitalize_tags ? "</TABLE>\n":"</table>\n";
+  my $str = $capitalize_tags ? "</TABLE>\n":"</table>\n";
   print $fn $str;
 }
 
@@ -89,8 +91,8 @@ podregister {
   my @horz = get_orientguides($o2gp2g, &Gimp::ORIENTATION_HORIZONTAL);
   die __"Abort: no horizontal or vertical guides found.\n" unless @vert + @horz;
   Gimp->progress_init("Perl-o-Tine");
-  $progress_increment = 1/( (scalar(@horz)+1) * (scalar(@vert)+1) );
-  $progress = 0.0;
+  my $progress_increment = 1/( (scalar(@horz)+1) * (scalar(@vert)+1) );
+  my $progress = 0.0;
   # (Debugging info for the guide functions)
   # print @vert, " LEN = ", scalar(@vert), "\n";
   # print @horz, " LEN = ", scalar(@horz), "\n";
@@ -102,18 +104,18 @@ podregister {
   $imgpath = "" unless $separate;
   mkpath($savepath . $imgpath);
   open FILE, ">$savepath$htmlname" or die "Couldn't open $savepath$htmlname: $!\n";
-  $top=0;
+  my $top=0;
   html_table_start(\*FILE,0,$cellspacing,0,$capitalize_tags);
-  for ($i=0; $i<=scalar(@horz); $i++) {
-    $bot = ($i>$#horz) ? $image->height : $image->get_guide_position($horz[$i]);
+  for (my $i=0; $i<=scalar(@horz); $i++) {
+    my $bot = ($i>$#horz) ? $image->height : $image->get_guide_position($horz[$i]);
     html_table_row_start(\*FILE, $capitalize_tags);
-    $left=0;
-    for ($j=0; $j<=scalar(@vert); $j++) {
-      $right = ($j>$#vert) ? $image->width : $image->get_guide_position($vert[$j]);
+    my $left=0;
+    for (my $j=0; $j<=scalar(@vert); $j++) {
+      my $right = ($j>$#vert) ? $image->width : $image->get_guide_position($vert[$j]);
       # protect against 0 width/height guide selections
       if ($left!=$right && $top!=$bot) {
         # perform cropping, table entry
-        $imgname = dosel($image, $savepath, $imgpath, $imgbasename, $extension, $left, $right, $top, $bot, 
$i, $j);
+        my $imgname = dosel($image, $savepath, $imgpath, $imgbasename, $extension, $left, $right, $top, 
$bot, $i, $j);
         html_table_entry(\*FILE, $imgname, $right-$left, $bot-$top, $capitalize_tags);
       }
       $left = $right + $cellspacing;
diff --git a/examples/pixelmap b/examples/pixelmap
index 774eb18..8d81137 100755
--- a/examples/pixelmap
+++ b/examples/pixelmap
@@ -4,6 +4,8 @@ use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
 use PDL;
+use strict;
+use warnings;
 
 use constant PI => 4 * atan2 1,1;
 
@@ -34,7 +36,7 @@ sub pixelmap {
 
       $_expr = eval $_expr; die "$@" if $@;
 
-      $_iter = Gimp->pixel_rgns_register ($src, $_dst);
+      my $_iter = Gimp->pixel_rgns_register ($src, $_dst);
       my $_area = 0;
 
       do {
diff --git a/examples/prep4gif b/examples/prep4gif
index e8347e6..9085abd 100755
--- a/examples/prep4gif
+++ b/examples/prep4gif
@@ -2,6 +2,8 @@
 
 use Gimp qw(:auto N_ __);
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   my $out = $image->duplicate; # only work on duplicate
diff --git a/examples/randomart1 b/examples/randomart1
index 48a0338..cfe78ef 100755
--- a/examples/randomart1
+++ b/examples/randomart1
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 
 # Definiere die Konstante "pi mal zwei"
 use constant PIx2 => 8 * atan2 1,1;
diff --git a/examples/randomblends b/examples/randomblends
index 8c2082d..72b9406 100755
--- a/examples/randomblends
+++ b/examples/randomblends
@@ -3,6 +3,8 @@
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use Gimp::Util;
+use strict;
+use warnings;
 
 sub randint {
     my ($int) = @_;
@@ -12,12 +14,11 @@ sub randint {
 podregister {
     eval { $image->undo_group_start };
     Gimp::Context->push();
-    my $sel;
-    ($sel,$x1,$y1,$x2,$y2) = $image->gimp_selection_bounds;
+    my ($sel,$x1,$y1,$x2,$y2) = $image->gimp_selection_bounds;
     srand();
-    @gradientlist = gimp_gradients_get_list("");
+    my @gradientlist = gimp_gradients_get_list("");
     Gimp->progress_init("Random blends...");
-    for ($i=0; $i<$numgradients; $i++) {
+    for (my $i=0; $i<$numgradients; $i++) {
         Gimp::Context->set_gradient(@gradientlist[randint($#gradientlist)]);
        $drawable->edit_blend(CUSTOM_MODE,
                        DIFFERENCE_MODE,
diff --git a/examples/redeye b/examples/redeye
index 6094769..b439ad5 100755
--- a/examples/redeye
+++ b/examples/redeye
@@ -3,6 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use PDL::LiteF;
+use strict;
+use warnings;
 
 sub static_redeye {
   my($image, $drawable) = @_;
diff --git a/examples/repdup b/examples/repdup
index 32eacd2..2bb81b2 100755
--- a/examples/repdup
+++ b/examples/repdup
@@ -2,6 +2,8 @@
 
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   $image->undo_group_start;
@@ -10,11 +12,11 @@ podregister {
   my $h = $b[4] - $b[2];
   gimp_edit_copy($drawable);
   gimp_selection_none($image);
-  for ($i = 0; $i < $repeats; $i++) {
+  for (my $i = 0; $i < $repeats; $i++) {
     $b[1] = $b[1] + $xoffset;
     $b[2] = $b[2] + $yoffset;
     $image->select_rectangle(CHANNEL_OP_REPLACE, @b[1,2], $w, $h);
-    $bit_bucket = gimp_edit_paste($drawable, 0);
+    my $bit_bucket = gimp_edit_paste($drawable, 0);
     gimp_floating_sel_anchor($bit_bucket);
     gimp_selection_none($image);
   }
diff --git a/examples/scratches b/examples/scratches
index 66205ab..e2d3a8e 100755
--- a/examples/scratches
+++ b/examples/scratches
@@ -3,6 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
+use strict;
+use warnings;
 
 # Erzeuge ein neues "scratchlayer", d.h. eine Ebene, die graue
 # Streifen einer bestimmten Richtung enthält. Dazu wird ein
diff --git a/examples/selective_sharpen b/examples/selective_sharpen
index f3694b1..f6f626e 100755
--- a/examples/selective_sharpen
+++ b/examples/selective_sharpen
@@ -3,6 +3,8 @@
 use Gimp;
 use Gimp::Fu;
 use strict;
+use strict;
+use warnings;
 
 podregister {
   # sanity stuff
diff --git a/examples/sethspin b/examples/sethspin
index 5bd4d16..2f627a6 100755
--- a/examples/sethspin
+++ b/examples/sethspin
@@ -6,6 +6,7 @@ use Gimp::Fu;
 use Gimp::Util;
 use List::Util qw(max);
 use strict;
+use warnings;
 #$Gimp::verbose = 3;
 
 sub saw {  # a sawtooth function on PI
diff --git a/examples/stampify b/examples/stampify
index ed1c0ef..de819f3 100755
--- a/examples/stampify
+++ b/examples/stampify
@@ -2,6 +2,8 @@
 
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   $nw = int(gimp_image_width($image) + 2 * $marg + $diameter);
diff --git a/examples/stamps b/examples/stamps
index a43d1cd..0bb0767 100755
--- a/examples/stamps
+++ b/examples/stamps
@@ -2,6 +2,8 @@
 
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
+use strict;
+use warnings;
 
 N_"/Xtns/Render"; # dummy translation for i18n bugs
 
@@ -15,7 +17,7 @@ podregister {
   gimp_selection_none($img);
   my $ncircles = int(($size + $gap) / ($diameter + $gap));
   my $x = 0;
-  for ($i=0; $i<$ncircles; $i++) {
+  for (my $i=0; $i<$ncircles; $i++) {
     $img->select_ellipse( CHANNEL_OP_ADD, $x, 0, $diameter, $diameter);
     $img->select_ellipse( CHANNEL_OP_ADD, 0, $x, $diameter, $diameter);
     $x += $diameter + $gap;
diff --git a/examples/tex-to-float b/examples/tex-to-float
index f78fab9..1c3d9eb 100755
--- a/examples/tex-to-float
+++ b/examples/tex-to-float
@@ -2,6 +2,8 @@
 
 use Gimp qw(:auto N_);
 use Gimp::Fu;
+use strict;
+use warnings;
 
 my $fn_base = "/tmp/ttf$$";
 my %tmpfiles = (
diff --git a/examples/triangle b/examples/triangle
index d06fd36..adaf30b 100755
--- a/examples/triangle
+++ b/examples/triangle
@@ -2,6 +2,8 @@
 
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   $w = $image->width();
diff --git a/examples/view3d b/examples/view3d
index 30344ee..63c10e4 100755
--- a/examples/view3d
+++ b/examples/view3d
@@ -4,6 +4,8 @@ use Gimp;
 use Gimp::Fu;
 use PDL;
 use PDL::Graphics::TriD;
+use strict;
+use warnings;
 
 podregister {
     my $w = $drawable->width;
diff --git a/examples/warp-sharp b/examples/warp-sharp
index 3c66b3b..643e868 100755
--- a/examples/warp-sharp
+++ b/examples/warp-sharp
@@ -2,6 +2,8 @@
 
 use Gimp qw(:auto);
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   my $drawable_width=$drawable->width;
diff --git a/examples/webify b/examples/webify
index 60276a6..1a17159 100755
--- a/examples/webify
+++ b/examples/webify
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   $thresh /= 255;
diff --git a/examples/windify b/examples/windify
index 29611b4..709368a 100755
--- a/examples/windify
+++ b/examples/windify
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   Gimp::Context->push();
diff --git a/examples/xachlego b/examples/xachlego
index a4771ee..bc30035 100755
--- a/examples/xachlego
+++ b/examples/xachlego
@@ -2,6 +2,8 @@
 
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   my $selection_flag = 0;
@@ -14,13 +16,13 @@ podregister {
   Gimp::Context->push();
 # Now the fun begins :)
 
-  $selection = $image->selection_save;
+  my $selection = $image->selection_save;
 
 #1. Pixelize the photo
   $drawable->pixelize($blocksize);
 # 2. in a new white layer, render a grid
 #           at the same resolution as the pixelize, then blur it.
-  $gridlayer = $image->layer_new($image->width, $image->height, RGBA_IMAGE, "Grid 1", 100, 0);
+  my $gridlayer = $image->layer_new($image->width, $image->height, RGBA_IMAGE, "Grid 1", 100, 0);
   $image->insert_layer($gridlayer,0,0);
   $image->selection_all;
   gimp_edit_clear($gridlayer);
@@ -44,7 +46,7 @@ podregister {
 
 # <Xach> then create a new, clean grid, and bumpmap the pixelized layer with it
   $image->selection_all;
-  $cleangrid = $image->layer_new($image->width, $image->height,
+  my $cleangrid = $image->layer_new($image->width, $image->height,
                           RGBA_IMAGE, "Grid 2", 100, 0);
   $image->insert_layer($cleangrid,0,0);
   gimp_edit_fill($cleangrid, BACKGROUND_FILL);
diff --git a/examples/xachshadow b/examples/xachshadow
index 8340470..a64eccd 100755
--- a/examples/xachshadow
+++ b/examples/xachshadow
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   die "Must have layer selected\n" unless $drawable->is_layer;
@@ -17,20 +19,20 @@ podregister {
 $image->selection_all;
 # Now the fun begins :)
   $drawable->pixelize($blocksize);
-  $shadowlayer = $drawable->layer_copy(0);
+  my $shadowlayer = $drawable->layer_copy(0);
   $image->insert_layer($shadowlayer,0,0);
-  $checkmask = $shadowlayer->create_mask(ADD_WHITE_MASK);
+  my $checkmask = $shadowlayer->create_mask(ADD_WHITE_MASK);
   $shadowlayer->add_mask($checkmask);
   $image->checkerboard($checkmask, 0, $blocksize);
 
-  $frontlayer = $shadowlayer->layer_copy(0);
+  my $frontlayer = $shadowlayer->layer_copy(0);
   $image->insert_layer($frontlayer,0,0);
   Gimp::Context->set_background([0,0,0]);
   $shadowlayer->fill(BACKGROUND_FILL);
   $checkmask->gauss_iir(0.3*$blocksize, 1, 1);
   $checkmask->offset (1, 0, 0.2*$blocksize, 0.2*$blocksize);
 
-  $gridlayer = $image->layer_new($image->width, $image->height, RGBA_IMAGE, "Grid 1", 100, 0);
+  my $gridlayer = $image->layer_new($image->width, $image->height, RGBA_IMAGE, "Grid 1", 100, 0);
   $image->insert_layer($gridlayer,0,0);
   $image->selection_all;
   $gridlayer->edit_clear;
diff --git a/examples/xachvision b/examples/xachvision
index 85ca99e..c1579aa 100755
--- a/examples/xachvision
+++ b/examples/xachvision
@@ -2,22 +2,24 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 
 podregister {
   $image->undo_group_start;
   Gimp::Context->push();
-  $midlayer = $drawable->gimp_layer_copy(1);
+  my $midlayer = $drawable->gimp_layer_copy(1);
   $image->insert_layer($midlayer, 0, 0);
-  $toplayer = $drawable->gimp_layer_copy(1);
+  my $toplayer = $drawable->gimp_layer_copy(1);
   $image->insert_layer($toplayer, 0, 0);
   Gimp::Context->set_background($color);
   $toplayer->edit_fill(BACKGROUND_FILL);
   $toplayer->set_mode(COLOR_MODE);
   Gimp::Context->set_background([0,0,0]);
   $drawable->edit_fill(BACKGROUND_FILL);
-  $amt = $amt/255;
+  $amt /= 255;
   $midlayer->noisify(1,$amt, $amt, $amt, $amt);
-  $midmask = $midlayer->create_mask(0);
+  my $midmask = $midlayer->create_mask(0);
   $midlayer->add_mask($midmask);
   $midmask->grid(
     1,3,0,[0,0,0],255, 1,$image->height * 3,0,[0,0,0],255, 0,0,0,[0,0,0],255
diff --git a/examples/yinyang b/examples/yinyang
index 60c07b3..24cc3f7 100755
--- a/examples/yinyang
+++ b/examples/yinyang
@@ -2,6 +2,8 @@
 
 use Gimp;
 use Gimp::Fu;
+use strict;
+use warnings;
 #$Gimp::verbose = 1;
 
 my @BUCKET_ARGS = (FG_BUCKET_FILL,NORMAL_MODE,100,0,0,0,0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]