15.2. Location of Files

When you create your own composite widgets, you create a file that has the same name (including capitalization) of your widget and has a .pm suffix. For instance, if you wanted to create a new composite widget called ListButton, you would place the code for it in a file called ListButton.pm.

In the code that uses your new widget, include use ListButton after the use Tkat the top of your code, assuming you keep your composite widget files (such as ListButton.pm) in the same directory as the rest of your application code. If not, before any use or require statements, add:

use lib ("dir1", "dir2");

pointing to whatever directory you're using for ListButton.pm.

Get Learning Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.