#39 A Way to use epic with perl files without extension

Next Release

I need a way to use epic with perl files without

Is ist possible to parse the file for something like
"-*- perl-mode -*-" (that's the emacs way)


  • Jan Ploski

    Jan Ploski - 2005-09-08

    Logged In: YES

    It is currently impossible to implement this in an elegant way (or maybe at all,
    depending on what you consider an acceptable solution):

    Eclipse has a content type detection API (interface IContentDescriber and
    friends) since version 3.0. It allows a file type to be determined by reading a
    byte stream. However, when you double-click a file, Eclipse (as of today) does
    only consult IContentDescribers associated with the file's specific name or its
    extension (see Preferences/Content Types), which sort of defeats the purpose
    of the whole mechanism.

    See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=46297
    EPIC will probably have to wait until this is fixed in the platform.

  • Matisse Enzer

    Matisse Enzer - 2007-03-09

    Logged In: YES
    Originator: NO

    Here's how I do this in Perl::Metrics::Simple

    Readonly::Scalar our $PERL_FILE_SUFFIXES => qr{ \. (:? pl | pm | t ) }xmi;
    Readonly::Scalar my $PERL_SHEBANG_REGEX => qr/ \A [#] ! .* perl /xm;
    Readonly::Scalar my $DOT_FILE_REGEX => qr/ \A [.] /xm;

    sub is_perl_file {
    my ( $self, $path ) = @_;
    return if ( !-f $path );
    my ( $name, $path_part, $suffix ) =
    File::Basename::fileparse( $path, $PERL_FILE_SUFFIXES );
    return if $name =~ $DOT_FILE_REGEX;
    if ( length $suffix ) {
    return 1;
    return _has_perl_shebang($path);

    sub _has_perl_shebang {
    my $path = shift;

    open my $fh, '<', $path;
    if ( !-r $fh ) {
    cluck "Could not open '$path' for reading: $OS_ERROR";
    my $first_line = <$fh>;
    close $fh;
    return if ( !$first_line );
    return $first_line =~ $PERL_SHEBANG_REGEX;

  • Jan Ploski

    Jan Ploski - 2007-03-09

    Logged In: YES
    Originator: NO

    Matisse, the real problem is not how to determine the file content type, but to make Eclipse actually use such information when you open a file. The algorithm which determines the editor type (implemented in the workbench plugin outside of EPIC) is currently too unflexible for that.

  • Kevin Colby

    Kevin Colby - 2010-06-29

    Has any progress been made on this? It's been five YEARS! It's surprising to me to still find such a basic problem persists in recent versions. Am I not looking in the right place?

  • Nobody/Anonymous

    Manual workaround:
    Rename the file and add .pl at the end
    Open the file (opens in EPIC's Perl editor)
    Make some change, then save and close the file
    Rename back (remove .pl)
    Open again. EPIC still thinks it's a Perl file.

  • Oliver Trosien

    Oliver Trosien - 2016-05-15
    • status: open --> wont-fix
    • Group: --> Next Release

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks