#!/usr/bin/perl -w

use strict;
use Gimp qw(:auto __ N_);
use Gimp::Extension;

#$Gimp::verbose = 1;
my $persist;

register_temp
  'extension_test_temp',
  "Demo Gimp-Perl temp proc", "Demo a Gimp-Perl extension's temp proc",
  undef, '',
  [
    # must take this parameter first, can take others
    [ &Gimp::PDB_INT32, 'run_mode', 'Run-mode', 0 ],
    [ &Gimp::PDB_INT32, 'number', 'Input number', 0 ],
  ],
  [ [ &Gimp::PDB_INT32, 'retval', 'Retval', ], ], sub {
    my ($run_mode, $num) = @_;
    # here could bring up UI if $run_mode == RUN_INTERACTIVE
    $persist += $num;
    $persist;
  };

podregister { $persist = $_[1]; Gtk2->main; };

exit main;
__END__

=head1 NAME

extension_test - test Gimp::Extension

=head1 SYNOPSIS

<Image>/Filters/Languages/_Perl/Test _Extension

=head1 DESCRIPTION

Installs a temporary procedure, C<extension_test_temp>. This takes args
of C<$run_mode, $number>, adds the number to the extension's persistent
data number, and returns its new value.

The extension itself's C<num> parameter is the initial value of the
persistent storage number, if given. The number does not persist across
runs of GIMP.

See L<examples/example-extension-tester> for a small L<Gimp::Fu> plugin
that exercises this extension.

=head1 PARAMETERS

 [&Gimp::PDB_INT32, "run_mode", "Interactive:0=yes,1=no"],
 [&Gimp::PDB_INT32, "num", "Initial number value"],

=head1 RETURN VALUES

 [&Gimp::PDB_INT32, "retnum", "Number returned"],

=head1 AUTHOR

Ed J

=head1 DATE

2014-05-03

=head1 LICENSE

Same terms as Gimp-Perl.
