RSS/Atom feed Twitter
Site is read-only, email is disabled

Gimp Arrays in Perl

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

How do I test my perl scripts? Kenny Law 02 Jun 13:20
  How do I test my perl scripts? Marc) (A.) (Lehmann 02 Jun 17:07
   Gimp Arrays in Perl Kenny Law 02 Jun 23:19
    Gimp Arrays in Perl Shlomi Fish 03 Jun 09:54
     Gimp Arrays in Perl Marc) (A.) (Lehmann 03 Jun 15:10
Kenny Law
2003-06-02 13:20:39 UTC (almost 21 years ago)

How do I test my perl scripts?

Hi,
I have a question on how to test my perl scripts.

I am now using Gimp 1.2.3 by the way.

So I wrote a script and I called it whatever.pl

I made it executable by

chmod a+x whatever.pl

Then I try to run it by entering Gimp, and starting the Perl Server by going to Xtns->Perl->Server

Nothing seems to come up at all, so I went ahead and typed ./whatever.pl

Thing is, I did not save the pl file to the usr/lib/gimp/1.2/plug-ins directory.

Is that gonna affect anything?

Can someone tell me an easy way to test my scripts without registering a script? Or do I need to register it because my script deals directly on an image?

Kenny

Marc) (A.) (Lehmann
2003-06-02 17:07:30 UTC (almost 21 years ago)

How do I test my perl scripts?

On Mon, Jun 02, 2003 at 07:20:39PM +0800, Kenny Law wrote:

Then I try to run it by entering Gimp, and starting the Perl Server by going to Xtns->Perl->Server

Nothing seems to come up at all, so I went ahead and typed ./whatever.pl

the perl server only outputs some text on the console (or whatever is connected to the stdout of your gimp process). not seeing anything is, therefore, not a bad sign ;)

Thing is, I did not save the pl file to the usr/lib/gimp/1.2/plug-ins directory.

that's ok.

Is that gonna affect anything?

Not that I'd know.

Can someone tell me an easy way to test my scripts without registering a script? Or do I need to register it because my script deals directly on an image?

If you want your script to show up in the menus, yes, you need to copy it to a plug-ins directory.

If you just start it, it should open a dialog. If it is an -type plug-in it should enable you to select the image and layer to work on (but that is not heavily tested).

I assume nothing like this happens in your case?

Kenny Law
2003-06-02 23:19:11 UTC (almost 21 years ago)

Gimp Arrays in Perl

First of all, just wanna thank you guys especially Chris, Branko, Marc and Dov for answering some of my questions the past 2 days. Your help is greatly appreciated.

Anyway, my question regards the gimp_pencil tool. One of its parameters is an array of floats. I tried to pass in this by doing

//just imagine all variables contain integers #1.

@positions = (0, $startPos, $width, $startPos); gimp_pencil($layer, 4, @positions );

#2.

gimp_pencil($layer, 4, (0, $startPos, $width, $startPos) );

Everytime I try to run this script, Gimp pops me a message and says:

perl-arrayref required as datatype for a gimp array at blahdirectory then line number (ERROR)

Anyone knows how do I fix this?

Thanks all!

Kenny

Shlomi Fish
2003-06-03 09:54:25 UTC (almost 21 years ago)

Gimp Arrays in Perl

On Tue, 3 Jun 2003, Kenny Law wrote:

First of all, just wanna thank you guys especially Chris, Branko, Marc and Dov for answering some of my questions the past 2 days. Your help is greatly appreciated.

Anyway, my question regards the gimp_pencil tool. One of its parameters is an array of floats. I tried to pass in this by doing

//just imagine all variables contain integers #1.

@positions = (0, $startPos, $width, $startPos); gimp_pencil($layer, 4, @positions );

That should be:

gimp_pencil($layer, 4, \@positions);

#2.

gimp_pencil($layer, 4, (0, $startPos, $width, $startPos) );

That should be:

gimp_pencil($layer, 4, [0, $startPos, $width, $startPos]);

You need to pass a reference to an array. In both cases you passed the array itself as multiple arguments to the functions. For more information consult "perldoc perlref".

Regards,

Shlomi Fish

---------------------------------------------------------------------- Shlomi Fish shlomif@vipe.technion.ac.il Home Page: http://t2.technion.ac.il/~shlomif/

An apple a day will keep a doctor away. Two apples a day will keep two doctors away.

Falk Fish

Marc) (A.) (Lehmann
2003-06-03 15:10:07 UTC (almost 21 years ago)

Gimp Arrays in Perl

On Tue, Jun 03, 2003 at 10:54:25AM +0300, Shlomi Fish wrote:

gimp_pencil($layer, 4, @positions );

gimp_pencil($layer, 4, \@positions);

To add, arrays are always passed _into_ the gimp as references [...]. Functions returning a single array return a list, e.g.

my @images = Gimp->list_images; # or so, foggy

And functions returning an array and something else return an arrayref. There is no general rule, but if you do this:

Gimp::set_trace(-1);

(you can pass in flags like TRACE_CALL etc.. instead of -1, see perldoc Gimp), you will see what, exactly, will be passed to the pdb function. That's very handy when debugging scripts.