| 1 /** @page perl-howto Perl Scripting HOWTO |
1 /** @page perl-howto Perl Scripting HOWTO |
| 2 |
2 |
| 3 @section Introduction |
3 @section Introduction |
| 4 Gaim Perl Plugins are setup very similarly to their C counterparts. Most of the API calls are implemented and are divided into pacakges. There are some significant differences between the Perl and C API. Much like the C API, the best place to seek guidances is the source located in the plugins/perl/common directory. The tutorial that follows will be example based and attempt to touch on the salient features of the embedded perl interpreter. It is also important to note that some of the C API is missing in Gaim's perl API. |
4 Gaim Perl Plugins are setup very similarly to their C counterparts. Most of the API calls are implemented and are divided into pacakges. There are some significant differences between the Perl and C API. Much like the C API, the best place to seek guidances is the source located in the plugins/perl/common directory. The tutorial that follows will be example based and attempt to touch on the salient features of the embedded perl interpreter. It is also important to note that some of the C API is missing in Gaim's perl API. |
| 5 |
5 |
| 6 It is possible to get Gtk2-Perl to work with Gaim's perl API, however you must not load the module with @c use but with @require. If you are uninterested in using Gtk with your perl plugins than this still has bearing on you if you would like to use certain perl modules that are dynamically loaded. By always using @c require instead of @c use the problem is avoided. |
6 It is possible to get Gtk2-Perl to work with Gaim's perl API, however you must not load the module with @c use but with @c require. If you are uninterested in using Gtk with your perl plugins than this still has bearing on you if you would like to use certain perl modules that are dynamically loaded. By always using @c require instead of @c use the problem is avoided. |
| 7 |
7 |
| 8 @section first-script Writing your first script |
8 @section first-script Writing your first script |
| 9 |
9 |
| 10 Let us start with a simple example of a Gaim perl plugin. The following code sample is a complete plugin that can be copied and used as is. |
10 Let us start with a simple example of a Gaim perl plugin. The following code sample is a complete plugin that can be copied and used as is. |
| 11 |
11 |
| 338 @section request-api Request Dialog Box API |
338 @section request-api Request Dialog Box API |
| 339 |
339 |
| 340 The @c Gaim::Request package allows for plugins to have interactive dialog boxes without the need for creating them in Gtk creating a seperation between the user interfaace and the plugin. The portion of the Request API available to perl scripts is listed below followed by an example illustrating their use. |
340 The @c Gaim::Request package allows for plugins to have interactive dialog boxes without the need for creating them in Gtk creating a seperation between the user interfaace and the plugin. The portion of the Request API available to perl scripts is listed below followed by an example illustrating their use. |
| 341 |
341 |
| 342 These arguments are the same for each of the three request types: |
342 These arguments are the same for each of the three request types: |
| 343 @args |
|
| 344 @arg @em handle - The plugin handle. |
343 @arg @em handle - The plugin handle. |
| 345 @arg @em title - String title for the dialog. |
344 @arg @em title - String title for the dialog. |
| 346 @arg @em primary - The first sub-heading. |
345 @arg @em primary - The first sub-heading. |
| 347 @arg @em secondary - The second sub-heading. |
346 @arg @em secondary - The second sub-heading. |
| 348 @arg @em ok_text - The Text for the OK button. |
347 @arg @em ok_text - The Text for the OK button. |
| 353 @arg @em multiline - Boolean where true indicates multiple line input boxes are allowed. |
352 @arg @em multiline - Boolean where true indicates multiple line input boxes are allowed. |
| 354 @arg @em masked - Boolean indicating if the user can edit the text. |
353 @arg @em masked - Boolean indicating if the user can edit the text. |
| 355 @arg @em hint - See source for more information - can be left blank. |
354 @arg @em hint - See source for more information - can be left blank. |
| 356 @arg @em filename - String defualt file name value. |
355 @arg @em filename - String defualt file name value. |
| 357 @arg @em savedialog - Boolean where true indicates use as a save file dialog and false indicates an open file dialog. |
356 @arg @em savedialog - Boolean where true indicates use as a save file dialog and false indicates an open file dialog. |
| 358 @args |
|
| 359 |
357 |
| 360 @code |
358 @code |
| 361 # Create a simple text input box |
359 # Create a simple text input box |
| 362 Gaim::Request::input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, ok_cb, cancel_text, cancel_cb); |
360 Gaim::Request::input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, ok_cb, cancel_text, cancel_cb); |
| 363 |
361 |