Myapp.pm #!/usr/bin/perl -w use strict; # load wxPerl main module use Wx; # every application must create an application object package MyApp; use base qw(Wx::Frame Class::Accessor::Fast); use Wx qw(:textctrl :sizer :window :id); use Wx qw(wxDefaultPosition wxDefaultSize wxTheClipboard wxDEFAULT_FRAME_STYLE wxNO_FULL_REPAINT_ON_RESIZE wxCLIP_CHILDREN); use Wx::Event qw(EVT_TREE_SEL_CHANGED EVT_MENU EVT_CLOSE); use File::Slurp; use File::Basename qw(); use File::Spec; use UNIVERSAL::require; sub new{ my( $class ) = @_; my $self = $class->SUPER::new ( undef, -1, 'wxPerl demo', wxDefaultPosition, [ 800, 600 ], wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN ); Wx::InitAllImageHandlers(); my $bar = Wx::MenuBar->new; my $file = Wx::Menu->new; my $help = Wx::Menu->new; my $edit = Wx::Menu->new; $file->Append( wxID_EXIT, '' ); $help->Append( wxID_ABOUT, '' ); $edit->Append( wxID_COPY, '' ); $edit->Append( wxID_FIND, '' ); my $find_again = $edit->Append( -1, "Find Again\tF3" ); $bar->Append( $file, "&File" ); $bar->Append( $edit, "&Edit" ); $bar->Append( $help, "&Help" ); $self->SetMenuBar( $bar ); $self->{menu_count} = $self->GetMenuBar->GetMenuCount; $self->SetIcon( Wx::GetWxPerlIcon() ); $self->Show; } 1; ui.pl #!perl -w use MyApp; use Getopt::Long; GetOptions( 'show=s' => \( my $module ), 'help' => \( my $help ), 'list' => \( my $list ), ) or usage(); usage() if $help; my $app = Wx::SimpleApp->new; my $locale = Wx::Locale->new( Wx::Locale::GetSystemLanguage ); my $ui = MyApp->new; $ui->activate_module( $module ) if $module; if ($list) { print join "\n", sort map $_->title, grep $_->can( 'title' ), $ui->plugins; exit 0; } $app->MainLoop; exit 0;