Re: Unrecognized character

2005-02-04 Thread the.noonings
Augusto Flavio wrote:
Hi!
I'm have a big problem. I make a module(pm) and now i
want compile this module. I tried use the perlcc but i
receive the msg that the module can't be compiled
because have shared libs.
However i found a module, PAR(Perl Archive Toolkit)
which can compile my module. Then, i was to install
this module(PAR). After the instalation of module i
run the command:
$ pp -o compiled.pm -M Exporter module.pm
ps.: The module.pm just require the lib Exporter.
I not have problems with the compilation. Then the
next step would be execute a script (CGI) that use the
compiled module.
I open my firefox and make run the script(CGI).
Unhappyly i get this msg: 
Unrecognized character \x7F at compiled.pm line 1.

Which i do? Have something wrong with the method of
compilation? Is someone that used the module PAR and
can help me? 

Thanks for all.
ps.: Sorry for my english

Augusto Flavio



	
		
__ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

 

Are you working in a Windows variant?  If so, Windows will not just 
execute something with a '.pm' extension.  Try just using

  pp -o compiled.exe main_perl_file.pl
Notice in your example below you have .pm twice:
pp -o compiled.pm -M Exporter module.pm
I use compiled.exe because that would be the name of the executable I would 
be trying to create.  I use perl_file.pl because that is the perl code I would want the 
compiled executable to be created from.
Also, I use Exporter quite often in my modules, and I NEVER have to use '-M Exporter'.  Try making your line just 
   
  pp -o compiled.exe main_perl_file.pl

Internal to each perl module that I use, where I want to export subroutines 
(NOT in the .pl file!) I have something like this:
package my_package;
use Exporter;
@ISA = qw(Exporter);
@EXPORT = ( subroutine_1,
subroutine_2,
...
subroutine_N,
  );
Good luck





Re: Unrecognized character

2005-02-04 Thread Augusto Flavio
Good morning,



Are you saying to me that i can't compile a module
(extension .pm)? I'm look a method to compile my
module(.pm). Can i do this with the pp? 

Have some way to obfuscate the code of a module?


Thanks for all



Augusto Flavio





___ 
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. 
http://br.acesso.yahoo.com/ - Internet rápida e grátis


Re: Unrecognized character

2005-02-04 Thread the.noonings
Augusto Flavio wrote:
Good morning,

Are you saying to me that i can't compile a module
(extension .pm)? I'm look a method to compile my
module(.pm). Can i do this with the pp? 

Have some way to obfuscate the code of a module?
Thanks for all

Augusto Flavio
	
	
		
___ 
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet rápida e grátis

 

I am not saying you cannot compile a module.  I suppose you can compile 
anything you want.  However, a perl module by itself presumably has no 
entry points, except as defined with Exporter (ie the subroutine entry 
points), as given to the invoking main perl file when it uses the use 
module_name; directive presumably near the top of the file. 

If you wrote the module correctly, invoking the module from the command 
line should give you ... nothing.  Well, almost nothing.  All such Perl 
modules must return a '1' value at the end or the syntax checker would 
complain.  Hence executing a compiled .pm file would simply return a '1'.

I have a feeling there is some miscommunication going on here.  To 
clarify things, here is a paste of the file my_module.pm and my_main.pl, 
and pp -o aa.exe my_module.pm which is a rather useless endeavor.
--paste of my_module.pm
package my_module;

use Exporter;
@ISA = qw(Exporter);
@EXPORT = ( my_print );
sub my_print {
 my ($message) = @_;
 print $message;
}
1;
end paste
paste of my_main.pl
use my_module;
my_print(Hello\n);
---end paste
pp -o aa.exe my_module.pm
aa.exe

(Notice above that nothing happens when aa.exe is executed)
Now let me compile my_main.pl
pp -o aa.exe my_main.pl
aa.exe
Hello

(Notice that Hello was printed out)
I hope this helps.






Re: Unrecognized character

2005-02-04 Thread Alan Stewart
On 4 Feb 2005 at 11:45, Augusto Flavio wrote:

 Good morning,
 
 
 
 Are you saying to me that i can't compile a module
 (extension .pm)? I'm look a method to compile my
 module(.pm). Can i do this with the pp? 
 
 Have some way to obfuscate the code of a module?
 
 

The purpose of PAR is to create a standalone executable program, from a script 
and all 
of it's required modules. It does not compile individual files in the classic 
meaning 
of compiling binary code. It packages files together (creates a compilation 
of 
files).

Running:

pp -o compiled.pm module.pm

will not create something that will allow you to:

use compiled;

in another Perl script. The output of pp -o is a standalone executable 
program. You 
can use pp to compile your entire cgi script as a .exe, which will then include 
module.pm:

pp -o my_cgi.exe my_cgi_script.pl

Also, if you really want obfuscation, you need to use a PAR obfuscation filter, 
like:

pp -f Bleach

or:

pp -f Bytecode

By default, PAR packages can be read with any zip file utility. Even so, 
obfuscation 
only slows down the determined hacker. It won't stop him.

Alan Stewart