X10 Community Forum

🖥️ActiveHome Pro => SDK => Topic started by: EL34 on January 11, 2008, 03:08:20 PM

Title: Converting Perl programs to a .exe
Post by: EL34 on January 11, 2008, 03:08:20 PM
I found a great program that takes my x10 perl programs and converts them to an .exe file.

Once you have an .exe file, you can get AHP to execute it in a macro.

I just wrote and tested a couple perl programs that make decisions based on modules being on or off, is it daytime or night, take a snapshot, turns on some lights first and then take a snapshot, etc.

Here's the program, it's called perl2exe
It times out after 30 days and then it's $49 for the cheapest version.
http://www.indigostar.com/

I was able to delete about 10 modules and macros from AHP that I was using for flags and triggers because my perl program is able to do all of that in one program.
The only downside is that the PC must be running, but then again, it has to be running to take snapshots and send emails anyway.
Title: Re: Converting Perl programs to a .exe
Post by: EL34 on January 22, 2008, 03:54:10 PM
I ended up purchasing the perl2exe program because I am finding it very useful.

Off loading all my macro's to perl programs has worked out very nicely.
You can make so many decisions and branches in your own program and they actually work 100% of the time, unlike AHP's macro's.

Just an update on perl2exe.
I bought the pro version which lets you use the -gui and -tiny options when creating your .exe.
When you use the -tiny option, perl2exe will create a very small .exe and some additional .dll files that have the routines that your .exe program needs.
The -gui option lets you use the Win32::Gui module for creating your own perl GUI programs.
Title: Re: Converting Perl programs to a .exe
Post by: KDR on January 22, 2008, 07:25:12 PM
EL34

Thanks for the update and description on how it works. Sounds like a nice little software program to have in your utility folder.  :D

(http://www.bdshost.com/X10/lpup.gif)---(http://www.bdshost.com/X10/lpup.gif)---(http://www.bdshost.com/X10/lpup.gif)---(http://www.bdshost.com/X10/lpup.gif)---(http://www.bdshost.com/X10/lpup.gif)----KDR
Title: Re: Converting Perl programs to a .exe
Post by: Charles Sullivan on January 22, 2008, 07:46:05 PM
What happens if you just run your PERL program from a batch file (as  opposed to compiling it into an .exe file)?

Title: Re: Converting Perl programs to a .exe
Post by: EL34 on January 22, 2008, 09:45:49 PM
I am calling the .exe's in AHP macro's via the Advanced functions/Window command.

Can you call a .bat file?
I only see .exe as a execute windows program option.
Title: Re: Converting Perl programs to a .exe
Post by: Charles Sullivan on January 22, 2008, 10:47:57 PM
I am calling the .exe's in AHP macro's via the Advanced functions/Window command.

Can you call a .bat file?
I only see .exe as a execute windows program option.

Yes.  Click the down arrow next to "Files of type:" and select "All(".")".

Title: Re: Converting Perl programs to a .exe
Post by: Charles Sullivan on January 23, 2008, 12:09:21 AM
BTW, I haven't played around a lot with executing Windows commands from AHP, but other posts on this forum have said that AHP won't accept parameters to a command - that's why you need the batch file.    Otherwise you could just execute "perl.exe  my_perl_program.pl" (or however else you execute a PERL program in Windows).

Title: Re: Converting Perl programs to a .exe
Post by: EL34 on January 23, 2008, 08:32:53 AM
Ah, thanks for the tip, I had tried to get AHP to execute a .pl file and it was a no go.
Hadn't thought about execing .bat files

Yes the batch file would be handy for adding parameters or multiple commands.

I tested a quickie batch file that starts one of my perl programs.
AHP calls the batch from a macro.
Works fine.

Thanks again for the handy tip.

BTW: For Win32, I have Activeperl 5.8.8.822 installed.
If you add the perl.exe to your windows path settings, you can just click on any .pl program and it will execute.
You have to change the Shebang line to #!C:\Perl\bin\perl, or where ever you have perl installed on your hard drive.
Not sure how perl installs are set up on the nix systems.
Title: Re: Converting Perl programs to a .exe
Post by: EL34 on January 25, 2008, 09:38:22 AM
Here's another nice thing you can do with perl2exe.

Convert your perl program using the -tiny option.
perl2exe will create some additional .dll's with all the modules your .exe needs to function.
Your program can then be run on other machines without the other machines having to have perl installed.

Nice if you write in perl and want to sell your programs to people who do not want to install perl.
Or don't want your code to be copied, etc.
Your programs become able to run on several platforms, including all the nix machines.
perl2exe has options to handle many of the os's out there.

just throwing out more info.