Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Obscure

by $code or die (Deacon)
on Oct 25, 2001 at 21:28 UTC ( [id://121498]=note: print w/replies, xml ) Need Help??


in reply to Obscure

It's a bit hard to follow what you're code is doing here. Did you run it through obscure.pl before you posted? I ask because it's difficult to follow with all your short variable names.

However, I am assuming that you didn't run the code through obscure.pl before posting. Because if you had, it wouldn't compile.

An oft heard comment in the perl community is "Only perl can parse Perl". Your code will break a lot of scripts (and it does indeed break your own). The bit where you strip comments beginning with '##' will break a regex like $foo =~ s#bar## and a string like my $foo = ' bar ## more things here '; and a lot of other legitimate perl code. Removing comments is difficult in perl without breaking things.

Your best bet if you want to do something like this is to use one of the Filter::* modules. Take a look at Filter::Simple which is designed to make writing source filters easy.

Simon Flack ($code or die)
$,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
=~y'_"' ';eval"die";print $_,lc substr$@,0,3;

Replies are listed 'Best First'.
Re: Re: Obscure
by JimE (Initiate) on Nov 25, 2001 at 21:45 UTC
    Thanks, Simon, for the feedback. I probably should have noted more clearly in the intro the kind of limitations with '##' that you note. Obscure certainly won't work in its present form for everyone or every script, including itself -- this is one script I haven't needed or deliberately intended to obscure. I see what you mean about the $t, $a, $b etc. -- these are probably a little to brief and do need improvement. On the other hand if you follow what, for me at least, are the relatively unrestrictive rules noted there you have a quick solution for code protection on new stuf you write and much that is already written. For instance, in not stripping a single '#' string unless followed by a space, html color attributes, many text contstructs, etc. that include it have worked out so far for me (100K lines.) (This rule also allows you to leave comments in the obscured script should you wish by simply leaving out a space after '#', as well as accepting the $# construct for array size, etc.) I did look at Filter but found it to be more complicated and time consuming than I needed for my coding style.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://121498]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-23 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found