Friday, August 31, 2012

Launching Documents in Wx

Whilst working on the port of C++ example code for Wx::PdfDocument I came across a simple cross-platform way to launch documents from Wx applications.

The necessary functions and methods have been supported in Wx for some time but I have not come across usage in wxPerl.


my $docpath = '/path/to/somefile.pdf';
my $docext = 'pdf';

  my $manager = Wx::MimeTypesManager->new();
  if( my $filetype = $manager ->GetFileTypeFromExtension($docext) ) {
    my $cmd = $filetype->GetOpenCommand($docpath);
  } else {
    Wx::LogError(qq(Could not find application for file type $docext));


It's simple, it works and it's one of my favourite snippets.

Citrus Perl 5.16.1 Released

Citrus Perl 5.16.1 has been released bringing the latest Perl and Wx together in a binary distribution. On Windows, Linux and Mac OSX  downloads including Wx built against both wxWidgets 2.8.12 and 2.9.4 are available.

Citrus Perl Downloads

Mac OSX Mountain Lion is now also supported.