How to debug a Perl script

Source: Internet
Author: User
Tags install perl perl script

Perl is a very powerful text processing language. When I was writing a Perl script, I basically solved it with notepad ++ and print.CodeEditing and debugging problems. Notepad ++ is actually a very good choice for the editor. It is very nice to highlight the Perl code. If you like it, you can expand it yourself. But for debugging this part, although this method is also used to write thousands of scripts that can work, it is always not a way to view the results with print.

After studying it, we found two good tools:

Komodo ide

This is a cross-platform integrated development environment released by ActiveState for dynamic languages.

It supports Mac, Linux, and windows;

The integrated development environment supports code editing and debugging.

In addition to Perl, the so-called dynamic language also supports many other dynamic languages, such as Python, Ruby, and PHP.

Those familiar with Visual Studio may feel familiar with Visual Studio.

For details, refer to its official website: https://www.activestate.com/komodo/

Yes: https://www.activestate.com/activeperl_pro_studio/downloads/

This is indeed a very powerful tool, but the price of $295 is actually a thousand miles away. The 21-day trial has arrived, and your script has not been completed yet. What should I do?

In general, behind every successful commercial software, there will be a good (at least available) free software. For debugging Perl, we should at least make another choice:

Notepad ++ & ptkdb

N ++ is a well-known editor that is easy to use in windows. I will not repeat it here. If you are not familiar with it, refer to it.

Of course, you should like the Komodo ide style. They provide a free Komodo edit.

With the editor, the debugger task is undertaken by ptkdb:

Ptkdb is a free/open source Debugger for Perl with graphical user interface (GUI) based on perk/TK.
Ptkdb is able to run on almost any operating system.

Free, cross-platform, and GUI should meet our requirements.

<

Of course, Komodo IDE is not as good as its interface aesthetics and manageability, but it is quite good to have such a free tool.

 

The following describes how to configure this set of "Earth ide"

    1. Install Perl
      For Windows users, you can download the latest Perl installation package from the ActiveState Website: https://www.activestate.com/activeperl/. when the installation is complete, the variable name cannot be too long or empty.
    2. Install TK
      TK is a graphical interface library that is introduced by TCL to Perl. ptkdb depends on the display interface of this GUI library. You can directly go to the CMD window:
      PPM install TK
    3. InstallPtkdb
      The installation command is:
      PPM install devel: ptkdb

      If installation fails with this command, we need to manually download and decompress the module to: C: \ Perl \ Lib \ devel: \ Perl is replaced with your installation path.

    4. Integration with notepad ++
      To debug a script, you need:
      Perl-D: ptkdb test. pl

      However, since we develop scripts in Notepad ++, and notepad ++ provides a mechanism to integrate with external tools, we can easily execute a menu command to debug the current script:

      Enter the following command:

      Perl.exe-D: ptkdb "$ (full_current_path )"

      Then save as a run menu command, and everything is OK.

Suddenly, I had the urge to write a Perl ide myself ~~~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.