Changeset 492
- Timestamp:
- 10/26/08 07:27:47 (3 years ago)
- Location:
- plugins/par
- Files:
-
- 2 edited
-
Changes (modified) (1 diff)
-
lib/Padre/Plugin/PAR.pm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/par/Changes
r67 r492 1 v0.03 2008.10.26 2 3 Follow the API changes of Padre 0.12_01 4 1 5 v0.02 2008.08.17 2 6 -
plugins/par/lib/Padre/Plugin/PAR.pm
r180 r492 7 7 use File::Temp (); 8 8 9 our $VERSION = '0.0 2';9 our $VERSION = '0.03'; 10 10 11 11 =head1 NAME … … 16 16 17 17 This is an experimental version of the plugin using the experimental 18 plugin interface of Padre 0. 0618 plugin interface of Padre 0.12_01 19 19 20 20 After installation there should be a menu item Padre - PAR - Stand Alone … … 36 36 37 37 sub on_stand_alone { 38 my ($ mw, $event) = @_;38 my ($self, $event) = @_; 39 39 40 40 #print "Stand alone called\n"; 41 41 # get name of the current file, if it is a pl file create the corresponding .exe 42 42 43 my $filename = $mw->get_current_filename; 43 my $doc = $self->selected_document; 44 45 my $filename = $doc->filename; 44 46 my $tmpfh; 45 47 my $cleanup = sub { unlink $filename if $tmpfh }; … … 48 50 49 51 if (not $filename) { 50 ($filename, $tmpfh) = _to_temp_file($ mw);52 ($filename, $tmpfh) = _to_temp_file($doc); 51 53 } 52 54 53 55 if ($filename !~ /\.pl$/i) { 54 Wx::MessageBox( "Currently we only support exe generation from .pl files", "Cannot create", wxOK|wxCENTRE, $ mw);56 Wx::MessageBox( "Currently we only support exe generation from .pl files", "Cannot create", wxOK|wxCENTRE, $self ); 55 57 return; 56 58 } … … 58 60 my $ret = system("pp", $filename, "-o", $out); 59 61 if ($ret) { 60 Wx::MessageBox( "Error generating '$out': $!", "Failed", wxOK|wxCENTRE, $ mw);62 Wx::MessageBox( "Error generating '$out': $!", "Failed", wxOK|wxCENTRE, $self ); 61 63 } else { 62 Wx::MessageBox( "$out generated", "Done", wxOK|wxCENTRE, $ mw);64 Wx::MessageBox( "$out generated", "Done", wxOK|wxCENTRE, $self ); 63 65 } 64 66 … … 71 73 72 74 sub _to_temp_file { 73 my $ mw= shift;75 my $doc = shift; 74 76 75 my $id = $mw->{notebook}->GetSelection; 76 my $page = $mw->{notebook}->GetPage($id); 77 my $code = $page->GetTextRange(0, $page->GetLength()); 78 77 my $text = $doc->text_get(); 78 79 79 my ($fh, $tempfile) = File::Temp::tempfile( 80 80 "padre_standalone_XXXXXX", … … 84 84 ); 85 85 local $| = 1; 86 warn $code; 87 print $fh $code; 86 print $fh $text; 88 87 return($tempfile, $fh); 89 88 }
Note: See TracChangeset
for help on using the changeset viewer.
