explorer feature for a perl editor?

S

s_p_a_m_mob

Hi there,

I am looking for a perl editor which has an explorer feature (like a
document with style in OpenOffice) to rearrange a perl package. Such an
editor should parse the source text and show the perl structure (sub)
and pod structure (=head1, =head2, etc.) and enable the user to
rearrange graphically the structure.

If such an editor doesn't exist (apart from VisiPerl, not tested) I am
thinking of using OpenOffice.

Best regards,

Marc-Olivier BERNARD
 
H

Hendrik Maryns

(e-mail address removed) schreef:
Hi there,

I am looking for a perl editor which has an explorer feature (like a
document with style in OpenOffice) to rearrange a perl package. Such an
editor should parse the source text and show the perl structure (sub)
and pod structure (=head1, =head2, etc.) and enable the user to
rearrange graphically the structure.

If such an editor doesn't exist (apart from VisiPerl, not tested) I am
thinking of using OpenOffice.

I'm not sure wether I understand exactly what you want, but eclipse with
the EPIC extension for Perl, does something that sounds like this... It
does syntax-highlighting and checking too.
It is rather heavy and because of that tends to be a bit slow, though.

Hendrik
 
S

s_p_a_m_mob

The aim is to rearrange graphically a perl module, to move down a
method, move up some pod, etc.

My solution is to add structure to the perl/pod code with html and use
the navigator feature of OpenOffice to graphically move the blocks.

1. add structure to perl/pod code, with following script (perl2html.pl)

---

#!/usr/bin/perl -w


use strict;
use IO::File;
use HTML::Entities;


$ARGV[0] or die qq(Usage: $0 Module.pm > /tmp/Module.html
Then:
~/OpenOffice.org1.1.0/soffice /tmp/Module.html &
rearrange with OO explorer, save as txt file /tmp/Module.txt
perl -pi -e "s/# space//gc" /tmp/Module.txt
cp /tmp/Module.txt /tmp/Module,2.pm
);


my $fh = IO::File->new();
$fh->open("< ".$ARGV[0]) or die "$!";


my $content="";
my $line;


while ($line = <$fh>){


# escape entities
$line = encode_entities($line);


my $tmp;
my $elemName;


if($line =~ m/^(=head(\d) \w.*?)$/ or $line =~ m/^(=cut.*?)$/ or
$line =~ m/^(sub .*?)$/){


$tmp = $1;
$elemName = $2 ? "h$2" : "h1";
# suppress \n
$tmp =~ s/\n$//;


# add structure for =head1, =head2, etc
$line = qq(<$elemName>$tmp</$elemName>);


}elsif($line =~ m/^[\t ]*\n$/){
# avoid n blank lines -> n-1 blank lines with OO html->txt
$line = "# space<br>";
}else{
$line =~ s/\n$//;
$line ="<pre>".$line."</pre>";
}


# add \n
$content = $content.$line."\n";
}

# add html and
body markup
$content = qq(<html><body>).$content.qq(</body></html>);
print $content;

---

Output to Module.html

2. Open the resulting html file with OpenOffice, and its navigator
feature

(Edit > Navigator)

3. Save as txt file (Module.txt)

4. perl -pi -e "s/# space//gc" Module.txt

It's done.

Marc-Olivier BERNARD

Hendrik said:
I'm not sure wether I understand exactly what you want, but eclipse with
the EPIC extension for Perl, does something that sounds like this... It
does syntax-highlighting and checking too.
That tool seems pretty complicate...
 
M

Michele Dondi

The aim is to rearrange graphically a perl module, to move down a
method, move up some pod, etc.

My solution is to add structure to the perl/pod code with html and use
the navigator feature of OpenOffice to graphically move the blocks.

Ouch! Why not using a Real Editor(TM) instead? It is enough that it
supports folding...


Michele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top