in reply to How do I run a perl script with an alternate perl.exe from Padre?

How can I accomplish this?

Type Alt+Tools+Preferences

Select Language - Perl 5 and add a path to the perl executable of your choice

Alternatively, you would create a Padre::Plugin::Shebang plugin which would override this setting automagically (if plugin enabled and shebang found, use that perl, otherwise fall back to default)

  • Comment on Re: How do I run a perl script with an alternate perl.exe from Padre?

Replies are listed 'Best First'.
Re^2: How do I run a perl script with an alternate perl.exe from Padre?
by Je55eah (Novice) on Jun 04, 2012 at 06:49 UTC

    Thanks, I thought that had something to do with the beginner mode mentioned just above it, but you were correct. I have since wrapped my bat file into an exe with this ( http://www.f2ko.de/programs.php?lang=en&pid=b2e ) converter. Nonetheless, I am getting an error about the executable seems to be no executable Perl interpreter, and the system default ( real strawberry Perl ) is being used instead. Any ideas on how I can resolve this? Would it be difficult to add an alternate run button to Padre for my Perl to Text scripts?

    Here is the current version of the Powershell script

    # perltxt.a4.ps1 Param( $perl_script_name = $NULL, $document_target_directory = [String]::join('', ($HOME, '\Desktop\ +PerlTxt Documents')) ) if($perl_script_name -ne $NULL){ $file_name_array = [System.IO.Path]::GetFileName($perl_script_name +).split('.') $file_location = [System.IO.Path]::GetDirectoryName($perl_script_ +name) if( (test-path $perl_script_name -PathType leaf) -and ($file_name_array[-1] -eq 'pl') ){ if ($file_name_array.length -gt 2){ $file_name = [String]::join('.', $file_name_array[0..($fil +e_name_array.length - 2)]) } else { $file_name = $file_name_array[0] } $time = Get-Date -Format 'yyyy-MM-dd-hh-mm-ss' #$time = 'time' $new_file_location = [String]::join('', ([IO.Path]::GetFullPa +th($document_target_directory), '\', $file_name)) $new_script_name = [String]::join('', ($new_file_location, '\ +', $file_name, '.', $time, '.pl')) $new_document_name = [String]::join('', ($new_file_location, +'\', $file_name, '.', $time, '.txt')) $out = & perl $perl_script_name 2>&1 } } else{ $out = [String]::join([Environment]::NewLine, ( 'No valid .pl (Perl) script specified', '', 'Perl to Text ( perltxt.exe )', '', 'is a hackish and slow tool to run Perl ( .pl ) scripts th +at are passed to it as an argument,', ' save the scripts and the output to timestamped text f +iles in a directory specified as the second argument', ' ( $HOME\Desktop\PerlTxt Documents\[Script name] i +s the default ),', ' and load the output onto the Windows clipboard.', '', + ' A sound is played when the script has finished and th +e clipboard is ready.', '', 'Use:> perltxt [path to your_perl.pl script] [optional pat +h to the target directory for the output files]', '', 'Direct comments and suggestions to horstman.jesse@yahoo.c +om')) } if($out -is [System.Management.Automation.ErrorRecord]) { # email or some other action here #Send-MailMessage -to me@example.com -subject "Error in gpg " -bod +y "Error:`n$out" -from error@example.com -smtpserver smtp.example.com } # Load System.Windows.Forms assembly. $null = [Reflection.Assembly]::LoadWithPartialName("System.Windows.For +ms") # Create a data object. $dataObject = New-Object windows.forms.dataobject # Add generated strings to the data object. $text = $out $dataObject.SetData([Windows.Forms.DataFormats]::UnicodeText, $true, $ +text) # Place the data object in the system clipboard. [Windows.Forms.Clipboard]::SetDataObject($dataObject, $true) $document = $dataObject.GetData([Windows.Forms.DataFormats]::UnicodeTe +xt) if($perl_script_name -ne $NULL){ # if((test-path $document_target_directory -isvalid) -and !(test-pa +th $document_target_directory -pathtype container)){ # new-item $document_target_directory -type directory # } if((test-path $new_file_location -isvalid) -and !(test-path $new_F +ile_location -pathtype container)){ new-item $new_file_location -type directory | Out-Null } #echo "PerlTxt has generated new files in $new_file_location" If(-not(Test-Path -path $new_script_name)) { Copy-Item $perl_script_name $new_script_name } else{ Remove-Item $new_script_name Copy-Item $perl_script_name $new_script_name } If(-not(Test-Path -path $new_document_name)) { New-Item -Path $new_document_name -ItemType file -Value $($doc +ument) -force | Out-Null } else{ $stream = [System.IO.StreamWriter] $new_document_name $stream.Write($document) $stream.close() } } cls echo $document [System.Media.SystemSounds]::Asterisk.Play(); exit

    Here is the current version of the batch file that is used to invoke Powershell

    REM perltxt.a4.cmd REM horstman.jesse@yahoo.com @echo off powershell.exe -sta .\perltxt.a4.ps1 %*

      From padre type Alt + Tools + Plug-in Tools + Edit My Plug-in

      Then edit My.pm to add

      sub menu_plugins_simple { my $self = shift; return $self->plugin_name => [ 'About' => sub { $self->show_about }, # Padre::Wx::Main=HASH(0x2e189cc) Wx::CommandEvent=SCALAR(0x3d3ed2c) 'Run echo.bat $filename'."\tCtrl-Alt-F5" => \&run_echo, ]; } sub run_echo { my $self = shift; my $main = eval { $self->main } || $self; my $document = $self->current->document; warn "document : $document\n"; my $filename = $document->filename || $document->tempfile; warn "filename : $filename\n"; local $ENV{PADRE_FILENAME} = $filename if defined $filename; $main->run_command(qq{C:/full/path/to/perl.EXE C:/full/path/to/e +cho.pl "$filename"}); }

      After you enable this plugin ( Tools + Plug-in Manager ) type Ctrl-Alt-F5 and watch the Output pane with amazement.

        Thank you. Although I havn't made time to test this properly, I appreciate the work that you have done here.

      Any ideas on how I can resolve this?

      Not without an actual problem description

      Would it be difficult to add an alternate run button to Padre for my Perl to Text scripts?

      I don't think so, but then I've skimmed the docs I linked for you to read, and I'm familiar with Wx