The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tcl::pTk::TkHijack - Run Existing Perl/tk Scripts with Tcl::pTk

SYNOPSIS

        # Run a existing perl/tk script 'tkscript.pl' with Tcl::pTk
        perl -MTcl::pTk::TkHijack tkscript.pl
        
        # Alternatively, you can just put 'use Tcl::pTk::TkHijack' at the
        #  top of the 'tkscript.pl' file and just run it like normal

DESCRIPTION

Tcl::pTk::TkHijack is an experimental module that makes existing perl/tk use Tcl::pTk to run. It 'Hijacks' any 'use Tk' and related calls in a perl/tk script to use Tcl::pTk.

How It Works

A sub ref (tkHijack) is pushed onto perl's global @INC array. This sub intercepts any 'use Tk' or related calls and substitutes them with their Tcl::pTk equivalents. Additionally, some package aliases are setup between the Tk and the Tcl::pTk namespace

Examples

There are some examples of using TkHijack with a simple perl/tk script, and a perl/tk mega-widget. See t/tkHijack_simple.t and t/tkHijack_mega.t in the source distribution.

LIMITATIONS

  • XEvent calls are not translated, because there is no equivalent in Tcl::pTk (XEvent was a perl/tk specific addition to Tk, and doesn't exists in Tcl/Tk)

  • Perl/Tk widgets that use XS code can't be handled with this package.