Results 1 to 5 of 5

Thread: [RESOLVED] Where to start?

  1. #1

    Thread Starter
    Addicted Member Claude2005's Avatar
    Join Date
    Jan 2010
    Location
    Philippines
    Posts
    166

    Resolved [RESOLVED] Where to start?

    Hello there,

    To start, feel free to move this if you find this thread inappropriate to this section of the forum. Next, my concern, I just started playing around with Perl just a few days ago and I'm wondering anyone could point me to the right direction.

    I'm trying to develop a simple application, like "Hello World!", in a Windows environment. I already installed ActivePerl and kept the default settings. I also downloaded Tk 804.028 and unzipped it to C:\Tk-804.208\. Everytime I ran my script, this error occurs

    Can’t locate Tk.pm in @INC <@INC contains: C:/Perl/site/lib C:/Perl/lib .> at tk1.pl line 2
    Here's my script

    Code:
    #! c:\perl\bin\perl
    use Tk;
    # Main Window
    my $mw = new MainWindow;
    my $label = $mw -> Label(-text=>"Hello World") -> pack();
    my $button = $mw -> Button(-text => "Quit", 
                               -command => sub { exit })
                     -> pack();
    MainLoop;
    If I change c:\perl\bin\perl with c:\Tk-804.208\Tk this error occur

    Can't exec c:\Tk-804.029\Tk at tk1.pl line 1.
    If I can get past this problem, I can already start developing applications for a UNIX/LINUX environment.

    As a side question, can I use Visual Basic instead of Perl/Tk?

    Thanks in advance
    If a post was helpful to you in any way, rate it. If your problem/question has already been solved/answered, remember to mark your thread as resolved.

    Useful Tools: C# to VB Converter
    Tutorial Sites: W3Schools|ASP.Net|ASP.Net QuickStart|LearnVisualStudio.Net

    So many things to learn, so little time... >_<

    Under Construction...

  2. #2
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Where to start?

    I've never used ActivePerl so I can't help with that side, but StrawberryPerl is more of a unix-style perl port for windows than ActivePerl and I've been using it for a long time without problems. With StrawberryPerl you could try using the CPAN shell to install Tk.

    If you want to develop for a Unix/Linux environment, then I would definitely recommend StrawberryPerl over ActiveState.


    Code:
    C:\> cpanp -i Tk
    Last edited by tr333; Aug 5th, 2010 at 11:45 PM.

  3. #3
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Where to start?

    I would also recommend using the following pragmas to improve coding:

    perl Code:
    1. use warnings;
    2. use strict;

    Put them above the "use Tk;" line. You also don't need the space between the #! and the c:\ on the first line. It's not actually used on Win32 except for parsing arguments to the perl.exe like:
    Code:
    #!C:\strawberry\perl\bin\perl.exe -wT
    It's used on unix systems to tell the OS which program to run the script with, since the OS doesn't use file extensions.

  4. #4
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Where to start?

    I just managed to successfully install Tk on StrawberryPerl and run the following Tk program:

    Install Tk:
    Code:
    C:\> cpanp -i Tk
    perl program:
    Code:
    #!c:\strawberry\perl\bin\perl.exe                                               
                                                                                    
    use warnings;                                                                   
    use strict;                                                                     
                                                                                    
    use Tk;                                                                         
    # Main Window                                                                   
    my $mw = new MainWindow;                                                        
    my $label = $mw -> Label(-text=>"Hello World") -> pack();                       
    my $button = $mw -> Button(-text => "Quit",                                     
                               -command => sub { exit })                            
                     -> pack();                                                     
    MainLoop;
    As another thing, you might want to configure your perl/tk scripts on windows to be run by wperl.exe instead of perl.exe so you don't get the cmd.exe window appearing each time. I'm not sure how to exactly do that but you could use a different file extension and tell windows to run that with wperl.exe.

  5. #5

    Thread Starter
    Addicted Member Claude2005's Avatar
    Join Date
    Jan 2010
    Location
    Philippines
    Posts
    166

    Re: Where to start?

    Thanks man.
    If a post was helpful to you in any way, rate it. If your problem/question has already been solved/answered, remember to mark your thread as resolved.

    Useful Tools: C# to VB Converter
    Tutorial Sites: W3Schools|ASP.Net|ASP.Net QuickStart|LearnVisualStudio.Net

    So many things to learn, so little time... >_<

    Under Construction...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width