Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Create and edit new scripts

by arkturuz (Curate)
on Apr 25, 2006 at 07:55 UTC ( #545495=note: print w/replies, xml ) Need Help??

in reply to Create and edit new scripts

I create a new perl program in nedit like this:
set_language_mode("Perl") insert_string("#!/usr/bin/perl -w") newline() newline() insert_string("use strict;") newline() newline()

It is simple to add an input form to ask for a file name, but I don't need it.

Replies are listed 'Best First'.
Re^2: Create and edit new scripts
by wazoox (Prior) on Apr 25, 2006 at 19:07 UTC
    I use nedit too and a very similar macro (bind to ctrl+shift+P :) However may I suggest that you'd better use
    use warnings;
    rather than
    #!/usr/bin/perl -w
    which has the undesirable side-effect to enable warnings in modules you use, and some really can't stand it ( for instance).
    BTW here's my macro, which uses "which" to determine the path to perl :
    set_language_mode( "Perl" ) myperl=shell_command( "which perl" , "" ) insert_string("#!" myperl "\n\nuse strict;\nuse warnings;\n") set_cursor_pos(100)
      I have the same binding :-)

      Thanx for the suggestion!
      I use '-w' because I want all the warnings in most of the programs I write. Some of them are CGI apps, and I like them to run clearly.

Re^2: Create and edit new scripts
by johngg (Canon) on Apr 25, 2006 at 15:20 UTC
    I don't know whether you have had this issue with nedit. If I create a new script from within the editor and save it without closing the edit session and then chmod +x it in the shell I can run it. If I make further changes to the script and save them I can no longer run the script as the permissions revert to rw-r--r-- after the save. If I create the file outside of nedit with execute permissions and then start editing, nedit doesn't trample on the permissions during the edit/save/test/edit ... cycle. This was one of the reasons for writing "newscript".

    Thank you for your reply, it has given me useful pointers to how I can better use nedit.



      I hadn't have this problem. It works OK for me on Linux system.
      Although, when I run the program from nedit I run it with (binded to Ctrl+Shift+E):
      chmod +x %; %
      '%' stands for current editing file.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://545495]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2023-02-09 01:59 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (44 votes). Check out past polls.