tk installed---only works from command line ($perl...) 
Author Message
 tk installed---only works from command line ($perl...)

I've installed perlTk on my RH5.1 linux box.  I can run PTk programs by
using something like: $ perl
use Tk;
 # etc....

However, I cannot run these programs as scripts.  I get the following:
$ test.pl
  (-h will show valid options).

It is not a permissions issue and the script is as simple as:

#!/usr/bin/perl -w
use Tk;
$text = "done!";
$mw = MainWindow->new;
$mw->title("Hello World");
$mw->Button(-text => $text, -command => sub {exit})->pack;
MainLoop;

Any ideas what I did wrong?

Thank you ahead of time



Tue, 11 Sep 2001 03:00:00 GMT  
 tk installed---only works from command line ($perl...)

Quote:

> I've installed perlTk on my RH5.1 linux box.  I can run PTk programs by
> using something like: $ perl
> use Tk;
>  # etc....
> However, I cannot run these programs as scripts.  I get the following:
> $ test.pl
>   (-h will show valid options).
> It is not a permissions issue and the script is as simple as:
> #!/usr/bin/perl -w
> use Tk;
> $text = "done!";
> $mw = MainWindow->new;
> $mw->title("Hello World");
> $mw->Button(-text => $text, -command => sub {exit})->pack;
> MainLoop;
> Any ideas what I did wrong?
> Thank you ahead of time

Oh, this is a real sneaky problem - you've got ^M (carriage returns) in
the file.  Until last week emacs *always* showed me these, but newer
emacs' may not.... use find-file-literally to force emacs to show them,
then remove them....

You've been DOSed!

--
--

Lehigh University Computing Center, USA



Tue, 11 Sep 2001 03:00:00 GMT  
 tk installed---only works from command line ($perl...)
Stephen:
        That was it!  I just installed the win95 version of Perl last night and
sent the file back to my Linux partition, but I didn't consider the
carriage return / newline issue.

        I've experienced the same emacs behavior; I log in at work (version
19.34.1) and can see ^M's all over the place, but with 20.3.1, nothing
appears.  I tried to take your suggestion a step further by put this in
my .emacs:
        ;; see ^M's on find
        (global-set-key "\C-x\C-f" 'find-file-literally)
However, this has the unfortunate side-effect of killing
font-lock-mode.  Very peculiar.  Perhaps the FSF has bound
font-lock-mode tightly with their multibyte character representation.  

        Thank you for lending me a hand and solving my mystery.  :)

Phil



Tue, 11 Sep 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. -F works on command line but not on #!perl -paF line

2. Command line Perl works but IIS Perl doesn't

3. Can't get command line perl to work right

4. perl program works on command line, but not when run through www server

5. perl/tk command line invocation

6. Wat is the command line to activate perl/tk

7. dbi and odbc - works in command line only

8. command line args not working correctly

9. system call works in command line mode but not from web

10. System call works at command line but not within CGI

11. Blat works from command line but not in CGI script

12. work on command line and not via browser?

 

 
Powered by phpBB® Forum Software