#1
  1. No Profile Picture
    The Perl Tk Guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    At My Computer
    Posts
    165
    Rep Power
    30

    Perl2exe Problem


    Ok, I tried to pack my Tk program (and it worked before I packed it) and when I finished packong it then I tried to execute it and it didn't work.

    Here is the packing command I used
    Code:
     perl2exe c:\perl\bin\sub.pl -gui -o=Sub.exe -I=c:\perl\bin\

    Here is the Code I was packing:
    Code:
    use Tk;
    use Tk::DialogBox;
    use Tk::NoteBook;
    use Tk::LabEntry;
    
    my $top = tkinit;
    my $image = 'm.bmp'; 
    my $icon = $top->Photo(-file => $image);
    $top->idletasks;  
    $top->iconimage($icon);
    $top->configure(-background=>'red');
    $top->minsize(qw(800 600));
    
    use vars qw($top);
    
    my $pb = $top->Button(  -text => "Notebook", 
    			-command => \&donotebook
    			);
    	$pb->pack;
    
    
    
    my $f;
    
    sub donotebook {
        if (not defined $f) {
    	
    $f = 
    	my $mw = tkinit;
    	my $image = 'm.bmp'; 
    	my $icon = $mw->Photo(-file => $image);
    		$mw->idletasks;  
    		$mw->iconimage($icon);
    		$mw->minsize(qw(400 400));
    		$mw->configure(-background=>'red');
    
    $menu_bar = $mw->Frame()
    	->pack('-side' => 'top');
     
    
    $search_mb = $menu_bar->Menubutton('-text'            => 'File',
                                       '-relief'          => 'raised',
                                       '-borderwidth'     => 2,
               			    -activebackground =>'darkgray'
    				   )->pack('-side'    => 'left',
                                               '-padx'    => 2
                                               );
    
    $search_mb->command('-label'       => 'Find',
                        '-accelerator' => 'Meta+F',
                        '-underline'   => 0,
                        '-command'     => sub {print "find\n"}
                        );
    
    $search_mb->command('-label'       => 'Find Again',
                        '-accelerator' => 'Meta+A',
                        '-underline'   => 5,
                        '-command'     => sub {print "find again\n"}
                        );
    
    $match_type = "regexp"; $case_type = 1;
    
    $search_mb->separator();
    
    $search_mb->radiobutton('-label'    => 'Regexp match',
                            '-value'    => 'regexp',
                            '-variable' => \$match_type);
    
    $search_mb->radiobutton('-label'    => 'Exact match',
                            '-value'    => 'exact',
                            '-variable' => \$match_type);
    $search_mb->separator();
    
    $search_mb->checkbutton('-label'    => 'Ignore case?',
                            '-variable' => \$case_type);
    
    $MB2 = $menu_bar->Menubutton('-text'         	     => 'Exit',
                                       '-relief'         => 'raised',
                                       '-borderwidth'    => 2,
                                       -activebackground =>'darkgray'
    				   )->pack('-side'   => 'left',
                                               '-padx'   => 2
                                               );
    
    $MB2->command('-label'  => 'Exit',
    	       -command => [ sub {exit} ]
    		);
    
    my(@pl) = qw/-side top -padx .5m -pady .5m/;
    
    $mw->Photo('image1b',
    		 -file => Tk->findINC('foo.gif')
    	);
    
    $mw->Label(-image => 'image1b')->pack(@pl);
    
    
    
    
    
    #***********************this is the end of the sub***************************	
        }
    }
    
    MainLoop;
    At the top where the smile is ,is supposed to be TK:: dialogbox; with no space between 'Tk::' And 'Dialog'

    And this is what it said when I executed it:
    Can't locate Tk/Photo.pm in@INC (@INC contains: PERL2EXE_STORAGE C:\DOCUME~1\Fred\LOCALS~1\Temp C:\Documents and Settings\Fred\Desktop\perl\exe .) at PERL2EXE_STORAGE/TK/Widget.pm line 261.

    Can any one help?~Me6
    "One line of code is worth 1,000 pictures, and 1,000,000 words"
  2. #2
  3. Perl Hacker turned Farmer
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    Idaho Boondocks
    Posts
    1,466
    Rep Power
    87
    The first problem is that you are using perl2exe. Throw it away and download PAR from CPAN. It works much better and it is free.

    That being said, the problem with perl2exe is that you have to put special include directives in your script to tell perl2exe which modules is should package along with the script. You didn't put any of this (that I can see) and so perl2exe only packaged your text and none of the modules it depends on.

    Be sure to read the user manual - especially the "pragmas" section. You can find it here
  4. #3
  5. No Profile Picture
    The Perl Tk Guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    At My Computer
    Posts
    165
    Rep Power
    30
    Ok, I got Par and ran makefile.pl. It said three of the five core things were missing . Then it asked me if I wanted it to auto install the missing packages I said yes, then it said it was fetching the and then said fetching failed and ctd. Then I did it again saying no and it did the same thing????

    what did do wrong and were should I put all the par things?
    Last edited by ME6; January 7th, 2004 at 11:38 AM.
    "One line of code is worth 1,000 pictures, and 1,000,000 words"
  6. #4
  7. Perl Hacker turned Farmer
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    Idaho Boondocks
    Posts
    1,466
    Rep Power
    87
    Did you look through the errors to see why it failed? What version are you trying to download? Are you getting it from CPAN or PPM? You should get the latest version (only found on CPAN). It will auto install itself, you shouldn't have to worry about where to put it.
  8. #5
  9. No Profile Picture
    The Perl Tk Guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    At My Computer
    Posts
    165
    Rep Power
    30
    I got it from Cpan and it was version .78 in a tar.gzip (close enough for you to get the idea) format.
    "One line of code is worth 1,000 pictures, and 1,000,000 words"
  10. #6
  11. Perl Hacker turned Farmer
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    Idaho Boondocks
    Posts
    1,466
    Rep Power
    87
    Okay, I think I know what the problem is. When I talk about "CPAN", I mean use cpan from a shell. It has the ability to look for package dependencies and it automatically installs everything that is needed (after asking if you want to install the dependencies). It appears that you downloaded PAR from the website. I have never had any luck installing a module this way.

    I had version .76 installed and wanted to upgrade to version .78. Here is what I did:

    from a command line:

    perl -MCPAN -e "shell"

    gives a prompt that looks like

    cpan>

    From the prompt

    cpan> install PAR


    It runs through a bunch of things and then prompts that I am missing some packages and asks if I would like to install. I say yes, it thinks some more, ask a few more quesitons, then it is done.
  12. #7
  13. No Profile Picture
    The Perl Tk Guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    At My Computer
    Posts
    165
    Rep Power
    30
    How do you create an .exe out of PAR now that it is installed?
    Last edited by ME6; January 7th, 2004 at 06:30 PM.
    "One line of code is worth 1,000 pictures, and 1,000,000 words"
  14. #8
  15. Perl Hacker turned Farmer
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    Idaho Boondocks
    Posts
    1,466
    Rep Power
    87
    pp -o outputfile.exe inputfile.pl

    If you do not want a command window to be displayed (hidden script or a gui application)

    pp --gui -o outputfile.exe inputfile.pl
  16. #9
  17. Guru Meditation
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Location
    Amsterdam
    Posts
    1,304
    Rep Power
    382
    Heh. And what about us using Windows (i dont like that either but i need it for university

    How do we install new modules ? I'm using indigoperl ... so It all came together. Apache & Perl. ?

    And is there some other way to "compile" perl code. I'm actualy thinking about making machine independet code, but that wouldnt be in source code format.

    Maybe an bytecode or something ?
    Basicly i just dont want to give away my source code, but i realy hate programming in C .... realy like Perl
  18. #10
  19. No Profile Picture
    The Perl Tk Guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    At My Computer
    Posts
    165
    Rep Power
    30
    I am using Windows.
    "One line of code is worth 1,000 pictures, and 1,000,000 words"
  20. #11
  21. Perl Hacker turned Farmer
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    Idaho Boondocks
    Posts
    1,466
    Rep Power
    87
    I develop exclusively on windows. PAR will work on windows just fine.
  22. #12
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    1
    Rep Power
    0

    Thank you very much *raklet*


    Thank you very much *raklet*
    i was trying to make exe for a perl script, thro HTwoo, Activestate, and Cava packager, but no luck

    Finally you made my day.
    All the best for your Guidance of Perl-new-comers

IMN logo majestic logo threadwatch logo seochat tools logo