What I do in Eclipse/EPIC is change the perl executable line.
/ActivePerl/bin/perl -I/Users/apriven/Dev/Source/Actium/trunk -MActium::Eclipse
(Actium is the name of my project)
Then, whatever I want to do in Eclipse, but not when running otherwise, is done in the Actium::Eclipse module.
Here's my Actium::Eclipse module:
# Actium/Eclipse.pm
# Originally, this did nothing of any use. However, requiring that thi
+s file
# be present was a cute way of figuring out whether the requiring
# program is running under Eclipse or not.
# Add -MActium::Eclipse to Eclipse's default perl comamnd line.
# Then you can do:
# if ($Actium::Eclipse::is_under_eclipse) {
# do_something();
# }
# else {
# do_something_else;
# }
# Ta da.
# Originally, I did that so that actium.pl could ask for a command lin
+e if
# none was provided. I later moved that routine to this module. So
# Actium::Eclipse::get_command_line() gets the command line (using App
+lescript...
# slowly) from Eclipse.
package Actium::Eclipse;
use 5.010;
use warnings;
use strict;
no warnings('redefine');
# without which, Eclipse complains because it sees this module twice w
+hen
# debugging this module
our $is_under_eclipse = 1;
sub get_command_line {
my $history;
if ( -f '/tmp/UnderEclipse.history' ) {
open my $histfile, '<', '/tmp/UnderEclipse.history';
$history = readline($histfile);
chomp $history;
close $histfile;
}
else {
$history = "";
}
my $script
= qq[osascript -e 'tell application "Eclipse" to get text return
+ed of ( display dialog "$0\rCommand line:" default answer "$history"
+buttons "OK" default button "OK" with title "Command line entry" ) ']
+;
my $newargs = `$script`;
chomp $newargs;
if ( $newargs ne $history ) {
open my $histout, '>', '/tmp/UnderEclipse.history';
say $histout $newargs;
close $histout;
}
return split( ' ', $newargs );
} ## <perltidy> end sub get_command_line
1;
--
Am I the only one who still cares about RT #67694?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|