in reply to Re^2: IDE for Perl programming?
in thread IDE for Perl programming?

Yes cperl's syntax parsing is great, I use it for auto-indentation and formatting, which happens far faster than shelling out to perltidy.

Though (tangential!) it's giving me a hardtime ATM, because I have y_max somewhere in my code/comments/pod and it thinks it's an unfinished tr with _ as delimiter.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

update

Added (cperl-mode) to title and considered to reparent this sub-thread into an own one

EDIT: please own thread possible, quite a drift ?

Replies are listed 'Best First'.
Re^4: IDE for Perl programming?
by choroba (Cardinal) on Mar 12, 2021 at 13:30 UTC
    > I have y_max somewhere in my code/comments/pod and it thinks it's an unfinished tr with _ as delimiter.

    Confirmed, even this is wrong:

    sub y_max { 1 }

    Send a patch or report to the maintainers.

    Update: Done.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      I think you meant mailing to bug-gnu-emacs@gnu.org ?

      I doubt the general emacs staff can handle this, this should be done by the cperl maintainers, which leads to an interesting question....

      Which and who's cperl-version is bundled with emacs?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        > I think you meant mailing to bug-gnu-emacs@gnu.org ?

        Yes, link fixed, thanks.

        > this should be done by the cperl maintainers

        That's OK, check the bug tracker. Mention "cperl" in the subject of the e-mail as I did.

        > Which and who's cperl-version is bundled with emacs?

        You can git clone the Emacs repo and see. All the changes from jrockway's repo have been incorporated there, plus some more. That's the official place. Hasn't it been mentioned here already by haj? Or has it been just in his clone of the repo?

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

        Right now, the Emacs maintainers are also the CPerl maintainers (as can be seen in the file's header). So this is just "the Emacs version" of CPerl mode. The maintainers occasionally merge stuff from elsewhere (as they did with Jonathan Rockway's work). Only since my announcement here I started to make "Perl specific" contributions to this repository, but the adaptions to new features of Emacs is always done by people with better Elisp knowledge.

Re^4: IDE for Perl programming?
by haj (Vicar) on Mar 12, 2021 at 14:47 UTC
    This particular bug should be already fixed in the Emacs repository, available as cperl-mode.el. However, it is only backported to Emacs versions 26.1 and above.
      Are you sure? I'm on emacs 27.1 with cperl-mode symlinked from the latest git version, but still see
      sub y_max { 1 }
      highlighted as a transliteration.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

        Maybe I need to clarify: My fixes have not been backported to Emacs 27.1.

        Instead, cperl-mode.el from the master branch (which identifies as Emacs 28.1) contains some "compatibility functions" so that it works with Emacs 26.1. If in doubt, say C-h v cperl-version: It should notify that the variable is obsolete since 28.1.

        Edited to add:

        This is indeed a bug, and an old one, too. I didn't "see" it because it depends on the a somewhat random order how two functions are called but can reproduce it now.
Re^4: IDE for Perl programming? ( *cperl-mode* bug)
by LanX (Saint) on Mar 12, 2021 at 17:08 UTC
      There's also the opposite case where you must not use whitespace:
      # This works and means the string 'foo': q#foo# # This is a single q, #foo# is a comment. q #foo#
      Funny, eh?

      Yes, it is a bug in the parser. In that monstrosity which analyses POD, Here-docs, regexes, and quote-like constructs, because in all of these things characters may change their meaning. choroba filed Bug#47112, a quick patch is coming soon.

      By the way: You can, in fact, eliminate that bug without any patch by setting the customizable variable cperl-under-as-char to t.

      Sigh. This dates back to a change Richard M. Stallman himself committed in 1998. Let's see whether I manage to revert that.

        > Yes, it is a bug in the parser.

        I'm not so sure anymore. The parsing problems disappear as soon as I start emacs with -q

        so something in my init-files seems to trigger the problem.

        Tested with

        • emacs 24.3 on Win and Ubuntu
        • emacs 27.1 on Win.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

        PS: In respect to cperl-under-as-char

        This variable is obsolete since 24.4; use ‘superword-mode’ instead.
        > By the way: You can, in fact, eliminate that bug without any patch by setting the customizable variable cperl-under-as-char to t.

        tried this, but unfortunately no avail. :(

        > Yes, it is a bug in the parser. In that monstrosity which analyses POD, Here-docs, regexes, and quote-like constructs, because in all of these things characters may change their meaning.

        I still think the only viable way is to have an expandable set of tests with Perl snippets to parse.

        An external Perl script should run them thru different emacs installations in batch mode.

        I started working on this some years ago, have to dig this out again ...

        ... unfortunately I am a bit too exhausted at the moment to do it right away.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery