| Store | Cart

ActiveState Docs

PDK 9.1 Documentation

Loading...

PerlTray - Overview

What is PerlTray?

The PerlTray utility converts a Perl program to a native Windows system tray application. It runs as an icon in the system tray and responds to external events. It displays a tooltip when the mouse pointer hovers over the icon and displays a popup menu when the user clicks the icon. PerlTray features tray icon animation, timer callbacks and asynchronous file download and application execution.

PerlTray provides a generic Windows system tray application. Your program needs to supply callbacks to tell PerlTray how to respond to certain events, like displaying a tooltip or popup menu.

A minimal PerlTray application "uses" the PerlTray module to import the PerlTray API and provides a PopupMenu() callback:

  use PerlTray;
  sub PopupMenu {
      return [["ActiveState", "Execute 'http://www.ActiveState.com'"],
        ["Exit", "exit"],
       ];
  }

PerlTray function and callback names all start with an uppercase letter. To prevent name collisions in future releases of PerlTray, it is recommended that all application function names start with a lowercase letter. Every PerlTray application should provide a user interface to terminate the program. Otherwise it will be impossible to remove the application from the system tray.

Please refer to the "Sample Programs" page for more complex PerlTray examples.