RE: Prevent console window

2010-01-14 Thread Nele Kosog
Is this approach also an option if I need the result that the child
process generates in the main program? And if so, how do I obtain the
result? I can see it on STDOUT.

Thanks for your help!
Nele

-Original Message-
From: bob davis [mailto:robert.da...@infor.com] 
Sent: Mittwoch, 13. Januar 2010 16:05
To: Nele Kosog
Cc: par@perl.org
Subject: Re: Prevent console window

It gets set in this call so you can use it for things like this:


$ProcessObj-Suspend();
$ProcessObj-Resume();
$ProcessObj-Wait(INFINITE);


Nele Kosog wrote:
 Bob,
 
 where does the $ProcessObj come from? 
 The documentation on CPAN doesn't explain it and I don't know what
 object is expected.
 
 Thank you!
 Regards,
 Nele
 
 
 Do you use 'system' to start the command line?
 How about something like this instead
 
 Win32::Process::Create($ProcessObj,
$ExeName,
$Args,
0,
NORMAL_PRIORITY_CLASS,
.)
 
 

-- 
Bob
Bob Davis | Infor |Office: 603.334.5060 | robert.da...@infor.com | cell:

603-479-4358 | home: 603-778-0781 | skype: rsdavis9




RE: Module Digest.pm causes error

2010-01-12 Thread Nele Kosog
The constructor of Data::Serializer takes a digester string which is later 
passed on to Digest:
Digest-new($digester); (line 668)

I can't find any use or require statements but I think (correct me if I am 
wrong) Data::Serializer uses this line to load modules: 
eval { require $package }; (line 187)

Since the Digest method is passed as string, I think Data::Serializer uses 
SHA-256 (that's the default and I don't pass a different parameter to 
Data::Serializer).

Command:pp -vvv -x -M Digest::SHA -o my_program.exe my_program.pl
Compiles:   Yes
Runs:   No
Error:  Same as before
--
Command:pp -vvv -x -M Digest -o my_program.exe my_program.pl
Compiles:   Yes
Runs:   No
Error:  Same as before

No, it doesn't work with -M Digest::SHA.

Regards,
Nele


RE: Module Digest.pm causes error

2010-01-12 Thread Nele Kosog
Thanks for your detailed reply! 

With use Digest::SHA; I can at least compile my program into an executable:

pp -x --gui -o my_program.exe my_program.pl

The executable doesn't run though. The process appears in the Task Managers 
list of processes and then just dies and disappears. No messages, no errors in 
the console window. 

I have the feeling I'm making an obvious, stupid, major mistake. It can't be 
that difficult to create a running executable, can it?

Regards,
Nele




RE: Module Digest.pm causes error

2010-01-12 Thread Nele Kosog
Roderich,

I did it again. Yes, it is an obvious, stupid, major mistake: I forgot to 
update the appropriate module which is in the @INC. When I added use 
Digest::SHA; and recompiled the executable (pp -x --gui -o my_program.exe 
my_program.pl), it all worked well.

Thank you so much for your effort!
Regards,
Nele



Prevent console window

2010-01-12 Thread Nele Kosog
Hi, 

I have compiled an executable using the following command:
pp -x --gui  -o my_program.exe my_program.pl

While --gui blocks the console window for the main application, it does
not seem to prevent other console windows from opening.

my_program.pl uses two command line tools to calculate something. When I
run the pp'ed executable, the my_program.exe opens a new console window
for each call to one of the command line tools. 

Are there means to prevent this? I have searched for this option, but
only find the --gui switch description.

Thank you  for your help!
Regards,
Nele


RE: Prevent console window

2010-01-12 Thread Nele Kosog
 Do you use 'system' to start the command line?
No, I use back ticks my $result = `command`;

 How about something like this instead
 Win32::Process::Create($ProcessObj,
$ExeName,
$Args,
0,
NORMAL_PRIORITY_CLASS,
.)
Thank you, this looks good. I'll try this approach.

Regards,
Nele


Module Digest.pm causes error

2010-01-11 Thread Nele Kosog
Hi there,

I was able to create an executable using pp -x -vvv -o my_program.exe
my_program.pl

When running the EXE the program exits with the following error message:

Can't locate object method new via package Digest::SHA at Digest.pm
line 43
(#1)
(F) You called a method correctly, and it correctly indicated a
package
functioning as a class, but that package doesn't define that
particular
method, nor does any of its base classes.  See perlobj.

Uncaught exception from user code:
Can't locate object method new via package Digest::SHA at
Digest.pm line 43.

Please note
CPAN says : Module::ScanDeps is up to date (0.96).

When I run my_program.pl on the command line everything works. I get no
errors.

Does someone has an idea?

Thank you in advance,
Nele


RE: pp wiht option -x fails when trying to execute accessor methods

2010-01-10 Thread Nele Kosog
Roderich,

thank you for your reply. I have to admit I probably did simplify my example 
too much when posting to the list ;-). I solved the problem my original 
question was addressing: Somewhere in the process of creating the executable I 
copied the modules to site/lib/my_project/ forgetting all about it and then 
wondering why there would be a difference between the local perl program and 
the creation of the pp executable (which uses site/lib/my_project since it's 
in @INC). Haha. Good laugh! Sorry for bugging you and everybody else.

