Link to home
Create AccountLog in
Avatar of onyourmark
onyourmark

asked on

making executable in perl

Can anyone explain the steps to starting with a .pl file and making it into an executable file? I am attaching the file I want to start with.
#! c:\perl\bin\perl
use strict;
use Tkx;

my $mw = Tkx::widget->new(".",,-backgroundaa => "blue");
$mw->g_wm_resizable(0,0);
my $top=$mw->new_ttk__frame(-borderwidth=>'5');
my $content = $mw->new_ttk__frame(-padding=>"3 3 5 5",);
my $buttom = $mw->new_ttk__frame;
$top->g_grid(-column=>0,-row=>0);
my $intr=$top->new_ttk__label(-text=>"Chatminer Text Transform",-font=>'TkHeadingFont 20 bold');
$intr->g_grid(-column=>0,-row=>0);
$content->g_grid(-column => 0, -row => 1);
my $row=0;
my $inputfile_v="Choose Input File";
my $inputfile_l = $content->new_ttk__label(-text => "Input CSV File");
$inputfile_l->g_grid(-column => 0, -row => $row ,-sticky=>"e",-padx=>'5');
my $inputfile_b= $content->new_ttk__button(-width=>'50',-textvariable=>\$inputfile_v,-command=>
sub{
$inputfile_v = Tkx::tk___getOpenFile(-filetypes=>[['CSV file', '.csv']]);
my ($p)=($inputfile_v=~ m/(.*)\//);
chdir($p);
}
);
$inputfile_b->g_grid(-column => 1, -row => $row++);
##save file
my $savefile_v="Choose Save File";
my $savefile_l = $content->new_ttk__label(-text =>"Save CSV File");
$savefile_l->g_grid(-column => 0, -row => $row ,-sticky=>"e",-padx=>'5');
my $savefile_b= $content->new_ttk__button(-width=>'50',-textvariable=>\$savefile_v,-command=>
sub{
$savefile_v = Tkx::tk___getSaveFile(-filetypes=>[['CSV file', '.csv']]);

}
);

$savefile_b->g_grid(-column => 1, -row => $row++);
#for NominalToString column
my $NominalToString_v="4";
my $NominalToString_l= $content->new_ttk__label(-text => "NominalToString Column");
$NominalToString_l->g_grid(-column => 0, -row => $row ,-sticky=>"e",-padx=>'5');
my $NominalToString_c= $content->new_ttk__entry(-width=>'50',-textvariable=>\$NominalToString_v);

$NominalToString_c->g_grid(-column => 1, -row => $row++);
my $agg;
my $flag;
sub MKC
{
	  my($lablename,$option)=@_;

 $flag->{$lablename}="false";
my $l= $content->new_ttk__label(-text => $lablename);
$l->g_grid(-column => 0, -row => $row ,-sticky=>"e",-padx=>'5');
my $c= $content->new_ttk__combobox(-width=>'48',-textvariable=>\$flag->{$lablename});
$c->configure(-value=>'true false');
$c->g_grid(-column => 1, -row => $row++);
$agg->{$lablename}=sub
	{
#		print $flag->{$lablename},"here $option\n";
	return $flag->{$lablename} eq 'false' ? ""  : $option;
	};
}
sub MKE
{
	  my($lablename,$option,$default)=@_;

 $flag->{$lablename}=$default;
my $l= $content->new_ttk__label(-text => $lablename);
$l->g_grid(-column => 0, -row => $row ,-sticky=>"e",-padx=>'5');
my $c= $content->new_ttk__entry(-width=>'50',-textvariable=>\$flag->{$lablename});
$c->g_grid(-column => 1, -row => $row++);
$agg->{$lablename}=sub
	{
#		print $flag->{$lablename},"here $option\n";
	return $option." \"".$flag->{$lablename}."\"";
	};
}
MKC("IDFTransform","-I");
MKC("TFTransform","-T");
MKE("Attribute Indeices","-R","first-last");
MKE("Attribute Name Prefix","-P","");
MKC("Do Not Operate On PerClass Basis","-O");
MKC("Inver Selection","-V");
MKC("Lower Case Tokens","-L");
MKE("Minimum Term Frequency","-M","1");
MKE("Normalize Doc. Length","-N","0");
MKC("Output Word Count","-C");
MKE("periodc Pruning","-prune-rate","-1.0");
MKE("Stemmer","-stemmer","weka.core.stemmers.NullStemmer");
MKE("Stopwords","-stopwords","Bill");
MKE("Tokenizer","-tokenizer",'weka.core.tokenizers.WordTokenizer');
#MKE("tokenizer","-tokenizer",'weka.core.tokenizers.WordTokenizer -delimiters \" \ \r\\n\\t.,;:\\\'\\\"()?!\"');
MKC("Use Stop List","-S");
MKE("Words To Keep","-W","1000");

#Save
$buttom->g_grid(-column=>0,-row=>2);
my $Save=$buttom->new_ttk__button(-text=>'save',-command=>sub{



my $param="";		
foreach my $k ( keys %$agg ) {
	my $f=$agg->{$k};
	#next if ($k =~ m/tokenizer/);
	#print $flag->{$k},"$k",&$f,"\n";
   $param.=" ".&$f." ";
 }
 print "param:$param,$inputfile_v\n";
		 unless($inputfile_v =~ m/:/)
		 {

		 Tkx::tk___messageBox(-message => "Please Choose The Input File !");
		 return;
	 }
		 unless($savefile_v =~ m/:/)
		 {

		 Tkx::tk___messageBox(-message => "Please Choose The Save File !");
		 return;
	 }
 	 print "java   weka.core.converters.CSVLoader  \"$inputfile_v\" > f1.arff";
system("java   weka.core.converters.CSVLoader  \"$inputfile_v\" > f.arff");
system("java   weka.filters.unsupervised.attribute.NominalToString -C $NominalToString_v -i f.arff -o f2.arff");
 	 print "\nnjava   weka.filters.unsupervised.attribute.StringToWordVector $param  -i f2.arff -o f3.arff\nn";
system("java   weka.filters.unsupervised.attribute.StringToWordVector $param  -i f2.arff -o f3.arff");
system("java  weka.core.converters.CSVSaver -i f3.arff -o \"$savefile_v\" ");

unlink("f1.arff","f2.arff","f3.arff");
	});
$Save->g_grid(-column=>0,-row=>0);

Tkx::MainLoop;

Open in new window

Avatar of Steve Tempest
Steve Tempest
Flag of Australia image

Have a look at this page Perl2Exe

http://www.indigostar.com/perl2exe.php

Manual.
http://www.indigostar.com/pxman.html
 

Another alternative is Active State Perl Dev Kit

http://www.activestate.com/perl-dev-kit/features




Avatar of onyourmark
onyourmark

ASKER

Thanks. I just downloaded perl2exe to try it. I got an error


Converting 'stwv_gui.pl' to stwv_gui.exe
Warning: Can't locate Tclaux.pm
    at C:\Perl\lib\Tcl.pm line 429
    @INC = C:\Perl\site\lib, C:\Perl\lib, .


I cannot find Tclaux.pm on the web or using ppm.
The thing about perl2exe is, the free, downloadable version doesn't let you use the -gui option. You have to buy the license to get that function.

Give the Acitve State trial version a go and see if that works for you.
Thanks again. I tested out PDK and trying to create an executable
I ran the perlapp from the
C:\Program Files\ActiveState Perl Dev Kit 9.0.1\bin
directory.

However I got the error

Can't reopen 'stwv_gui.exe' for write: Permission denied at /Win32/PE.pm line 413.

Do you know what that is?
Hi,

I'm not sure and dont have a way to test this for you. Initial thoughts would be antivirus maybe also try a build path outside the program files folder?

Sorry i cant be more helpful.
Hi. I put the path to the perlapp.exe file into the PATH variable like this:
;C:\Program Files\ActiveState Perl Dev Kit 9.0.1\bin

is that what you mean by building a path?
Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Steve Tempest
Steve Tempest
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Hi it seems to work now. Not sure why. In terms of options I did not use any. Are there any you recommend?
Hi,

That''s good news... If I had to guess I'd say it was your on-access virus scanner.

If it's working for you now no extra options are required.

Cheers.