http://www.perlmonks.org?node_id=169378

Tomek has asked for the wisdom of the Perl Monks concerning the following question:

I'm currently running a Linux server running samba, apache, mysql etc.. and I edit the cgi scripts on my linux server using the Windows UltraEdit client.

This setup works fine, however I would like to find out from experienced perl programmers having a similar setup - what other editing clients or server setups would you recommend? What Windows or *nix clients are out there that would make it easier to write, debug or test perl scripts running on my linux server? Is there a guide or a FAQ out there that talks about this stuff?

Replies are listed 'Best First'.
Re: Perl/MySQL Development Environment
by Juerd (Abbot) on May 26, 2002 at 13:55 UTC

    I'd recommend using vim. It takes some getting used to, but offers great syntax highlighting, folding, auto-indenting and a lot of other features that coders like. I prefer using multiple terminals: one to code with, one to test with, one to have a permanent mysql command line client on, but you could configure vim to pipe your script through perl or even the perl debugger to test/debug it.

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      Let me second that, and explain why.

      When debugging, I bet your routine is something like this:

      • make changes and save
      • upload with FTP client (maybe have to reconnect first)
      • reload web page that calls scripts

      Now, if it's a big change you may not mind, but what if all you're doing is changing the odd word? It gets a bit tedious.

      Editing in vi/vim can speed this up considerably. It's on the server, so you don't have to worry about editing stuff from another machine that doesn't have UltraEdit on it if your away from yours (only ssh client - you do use ssh, don't you:).

      It's easy to get overwhelmed though with vim's features, so to begin with, I suggest you learn the following:

      • / followed by term - find
      • n - find next of last term entered
      • x - delete char
      • r char - replace character with char
      • dd - delete line
      • ^ - go to beginning of line
      • $ - go to end of line
      • i - switch to insert mode
      • o - insert line and switch to insert mode
      • ESC - return from insert mode to command mode
      • :w - save file
      • ZZ (in caps) - save and exit

      Typing a number before most of the commands above duplicates the action that many times.

      If you take it slowly and just learn a few commands at a time, it's easier to learn.

      After that, I'd move onto keyboard movement (hjkl), marking and yanking (copying), eg m'a, followed by y'a to mark and copy. p is put (paste).

      Finally, this is a good book to get you going.

      .02

      cLive ;-)

      --
      seek(JOB,$$LA,0);

        WARNING: Incoming OT post......
        When debugging, I bet your routine is something like this:
        
            * make changes and save
            * upload with FTP client (maybe have to reconnect first)
            + reload web page that calls scripts
        

        If he's using Samba, he probably doesn't have to resort to FTP. Just click the Save icon. He's going to have to hit Reload one way or the other, and he's going to have to make changes as well. Using vi/vim, he has to open a telnet (no no) or ssh (that's the ticket) session. So using vi/vim actually involves an extra step that he currently doesn't have to go through with other Windows-based editors.

        I'm not slamming you, cLive ;-). I ++'d the node. I just wanted to make it obvious to everyone that what you are recommending (which is the process I use) involves a step that is not necessary due to the use of Samba.

        All of the above is based on the assumption that I have not missed something glaringly obvious, which is highly likely and - sadly - becoming the norm for my life.

        If things get any worse, I'll have to ask you to stop helping me.

        One thing to watch out for when editing over a remote connection: lag. If it's a fast connection, the lag probably wouldn't cause any problems, but if it's over a dialup or anything else that's slow, you could end up waiting a "long" period of time for your keystrokes to get through, and things can get messy. That's a pain to deal with.

        My 3.14 cents. (Inflation, ya know...)

        --

        There are 10 kinds of people -- those that understand binary, and those that don't.

        As a sidenote: UltraEdit can edit files over FTP, downloading and uploading when necessary (when opening and saving).
      Oh, Juerd, what are your impressions from vim6 folding when used against Perl code? Do you manually create folds or use indent auto-folding? I see this feature as extremely useful but cannot configure it properly :)) auto-folding seems awkward and manual folding consumes much time.

        set smartindent set tabstop=8 set shiftwidth=4 set softtabstop=4 let perl_want_scope_in_variables=1 let perl_extended_vars=1 let perl_include_pod=1 let perl_fold=1 colorscheme elflord syntax on hi Folded ctermfg=red
        The folding is defined in the syntax file, so you must enable perl_fold before turning on syntax. I dislike the yellow folding (I want the folds to be very visible) that is default in elflord, so I use the "highlight" (hi) command to change it to red.

        - Yes, I reinvent wheels.
        - Spam: Visit eurotraQ.
        

      Thanks everybody for your responses - I will definitely try out some of the editors you've mentioned. vim seems to do some of the functions that I'm looking for - to be able to use multiple coding and testing terminals and even to be able to run command lines directly. I'm used to vi so the keyboard commands shouldn't be a big problem. However, it seems like configuring vim for perl could be tricky.. Emacs seems to be an option as well so might give it a go.

      At the moment I use samba so I can save the output from Ultraedit directly to my linux box (don't have to use ftp) and run/test the scripts - but the major problem is that I have to reload the webpage that calls the script so this testing is not very efficient.

      I would also like to try out Komodo for windows (I run my linux server on an old Pentium 133 so I don't really want to use demanding editors on it) but I'm not sure how well will it integrate to do the remote debugging..

      Visual Studio with Visual Perl seems a bit of an overkill for medium sized projects... does anybody have any views on that?

      Thanks!
Re: Perl/MySQL Development Environment
by mattr (Curate) on May 26, 2002 at 14:18 UTC
    Hopefully UltraEdit will save things with linefeeds and not carriage returns, otherwise scary to me. Visual Studio can use a plugin from Activestate.com for a visual perl dev environment. Or maybe better yet check out their Komodo IDE. Whatever editor, you should look for one that has a Perl mode that does indenting and syntax coloring. If you can collapse functions even better.

    I use Xemacs on linux. There is an NT version too, or you can run the text-mode emacs client in a cygwin shell locally.

    So as not to start a holy war, there are also vi and vim which like the emacs can be accessed remotely, which is probably how most config file tweaking is actually done.

    Update:I confess, after thinking about it I probably do most quick config edits in vi. Eeek! Whodaknown?

Re: Perl/MySQL Development Environment
by derby (Abbot) on May 26, 2002 at 14:12 UTC
    I prefer to install cygwin when having a windows client and doing *nix server work.

    -derby

Re: Perl/MySQL Development Environment
by alien_life_form (Pilgrim) on May 26, 2002 at 16:42 UTC
    Greetings,

    I swear by emacs (Which you can get for windoze)+ cperl-mode. Others swear at emacs, but I am careful not to get into that line of discussions anymore...

    Cheers,
    alf


    You can't have everything: where would you put it?