| 1 | package Padre::Plugin::RunPerlExternal; | ||
| 2 | |||
| 3 | use 5.008; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | use utf8; | ||
| 7 | use Padre::Constant (); | ||
| 8 | use Padre::Plugin (); | ||
| 9 | use Padre::Wx (); | ||
| 10 | |||
| 11 | our $VERSION = '0.54'; | ||
| 12 | our @ISA = 'Padre::Plugin'; | ||
| 13 | |||
| 14 | #description: used by padre for compat. check | ||
| 15 | #todo: syncronize | ||
| 16 | sub padre_interfaces { | ||
| 17 | return ( | ||
| 18 | 'Padre::Plugin' => 0.66, | ||
| 19 | 'Padre::Constant' => 0.66, | ||
| 20 | ); | ||
| 21 | } | ||
| 22 | |||
| 23 | #description: name shown in menue and pluginmanager | ||
| 24 | #todo: find better name | ||
| 25 | sub plugin_name { | ||
| 26 | 'RunPerlExternal'; | ||
| 27 | } | ||
| 28 | |||
| 29 | #description: menue entry | ||
| 30 | #todo: none | ||
| 31 | sub menu_plugins_simple { | ||
| 32 | my $self = shift; | ||
| 33 | return $self->plugin_name => [ | ||
| 34 | "Run Perl in external Window\tF6" => sub { $self->in_term }, | ||
| 35 | ]; | ||
| 36 | } | ||
| 37 | |||
| 38 | |||
| 39 | #description: changes the config, runs the document and set the config back | ||
| 40 | #todo: run_document external without changing the config | ||
| 41 | sub in_term { | ||
| 42 | my $self = shift; | ||
| 43 | my $config = Padre::Current->main->config; | ||
| 44 | my $orig = $config->run_use_external_window; | ||
| 45 | $config->set( "run_use_external_window", 1 ); | ||
| 46 | Padre::Current->main->run_document; | ||
| 47 | $config->set( "run_use_external_window", $orig ); | ||
| 48 | return; | ||
| 49 | } | ||
| 50 | |||
| 51 | 1; | ||
| 52 | __DATA__ |