If you just type system("notepad $filename"), then the Tk main loop will be held up until the user closes Notepad. This means that the Tk window won't get painted. (At least in all the versions of Tk I've used.) Kinda ugly.

If you want to spawn Notepad but don't want to pause the script waiting for Notepad to close, use Windows' START command:

system("start /b notepad $filename");
This runs Notepad in the "background" (a misnomer, since it will be activated just fine for the user to see it), and the script will continue immediately.

The Unix tradition is to allow the default editor to be configured, such as with an environment variable. The user can adjust this before running your application, if desired. I would code this like this:

my $editor = $ENV{EDITOR} || 'notepad.exe'; system("start /b $editor $filename;

--
[ e d @ h a l l e y . c c ]


In reply to Re: running notpade from perl by halley
in thread running notpade from perl by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.