Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

OK, I'm not a serious perl programmer, however I am working with one who has suddenly insisted that all off our "cool" code on the web server (which will be installed at the client site) must be compiled so that no one figures out what we are doing. So, assuming that an HTML front end, about the only thing I can see for IIServer is to go to .NET so that we can do perlscript. But as far as compiling perl modules to be accessed as function calls from within the perlscript, my question is "how do we compile, link in and access these functions on the web server?" If anyone can point me to a reference I'm more than happy to RTFM, but not knowing much about perl I really need to cut to the chase on the if and how this is doable. Thanks. --Jim
  • Comment on Accessing complied perl on a web server

Replies are listed 'Best First'.
Re: Accessing complied perl on a web server
by Nitrox (Chaplain) on Dec 17, 2002 at 04:41 UTC
    You have the option of "compiling" your perl code into an ActiveX control, then you'll just be providing the client with the created .dll file.

    Since you mentioned an IIS server, it would be very simple to throw together small ASP pages to call your "cool" routines.

    Dim Obj as Object Set Obj = CreateObject("ProgID_of_your_Perl_DLL.app") Obj.CoolRoutine

    Update:
    It was late when I first posted this so forgive me for not providing a pure Perl solution. This is PERLmonks after all and it ate at me so bad that I climbed back out of bed to add this to my post:

    Once the .dll is on the server and registered properly you can call it via you Perl CGI scripts by adding:

    use Win32::OLE; my $obj = Win32::OLE->CreateObject('ProgID_of_your_Perl_DLL.app'); $obj->CoolRoutine();
    -Nitrox
Re: Accessing complied perl on a web server
by tachyon (Chancellor) on Dec 17, 2002 at 09:27 UTC

    Active State's PerlApp will genrerate a Windows executable from a perl script by bundling it with the perl executable. It does hide your code and if you decompile the app the raw perl code is not immediately visible. Some of us did post a node or two about how to crack scripts out of this (pretty easy) so don't think it is particularly secure because it is not. It will stop the casual but not the determined. I would advise a solid contract along with the usual back doors and other *security features* you might add to ensure you can screw your client if they try to screw you ;-)

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Accessing complied perl on a web server
by chromatic (Archbishop) on Dec 17, 2002 at 03:40 UTC

    Hire a good system administrator to configure your web server properly so that users won't see your "cool" code. :)

Re: Accessing complied perl on a web server
by pfaut (Priest) on Dec 17, 2002 at 03:15 UTC

    I'm afraid you're SOL. Perl is an interpreted language. Although there are options available for obfuscating code, you have to provide your sources to perl to get them to run. If you insist on providing binaries only, you'll have to find another way to code your web site.

    --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
Re: Accessing complied perl on a web server
by CountZero (Bishop) on Dec 17, 2002 at 06:34 UTC

    Strange, ... None of the dynamic webpages I wrote can be seen by the user. All my programs either result in pure HTML or provide XML which is then server-side transformed into HTML, again providing only HTML to the client.

    Can you point me to a web-site you guys wrote which sends Perl-code to the browser? I assume you are not talking about Perlscript being run on the browser?

    Update: Sorry, I read past the part that says the code is deployed on the client's web-site. In that case, the solution is to have a good contract with the client to protect your copyright. Oops, my training as a lawyer is showing.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Accessing complied perl on a web server
by slife (Scribe) on Dec 17, 2002 at 14:03 UTC

    The bottom line is as given by tachyon and CountZero, though you should read
    perldoc perlfaq3 How can I hide the source for my Perl program? for the reasons why.