I build it with perl2exe as well but that will require a small mod to the
parent.pm in procfarm. The change has been submitted to the creator of
procfarm but he has not released it.

I tested it on XP and NT4 and 2K so as far as I can tell once it is compiled
as long as you are calling the lowest common denominator for the OS's it
should work =-)


Open parent.pm and look for the following code:

sub _new_async {
  my $self = shift;

  my $process;
  my $unique = $Win32::ProcFarm::Parent::unique++;
  my $port_num = $self->{port_obj}->get_port_num;
  (my $perl_exe = $^X) =~ s/\\[^\\]+$/\\Perl.exe/;
  Win32::Process::Create($process, $perl_exe, "perl $self->{script}
$port_num $unique", 0, 0, $self->{curdir}) or
      die "Unable to start child process.\n";
  $Win32::ProcFarm::Parent::processes->{$unique} = $process;
  $self->{state} = 'init';
  return $self;
}


Replace it with this code:

sub _new_async {
  my $self = shift;

  my $process;
  my $unique = $Win32::ProcFarm::Parent::unique++;
  my $port_num = $self->{port_obj}->get_port_num;
  if($self->{script}=~ /\.exe/ig){
        Win32::Process::Create($process, ".\/$self->{script}",
"$self->{script} $port_num $unique", 0, 0, $self->{curdir}) or die "Unable
to start child process. .\/$self->{script} $port_num $unique\n";
  } else {
        (my $perl_exe = $^X) =~ s/\\[^\\]+$/\\Perl.exe/;
        Win32::Process::Create($process, $perl_exe, "perl $self->{script}
$port_num $unique", 0, 0, $self->{curdir}) or die "Unable to start child
process. perl $self->{script} $port_num $unique\n";
  }
  $Win32::ProcFarm::Parent::processes->{$unique} = $process;
  $self->{state} = 'init';
  return $self;
}

-----Original Message-----
From: Jeremy White [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 07, 2004 9:16 AM
To: [EMAIL PROTECTED]
Cc: perl-win32-gui-users@lists.sourceforge.net
Subject: RE: [perl-win32-gui-users] Win32::GUI help


Looks good - I'll have to have a play. Have you had any issues rolling out 
your exe across different versions of windows? Do you build the child with 
perl2exe before shipping it out?

Thanks,

jez.


>From: "Farrington, Ryan" <[EMAIL PROTECTED]>
>CC: "'perl-win32-gui-users@lists.sourceforge.net'"
><perl-win32-gui-users@lists.sourceforge.net>
>Subject: RE: [perl-win32-gui-users] Win32::GUI help
>Date: Wed, 7 Jan 2004 08:17:12 -0600
>
>Here ya go: All the use's were done to allow for perl2exe to compile it
>into
>an application. The code is really really sloppy. =( Also I used guiloft to
>create the win32::Gui stuff... Way easier.. I would highly recommend it! 
>=-)
>
>
>-----------CODE-----------
>#!e:\perl\bin\perl
>#this is the parent script
>use Win32::GUI;
>use Win32;
>use Win32::GUI::Loft;
>use Win32::GUI::Resizer;
>use Win32::GUI::ToolbarWindow;
>use Win32::GUI::BorderlessWindow;
>use Win32::GUI::Loft::Cluster;
>use Win32::GUI::Loft::ControlProperty;
>use Win32::GUI::Loft::ControlProperty::Readonly;
>use Win32::GUI::Loft::ControlInspector;
>use Win32::GUI::Loft::Control;
>use Win32::GUI::Loft::Control::ForegroundBackground;
>use Win32::GUI::Loft::Control::Intangible;
>use Win32::GUI::Loft::Control::Window;
>use Win32::GUI::Loft::Control::Button;
>use Win32::GUI::Loft::Control::Textfield;
>use Win32::GUI::Loft::Control::RichEdit;
>use Win32::GUI::Loft::Control::Label;
>use Win32::GUI::Loft::Control::Checkbox;
>use Win32::GUI::Loft::Control::Radiobutton;
>use Win32::GUI::Loft::Control::Listbox;
>use Win32::GUI::Loft::Control::Combobox;
>use Win32::GUI::Loft::Control::TreeView;
>use Win32::GUI::Loft::Control::ListView;
>use Win32::GUI::Loft::Control::Groupbox;
>use Win32::GUI::Loft::Control::Toolbar;
>use Win32::GUI::Loft::Control::StatusBar;
>use Win32::GUI::Loft::Control::ProgressBar;
>use Win32::GUI::Loft::Control::TabStrip;
>use Win32::GUI::Loft::Control::Splitter;
>use Win32::GUI::Loft::Control::ImageList;
>use Win32::GUI::Loft::Control::Timer;
>use Win32::GUI::Loft::Control::Custom;
>use Win32::GUI::Loft::Control::Graphic;
>use Win32::GUI::Resizer;
>use Data::Dumper;
>use IO::Socket;
>use Cwd;
>use Data::Dumper;
>use Win32::Process;
>use Win32::ProcFarm::Port;
>use Win32::ProcFarm::TickCount;
>use Win32::ProcFarm::Parent;
>use Win32::ProcFarm::Port;
>
>#this hides the dos window =-) yeah!
>my ($DOS) = Win32::GUI::GetPerlWindow(); Win32::GUI::Hide($DOS); my 
>$port_obj = Win32::ProcFarm::Port->new(9000, 1); my $interface = 
>Win32::ProcFarm::Parent->new_async($port_obj, "perl_script.pl", 
>Win32::GetCwd);
>
>$interface->connect;
>sub main {
>
>       # this code from here to the other here (lol) is all I need to
create 
>the window. Ergo why GUILOFT ROCKS!
>       my $fileWindow = "Hotfix.gld";
>       my $objDesign = Win32::GUI::Loft::Design->newLoad($fileWindow) or 
>die("Could not open window file ($fileWindow)");
>       #Create a menu and assign it to the design object before
>       #building the window.
>       $objDesign->mnuMenu(
>               Win32::GUI::MakeMenu(
>                       "&File"=>"mnuFile",
>                       " > Save"=> "mnuFileSave",
>                       " > Save All"=> "mnuFileSaveAll",
>                       " > E&xit"=> "mnuFileExit",
>                       "&Help"=> "mnuHelp",
>                       " > A&bout"=> "mnuHelpAbout"
>               )
>       );
>       my $win = $objDesign->buildWindow() or die("Could not build window 
>($fileWindow)");
>       $win->Show();
>       # the other HERE! =-)
>
>}
>
>sub ::btnOpen_Click {
>       $jobServerToProcess = "localhost";
>       $interface->execute('check_server', "$jobServerToProcess");
>}
>
>
>-----------END CODE-----------
>
>
>-----------CODE-----------
>#!e:\perl\bin\perl
>#this is the child process
>use Data::Dumper;
>use IO::Socket;
>use Win32::GUI;
>my ($DOS) = Win32::GUI::GetPerlWindow(); Win32::GUI::Hide($DOS);
>
>sub init {
>   my($port_num, $unique) = @ARGV[0,1];
>
>   $socket = new IO::Socket::INET ("localhost:$port_num") or die "Child 
>unable to open socket.\n";
>   print $socket pack("V", $unique);
>}
>
>sub main_loop {
>   my $len, $cmd;
>
>   my $temp = read($socket, $len, 4);
>   $temp or exit;
>   $temp == 4 or die "Unable to completely read command length.\n";
>   $len = unpack("V", $len);
>   (read($socket, $cmd, $len) == $len) or die "Unable to completely 
>read command.\n";
>   my($command, $ptr2params);
>   eval($cmd);
>   my(@retval) = &$command(@{$ptr2params});
>   my $retstr = Data::Dumper->Dump([EMAIL PROTECTED], ["ptr2retval"]);
>   print $socket (pack("V", length($retstr)).$retstr);
>}
>
>&init;
>while(1) {
>       &main_loop;
>}
>
>sub check_server {
>       my($server) = shift;
>       # do your stuff here! =-)
>
>}
>
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: IBM Linux Tutorials.
>Become an expert in LINUX or just sharpen your skills.  Sign up for 
>IBM's Free Linux Tutorials.  Learn everything from the bash shell to 
>sys admin. Click now! 
>http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
>_______________________________________________
>Perl-Win32-GUI-Users mailing list
>Perl-Win32-GUI-Users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users

_________________________________________________________________
Find a cheaper internet access deal - choose one to suit you. 
http://www.msn.co.uk/internetaccess

Reply via email to