Main Site Contents Up Previous Next

Using wxGlade

If you are using wxGlade to create the basis of your wxPerl application, there are a couple of issues you should be aware of.

wxGlade will start your script with a line something line the following:

use Wx 0.15 qw[:allclasses];

This will cause Wx to load all of its modules on startup. Cava Packager will recognise the above statement in your code during scanning and include all of the Wx modules in your packaged script.

If you don't wish to include all modules, simply remove the qw[:allclasses] statement from the above line in your code. You will then have to explicitly 'use' the modules you require.

wxGlade will also produce MainLoop code that looks something like:

package main;

unless(caller){
    my $app = MyApp->new();
    $app->MainLoop();
}

When run within Cava Packager, caller will return values in your main script, so you can either change the code to:

package main;

my $app = MyApp->new();
$app->MainLoop();

or, if the caller check is important to you when run as a perl script, you can change to the following:

package main;
use Cava::Packager;

unless(caller && !Cava::Packager::Packaged()){
    my $app = MyApp->new();
    $app->MainLoop();
}

Your script should then run as expected in both environments.




Contents Up Previous Next


Cava Packager Copyright © 2006-2012 Mark Dootson