Nele



Executable dies

2010-01-10 Thread Nele Kosog
Hello everybody,

 

I was able to create an executable using the following command

pp -x --gui --icon path/to/my/icon.ico -o my_program.exe my_program.pl

 

The program is executed while generating the exe and the GUI is loaded.
It seems to work since I can perform all operations correctly. I close
the application window and pp finishes the creation process.

 

When I try to start the executable from a command line window nothing
happens. Why is that and what can I do to at least see an error message?

 

Thank you in advance,

Nele



pp wiht option -x fails when trying to execute accessor methods

2010-01-08 Thread Nele Kosog
My program uses accessors::rw qw ( variable_name ); to define
accessor methods for my modules. When I pack my program with pp and -x
option (which I use to pull in modules that load other modules at
runtime - thanks to Roderich) it fails saying that it Can't call method
my_var without a package or object reference at a line where I try to
use the accessor methods.

Here is a simplified example:

### package MyModuleA

package MyProject::MyModuleA;
use accessors::rw qw ( my_var );

sub new {
  my $class = shift;
  my %parameter = @_;
  bless {
my_var = $parameter{value};
  }, $class;
}


### package MyModuleB

package MyProject::MyModuleB;
use accessors::rw qw ( my_other_var );

sub new {
  my $class = shift;
  my %parameter = @_;
  bless {
my_other_var = $parameter{value};
  }, $class;
} 

### I use both modules in my_program.pl

my $var1 = MyProject::MyModuleA-new(value = a);

### pp fails, where I try to call the accessor method $var1-my_var
my $var2 = MyProject::MyModuleB-new(value = $var1-my_var);

Does someone know why and how I can find a workaround?

Any hints are appreciated!
Thank you!

Regards,
Nele


RE: Cannot locate own modules

2010-01-06 Thread Nele Kosog
Roderich,

thanks a lot for your reply! It works using option -x.
Thanks again!
Nele


-Original Message-
From: Roderich Schupp [mailto:roderich.sch...@googlemail.com] 
Sent: Mittwoch, 6. Januar 2010 14:34
To: Nele Kosog
Cc: par@perl.org
Subject: Re: Cannot locate own modules

On Wed, Jan 6, 2010 at 1:20 PM, Nele Kosog k...@sevencs.com wrote:
 camelbox/site/lib directory to make it compile the executable. When I
 run it, I get a new error saying it could not load the driver class
 'Rose::DB::Pg' which I use in my modules. It is installed and located in
 camelbox/site/lib/Rose/DB/Pg.pm - which should be ok.
 ...
 What else can I try to make it work?

Rose::DB is another example of a module that loads other modules
(e.g. the Postgres driver Rose::DB::Pg) _at runtime_ in a way that can't
be detected by static analysis (which is the default analysis mode for
Module::ScanDeps).

Try using pp with option -x. This will _run_ your program once
(before packing it) and adds all modules loaded during the run
to the ones detected by static analysis.
If this doesn't help we may have to add another hint to Module::ScanDeps
that essentially says: if you detect usage of Rose::DB add all modules
found below Rose/DB.

Cheers, Roderich


Cannot locate own modules

2010-01-04 Thread Nele Kosog
I use PAR Packager, version 0.991 (PAR version 0.994) on Windows XP with
Camelbox Perl.

 

Here is what I am trying to do: 

I would like to use pp -o program.exe my_program.pl in my_project
folder to create an executable:

 

my_project/

  - my_program.pl

  - my_module.pm

  - my_sub_folder/

o my_other_module.pm

 

 

My problem is:

pp and the resulting program.exe can't locate my_module.pm. 

 

It dies saying 

 

Can't locate my_project/my_module.pm in @INC (@INC contains:
P:/my_project CODE(0x136894c)
C:\DOCUME~1\kg\LOCALS~1\Temp\par-kg\cache-7f2f696b30a4d7cbd896ace1c1c2ec
684c64834a\inc\lib
C:\DOCUME~1\kg\LOCALS~1\Temp\par-kg\cache-7f2f696b30a4d7cbd896ace1c1c2ec
684c64834a\inc CODE(0x1143da4) CODE(0x11440f4)) at script/my_program.pl
line 11.

BEGIN failed--compilation aborted at script/my_program.pl line 11.

 

I tried the following commands in directory my_project but the error
messages doesn't change:

pp -M my_module.pm -o program.exe my_program.pl

pp -M my_project::my_module -o program.exe my_program.pl

pp -l ./ -o program.exe my_program.pl

 

In my_module I use:

package my_project::my_module;

use FindBin;

use lib $FindBin::Bin;

 

I appreciate any advice! 

Thank you for your help.

 

Regards,

Nele