Please login or register.

Login with username, password and session length
Advanced search  

News:

The Buster PiX10Hub is here! Created by the Community, for the Community.:)% #:)

Author Topic: Converting Perl programs to a .exe  (Read 11397 times)

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Converting Perl programs to a .exe
« 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.
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Converting Perl programs to a .exe
« Reply #1 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.
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

KDR

  • Hero Member
  • *****
  • Helpful Post Rating: 53
  • Posts: 758
    • Home Automation Chat
Re: Converting Perl programs to a .exe
« Reply #2 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

----------------KDR
Logged
Note: "Guests" may read the X10 forum , but you must register to post!

When I'm online you can find me in the Home Automation Chat Room!

Charles Sullivan

  • Hero Member
  • *****
  • Helpful Post Rating: 94
  • Posts: 1565
    • HEYU - X10 Automation for Linux, Unix, and Mac OSX
Re: Converting Perl programs to a .exe
« Reply #3 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)?

Logged
Yesterday it worked.
Today it doesn't work.
X10 on Windows is like that.

HEYU - X10 Automation for Linux, Unix, and Mac OS X     http://www.heyu.org

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Converting Perl programs to a .exe
« Reply #4 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.
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

Charles Sullivan

  • Hero Member
  • *****
  • Helpful Post Rating: 94
  • Posts: 1565
    • HEYU - X10 Automation for Linux, Unix, and Mac OSX
Re: Converting Perl programs to a .exe
« Reply #5 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(".")".

Logged
Yesterday it worked.
Today it doesn't work.
X10 on Windows is like that.

HEYU - X10 Automation for Linux, Unix, and Mac OS X     http://www.heyu.org

Charles Sullivan

  • Hero Member
  • *****
  • Helpful Post Rating: 94
  • Posts: 1565
    • HEYU - X10 Automation for Linux, Unix, and Mac OSX
Re: Converting Perl programs to a .exe
« Reply #6 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).

Logged
Yesterday it worked.
Today it doesn't work.
X10 on Windows is like that.

HEYU - X10 Automation for Linux, Unix, and Mac OS X     http://www.heyu.org

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Converting Perl programs to a .exe
« Reply #7 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.
« Last Edit: January 23, 2008, 08:59:21 AM by EL34 »
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Converting Perl programs to a .exe
« Reply #8 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.

Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.