in reply to Re^2: Running JavaScript from within Perl
in thread Running JavaScript from within Perl

Do you know of a way to indent a script automatically? I currently use Notepad++ and also have Komodo IDE installed (but would happily use another editor that can indent automatically).

  • Comment on Re^3: Running JavaScript from within Perl

Replies are listed 'Best First'.
Re^4: Running JavaScript from within Perl (indentation)
by hippo (Archbishop) on Sep 19, 2019 at 18:08 UTC

    perltidy is an IDE/Editor-agnostic way to indent your code in a controlled manner. Any IDE/Editor should be able to hook into it at least on write-to-disk.

Re^4: Running JavaScript from within Perl
by marto (Cardinal) on Sep 19, 2019 at 17:55 UTC
Re^4: Running JavaScript from within Perl
by anautismobserver (Sexton) on Sep 20, 2019 at 17:51 UTC

    When I typed "perltidy" I got the following response:

    Can't locate Perl/Tidy.pm in @INC (you may need to install the Perl::T +idy module)

    When I typed "cpanm Perl::Tidy" in the Command Window the installation failed, with the following in the build.log:

    cpanm (App::cpanminus) 1.7044 on perl 5.028001 built for MSWin32-x64-m +ulti-thread Work directory is C:\Users\Judy/.cpanm/work/1569000722.23204 You have make C:\Strawberry\c\bin\dmake.exe You have C:\WINDOWS\system32\curl.exe Falling back to Archive::Tar 2.30 Searching Perl::Tidy () on cpanmetadb ... --> Working on Perl::Tidy Fetching http://www.cpan.org/authors/id/S/SH/SHANCOCK/Perl-Tidy-201909 +15.tar.gz -> OK Unpacking Perl-Tidy-20190915.tar.gz Entering Perl-Tidy-20190915 Checking configure dependencies from META.json Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.34) Configuring Perl-Tidy-20190915 Running Makefile.PL Checking if your kit is complete... Looks good Generating a dmake-style Makefile Writing Makefile for Perl::Tidy Writing MYMETA.yml and MYMETA.json -> OK Checking dependencies from MYMETA.json ... Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.34) Building and testing Perl-Tidy-20190915 ############################################################# ### ### ### DMAKE WARNING ### ### ### ### Do not use dmake.exe utility as it is no longer ### ### part of Strawberry Perl, use gmake.exe instead! ### ### ### ### If you have troubles with CPAN client delete: ### ### %USERPROFILE%\AppData\Local\.cpan\CPAN\MyConfig.pm ### ### ### ############################################################# -> FAIL Installing Perl::Tidy failed. See C:\Users\Judy\.cpanm\work\15 +69000722.23204\build.log for details. Retry with --force to force ins +tall it. Expiring 5 work directories.

    Please tell me how to install perltidy. Thanks.

      C:\Strawberry\c\bin\dmake.exe

      Do you have multiple Perl installations on your machine?

      If so, my recommendation is to remove the "old" Perl installation from $ENV{PATH} before trying again to install it.

Re^4: Running JavaScript from within Perl
by Anonymous Monk on Sep 19, 2019 at 19:52 UTC
    Do you know of a way to indent a script automatically? I currently use Notepad++ and also have Komodo IDE installed (but would happily use another editor that can indent automatically).

    Komodo has brilliant auto-indent features. Open preferences and select "indentation" to check out the global and per language indentation settings like (quoted from komodo docs):

    "Smart Indent: Komodo automatically anticipates logical indentation points, based on language cues (such as open braces)."

    "Auto-adjust closing braces: Komodo automatically aligns closing braces with corresponding opening braces."

    "Show indentation guides: Select to display indentation markers (grey vertical lines). An indentation marker is displayed every time the number of spaces on the left margin equals the value specified in the Number of spaces per indent field."

    This works great with prefs > smart editing > enable soft characters ("Enable soft characters turns on language-specific autocompletion for brackets, braces and other delimiters. The highlighted closing character is inserted after the cursor and can be “typed over”.")