[18576] in Perl-Users-Digest
Perl-Users Digest, Issue: 744 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 23 06:05:31 2001
Date: Mon, 23 Apr 2001 03:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <988020306-v10-i744@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 23 Apr 2001 Volume: 10 Number: 744
Today's topics:
Re: 'Do', config files and strict <taka@yarn.demon.co.uk>
Re: Another regexp question <ocschwar@mit.edu>
Re: Another regexp question <ocschwar@mit.edu>
Re: CGI.pm difference between 5.6.0 and 5.6.1 (Alan Barclay)
Re: Comparison of Time <kienyeny@uci.edu>
Re: Daemon: should the parent exit or _exit after the f <pne-news-20010423@newton.digitalspace.net>
Re: Idiom: the expression of a copied & substituted str <johnlin@chttl.com.tw>
Re: Idiom: the expression of a copied & substituted str (Dave Bailey)
Perl::Gtk and Glade questions... <one-nine@iprimus.com.au>
Re: pointer/reference question (Andrew J. Perrin)
Re: pointer/reference question (Logan Shaw)
Re: pointer/reference question <xris@dont.send.spam>
Re: Problems with sending a sms <bart.lateur@skynet.be>
Re: regexp matching with optional part <ronald.fischer.gp@icn.siemens.de>
Re: regexp matching with optional part <ronald.fischer.gp@icn.siemens.de>
Re: regexp matching with optional part <uri@sysarch.com>
Re: removing the \n from the data obtained from a text <kalin@thinrope.net>
Re: use Filter::decrypt; How to encrypt source code fi <johnlin@chttl.com.tw>
Re: use Filter::decrypt; How to encrypt source code fi (Anno Siegel)
Re: use Filter::decrypt; How to encrypt source code fi <johnlin@chttl.com.tw>
Re: use Filter::decrypt; How to encrypt source code fi <pne-news-20010423@newton.digitalspace.net>
Visual perl installation <gold123@netvision.net.il>
WebForm Processing With File Attachments. <station@nursat.kz>
Re: Whooo Hillary in '04 <uri@sysarch.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Apr 2001 13:41:36 +0100
From: Paul the Nomad <taka@yarn.demon.co.uk>
Subject: Re: 'Do', config files and strict
Message-Id: <87d7a5cdj3.fsf@euterpe.yarn.demon.co.uk>
nobull@mail.com writes:
> Paul the Nomad <taka@yarn.demon.co.uk> writes:
>
> > Recipe 8.16 in the Perl Cookbook says that you can make a config file
> > by using do to pull in a file of raw perl. I thought I'd do this for
> > a small script I'm writing to format some html seeing as I'm the only
> > person who'll be using it. However, it's behaving a bit oddly.
> >
> > In the main script I go:
> >
> > do 'links.conf';
> >
> > Links.conf contains code which looks like this:
> >
> > %links = ( link1 => 'A link', link2 => 'Another link');
> >
> > It works, but it behaves strangely.
> >
> > If in the main script I use strict it complains about %links. If,
> > however, I declare it 'my %links', the do does not pull in the hash
> > properly and %links is undefined.
>
> my() declares variables as _lexically_ scoped. That means the name
> %links is associated with a given variable only within the enclosing
> block of source code. (Ignoring the evil that is eval()).
>
> Now read "perldoc -f do" paying particular note to where it mentions
> lexical variables. It explains that do() complies and exeuctes a file
> in a separate lexical scope.
>
> Use global variables (change my() to our()) or use the return value of
> do().
>
> my %links = do 'links.conf';
>
> Links.conf contains code which looks like this:
>
> link1 => 'A link', link2 => 'Another link';
Thanks, I think I'll do it like this.
Cheers,
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
--
-----------
Paul
http://www.seditiousdiaries.com/Donald10.html
------------------------------
Date: 22 Apr 2001 23:05:54 -0400
From: Omri Schwarz <ocschwar@mit.edu>
Subject: Re: Another regexp question
Message-Id: <octae585n8t.fsf@mint-square.mit.edu>
Joe Schaefer <joe+usenet@sunstarsys.com> writes:
> "Ciaran McCreesh" <keesh@users.pleaseremovethisbit.sourceforge.net> writes:
>
> > In article <9bvaua$7i9$1@charity.cs.utexas.edu>, logan@cs.utexas.edu
> > wrote:
> > >>/^[a-zA-Z0-9]([a-zA-Z0-9:]*[a-zA-Z0-9])?$/ will work I think.
> > >
> > > It seems cleaner to do this:
> > >
> > > /^[a-zA-Z0-9](:[a-zA-Z0-9]*)*$/
er, /^[a-zA-Z0-9](:[a-zA-Z0-9]+)*$/, right?
> >
> > Nested stars scare me :) Probably because I've seen so many people do
> > things like /([aeiou]*)*/ , I always worry that I'll mess up. IIRC, Perl
> > dies if you try, but I've used languages which will give an infinite loop
> > in that situation.
> >
> > Yeah, OK, I'm paranoid...
>
> In this case, your paranoia may have served you well since Logan's regexp
> does not meet OP's requirements. In particular, it matches a string
> like 'abc:', which OP specifically stated was undesirable. For a
> correct and elegent solution, see Tad's followup.
--
Omri Schwarz ---
Timeless wisdom of biomedical engineering:
"Noise is principally due to the presence of the
patient." -- R.F. Farr
------------------------------
Date: 22 Apr 2001 23:24:47 -0400
From: Omri Schwarz <ocschwar@mit.edu>
Subject: Re: Another regexp question
Message-Id: <oct1yqk5mdc.fsf@mint-square.mit.edu>
Omri Schwarz <ocschwar@mit.edu> writes,
showing his lack of mojo:
> Joe Schaefer <joe+usenet@sunstarsys.com> writes:
>
> > "Ciaran McCreesh" <keesh@users.pleaseremovethisbit.sourceforge.net> writes:
> >
> > > In article <9bvaua$7i9$1@charity.cs.utexas.edu>, logan@cs.utexas.edu
> > > wrote:
> > > >>/^[a-zA-Z0-9]([a-zA-Z0-9:]*[a-zA-Z0-9])?$/ will work I think.
> > > >
> > > > It seems cleaner to do this:
> > > >
> > > > /^[a-zA-Z0-9](:[a-zA-Z0-9]*)*$/
>
> er, /^[a-zA-Z0-9](:[a-zA-Z0-9]+)*$/, right?
>
er, no, /^[a-zA-Z0-9]+(:[a-zA-Z0-9]+)*$/, right?
--
Omri Schwarz ---
Timeless wisdom of biomedical engineering:
"Noise is principally due to the presence of the
patient." -- R.F. Farr
------------------------------
Date: 23 Apr 2001 04:25:46 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: CGI.pm difference between 5.6.0 and 5.6.1
Message-Id: <987999945.281974@elaine.furryape.com>
In article <3AE363C1.183BD483@ttsg.com>, Tuc <tuc@ttsg.com> wrote:
>warnings. When I went to 5.6.1, all the warnings leave, but the
>following CGI snip acts
>differently. The script is:
It looks like the default mode has been changed. By default,
debugging in CGI.pm version 2.753 accepts command line paramaters,
but does not prompt for STDIN.
If you make your program:
#!/usr/local/bin/perl
use CGI qw/-debug/;
$tcgihandle = new CGI;
print "Done\n";
Then you'll enable reading from stdin and get the behaviour you expect.
This is documentation, the only hit on 'offline', both hits on 'standard
input', and in the section titled "DEBUGGING".
------------------------------
Date: Sun, 22 Apr 2001 19:37:27 -0700
From: "KY" <kienyeny@uci.edu>
Subject: Re: Comparison of Time
Message-Id: <9c04je$mte$1@news.service.uci.edu>
After reading thru the FAQ, still cannot figure out.
Can someone help to edit my code?
<nobull@mail.com> wrote in message news:u966fxb3xn.fsf@wcl-l.bham.ac.uk...
> "KY" <kienyeny@uci.edu> writes:
>
> > I wrote the code to output the time of 2 servers but now need to compare
> > their time & output the time difference between them.
>
> FAQ: "How can I compare two dates and find the difference?"
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: Mon, 23 Apr 2001 10:06:41 +0200
From: Philip Newton <pne-news-20010423@newton.digitalspace.net>
Subject: Re: Daemon: should the parent exit or _exit after the fork?
Message-Id: <9io7et0uvp5cctvabgdgj68ho15thvarvr@4ax.com>
On Sun, 22 Apr 2001 01:49:39 GMT, garry@ifr.zvolve.net (Garry
Williams) wrote:
> On Thu, 19 Apr 2001 20:25:51 +0200, Philip Newton
> <pne-news-20010419@newton.digitalspace.net> wrote:
>
> > I'm writing a daemon in Perl and am wondering whether I need to call
> > exit or _exit (well, POSIX::_exit) in the parent after the fork.
>
> If you check the exit(2) manual page, you find that _exit(2) will not
> flush open output streams or call the registered atexit(3) functions.
> I suppose I can't think of a reason you would want this behavior, but
> that's the difference.
For example, because you don't want the child's output streams (which
it shares with the parent) to be flushed along with the parent's
streams when it calls exit()? Probably makes things less confusing.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Mon, 23 Apr 2001 09:32:12 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: Idiom: the expression of a copied & substituted string
Message-Id: <9c00ma$97a@netnews.hinet.net>
"John Joseph Trammell" wrote
> John Lin wrote:
> > I would like to learn the idiomatic way of expressing this:
> >
> > my $original = 'Good %, sir.';
> > my $copied1 = 'Good morning, sir.'; # s/%/morning/;
> > my $copied2 = 'Good afternoon, sir.'; # s/%/afternoon/;
>
> I don't know about idiomatic, but why not use [s]printf if the
> substitution is that simple?
>
> my $template = "Good %s, sir.\n";
> my $one = sprintf $template, "morning";
> my $two = sprintf $template, "afternoon";
Ho, ho, ho. Sorry, it twists my question. Not a template problem.
Another example is:
my $original = 'hello-world.pl';
rename $original => do { (my $dummy = $original) =~ s/\.pl$/.bak/; $dummy };
Is there an idiomatic expression (shorter, cleaner) to say
"The string that is made from replacing $original's '.pl' and end with '.bak'"
(The do{} here is cumbersome.)
Thank you.
John Lin
------------------------------
Date: 23 Apr 2001 03:19:11 GMT
From: dave@sydney.daveb.net (Dave Bailey)
Subject: Re: Idiom: the expression of a copied & substituted string
Message-Id: <slrn9e6tgt.7ti.dave@sydney.daveb.net>
On Mon, 23 Apr 2001 09:32:12 +0800, John Lin <johnlin@chttl.com.tw> wrote:
>"John Joseph Trammell" wrote
>> John Lin wrote:
>> > I would like to learn the idiomatic way of expressing this:
>> >
>> > my $original = 'Good %, sir.';
>> > my $copied1 = 'Good morning, sir.'; # s/%/morning/;
>> > my $copied2 = 'Good afternoon, sir.'; # s/%/afternoon/;
>>
>> I don't know about idiomatic, but why not use [s]printf if the
>> substitution is that simple?
>>
>> my $template = "Good %s, sir.\n";
>> my $one = sprintf $template, "morning";
>> my $two = sprintf $template, "afternoon";
>
>Ho, ho, ho. Sorry, it twists my question. Not a template problem.
>Another example is:
>
>my $original = 'hello-world.pl';
>rename $original => do { (my $dummy = $original) =~ s/\.pl$/.bak/; $dummy };
>
>Is there an idiomatic expression (shorter, cleaner) to say
>"The string that is made from replacing $original's '.pl' and end with '.bak'"
>(The do{} here is cumbersome.)
The definition of 'idiomatic' is 'in accordance with the particular
nature of a language'. With Perl, there are so many ways to address
the two examples that you gave that it is difficult to point at one
of them and say "this one is idiomatic, and the rest of them are not
characteristically Perl-ish ways of solving the problem". For example,
most people would use sprintf in the situation you presented in your
first post. That may not have pleased you, but it is the most common
and shortest answer to the specific question you asked. In that
sense it may be considered idiomatic, even though sprintf has its
origins elsewhere. For your next question, if you simply wish to
rename all the .pl files in your current directory to .bak files,
you could do something like:
while (<*>) { s/^((.*?)\.pl)$/rename$1,$2.'.bak'/e }
But you may have been trying to do something slightly different,
which required you to rename the files in a list:
map { s/^((.*?)\.pl)$/rename$1,$2.'.bak'/e } @files;
But perhaps you wanted to save the files in the list instead of
clobbering them like the above code fragment does. Then you might
want:
map { s/^((.*?)\.pl)$/rename$1,$2.'.bak';$1/e } @files;
Or maybe you wanted to know if your renames succeeded or failed,
so you'd like to save the error string if there was one:
map { s/^((.*?)\.pl)$/(rename$1,$2.'.bak')?$1:"$_: $!"/e } @files;
The point is, what exactly is "idiomatic" depends to a large extent
on the particular details involved. If you change your question
just a little bit, you may find yourself with a completely
different set of answers, even though the underlying element of
pattern matching and substitution remains.
--
Dave Bailey
davidb54@yahoo.com
------------------------------
Date: Mon, 23 Apr 2001 14:37:55 +0930
From: "Jayson Hay" <one-nine@iprimus.com.au>
Subject: Perl::Gtk and Glade questions...
Message-Id: <3ae3b8c4$1@news.iprimus.com.au>
Hello All!
I am wondering if there are any Perl Gtk and/or Glade users on this list?
Is there a more appropriate list?
Thanks for your help.
Jay
------------------------------
Date: 22 Apr 2001 20:32:24 -0500
From: andrew_perrin@unc.edu (Andrew J. Perrin)
Subject: Re: pointer/reference question
Message-Id: <87k84c7653.fsf@nujoma.perrins>
xris <xris@dont.send.spam> writes:
> I guess as I think more about this, my main question is whether or not
> you can do something to the extent of:
>
> $x = $$x;
>
> but NOT copy the value, which I'm pretty sure this does (takes a copy of
> the value at $$x and stores it in $x, as opposed to assigning $x the
> same memory location as the data in $$x).
>
Forgive me if I'm missing what you're asking, but doesn't a simple
$x=$y;
do what you're asking? That is,
$foo = 'foo';
$y = \$foo; # $y is now a reference to the memory where 'foo'
# is stored
$x = $y; # $x is now also a reference to the memory where 'foo'
# is stored
Cheers,
Andy
--
----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology
(Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill)
andrew_perrin@unc.edu - http://www.unc.edu/~aperrin
------------------------------
Date: 22 Apr 2001 22:39:35 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: pointer/reference question
Message-Id: <9c085n$9h7$1@charity.cs.utexas.edu>
In article <87k84c7653.fsf@nujoma.perrins>,
Andrew J. Perrin <andrew_perrin@unc.edu> wrote:
>xris <xris@dont.send.spam> writes:
>
>> I guess as I think more about this, my main question is whether or not
>> you can do something to the extent of:
>>
>> $x = $$x;
>>
>> but NOT copy the value, which I'm pretty sure this does (takes a copy of
>> the value at $$x and stores it in $x, as opposed to assigning $x the
>> same memory location as the data in $$x).
>>
>
>Forgive me if I'm missing what you're asking, but doesn't a simple
>
>$x=$y;
>
>do what you're asking? That is,
>
>$foo = 'foo';
>$y = \$foo; # $y is now a reference to the memory where 'foo'
> # is stored
>$x = $y; # $x is now also a reference to the memory where 'foo'
> # is stored
I think what the original poster wants is for Perl references to behave
like C++ references (i.e. for them to be syntactically like regular
values by semantically like pointers) but without tweaking the symbol
table. I don't think that's likely to happen.
I can understand the reasoning -- in C++ it's easy to not have to worry
about whether a function's parameter is a const reference or a const
value. In most cases, they are indistinguishable (except one doesn't
have to get copied), and they *look* the same too.
Basically, I can imagine where it would take a little adjustment to get
used to not having this convenience, but that's the way Perl works and
it's not really a bad thing once you get used to it.
- Logan
--
my your his her our their _its_
I'm you're he's she's we're they're _it's_
------------------------------
Date: Sun, 22 Apr 2001 23:01:50 -0500
From: xris <xris@dont.send.spam>
Subject: Re: pointer/reference question
Message-Id: <xris-2BAAF9.23015022042001@news.evergo.net>
In article <9c085n$9h7$1@charity.cs.utexas.edu>,
logan@cs.utexas.edu (Logan Shaw) wrote:
> I think what the original poster wants is for Perl references to behave
> like C++ references (i.e. for them to be syntactically like regular
> values by semantically like pointers) but without tweaking the symbol
> table. I don't think that's likely to happen.
yeah, I think this is more what I'm after.. a world in which:
\$x = \$y;
works. :) oh well, just wanted to make sure that I really CAN'T do
that, and that I wasn't just doing something wrong.
and in answer to the aforementioned "$x=$y" thing, that copies the data,
not the reference. I'm, I guess, looking for that C/C++ functionality
where I can havevariables called $x and $y (not $$x or $$y or whatever -
I know how to manage with those things) that both access the same data
space, so that:
$x = 1;
...somehow assign \$y=\$x...
$y++;
print $x;
results in "2"...
but I guess that isn't going to happen any time in the future, so I'll
stop dreaming and get back to actually writing code. :)
Thanks for all the help, everyone.
-Chris
------------------------------
Date: Mon, 23 Apr 2001 09:58:08 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Problems with sending a sms
Message-Id: <t6v7et85jsmf3el1d5d3fnbir3o8u28lbg@4ax.com>
Tad McClellan wrote:
>>The only thing I have to say to my posting is now: Just forget it!
>
>Too late. You've already been killfiled.
>
>>Sorry...
>
>Names go into the killfile, but they don't come out.
I don't get it. How can you respond to this message if you killfiled the
author?
--
Bart.
------------------------------
Date: 23 Apr 2001 08:40:51 +0200
From: Ronald Fischer <ronald.fischer.gp@icn.siemens.de>
Subject: Re: regexp matching with optional part
Message-Id: <7qfvgnwyv7w.fsf@icn.siemens.de>
"Jonas Nilsson" <jonni@ifm.liu.se> writes:
> > x-abc-x -> return abc
> > x-foo -> return foo
> > bar-x -> return bar
> > baz -> return baz
> > x--x -> fail
> >
> > Can this be done easily in a single regexp? The closest I came was
> >
> > /^(x-)?(.+?)(-x)$/
>
> if /^(x-)?(.+?)(-x)?$/ {$result=$2} else {&fail};
This does not work for $_ eq "x--x". In this case, it succeeds and sets
$2 to "-x" (because it x- matches the first part and -x matches .+).
Ronald
--
Ronald Otto Valentin Fischer < rovf @ earthling . net >
http://profiles.yahoo.com/ronny_fischer/
http://fusshuhn.ourfamily.com/cppincomp.html
This is Unix land. In quiet nights you can hear Windows machines reboot.
------------------------------
Date: 23 Apr 2001 08:44:24 +0200
From: Ronald Fischer <ronald.fischer.gp@icn.siemens.de>
Subject: Re: regexp matching with optional part
Message-Id: <7qfsnj0yv1z.fsf@icn.siemens.de>
"Wyzelli" <wyzelli@yahoo.com> writes:
> "Ronald Fischer" <ronald.fischer.gp@icn.siemens.de> wrote in message
> news:7qfwv8gq6pk.fsf@icn.siemens.de...
> >
> > I'm trying to write a regexp matching which should cut off an optional
> leading
> > "x-" or trailing "-x". the following cases:
> >
> > In any case, the extracted part (after cutting off the leader or trailer)
> > should consist of at least one character; otherwise, the regexp should
> > fail. Example:
> >
> > x-abc-x -> return abc
> > x-foo -> return foo
> > bar-x -> return bar
> > baz -> return baz
> > x--x -> fail
> >
> > Can this be done easily in a single regexp? The closest I came was
> >
> > /^(x-)?(.+?)(-x)$/
>
> Change the + to a * and you need the last -x to be optional as well.
/^(x-)?(.*?)(-x)?$/ does not work either, because it causes $_ eq "x--x"
to succeed (setting $2 to the empty string).
Probably this really can't be done in a single regexp...
Ronald
--
Ronald Otto Valentin Fischer < rovf @ earthling . net >
http://profiles.yahoo.com/ronny_fischer/
http://fusshuhn.ourfamily.com/cppincomp.html
This is Unix land. In quiet nights you can hear Windows machines reboot.
------------------------------
Date: Mon, 23 Apr 2001 07:03:29 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: regexp matching with optional part
Message-Id: <x7wv8chzcp.fsf@home.sysarch.com>
>>>>> "RF" == Ronald Fischer <ronald.fischer.gp@icn.siemens.de> writes:
>> "Ronald Fischer" <ronald.fischer.gp@icn.siemens.de> wrote in message
>> news:7qfwv8gq6pk.fsf@icn.siemens.de...
>> >
>> > I'm trying to write a regexp matching which should cut off an optional
>> leading
>> > "x-" or trailing "-x". the following cases:
>> >
>> > In any case, the extracted part (after cutting off the leader or trailer)
>> > should consist of at least one character; otherwise, the regexp should
>> > fail. Example:
>> >
>> > x-abc-x -> return abc
>> > x-foo -> return foo
>> > bar-x -> return bar
>> > baz -> return baz
>> > x--x -> fail
RF> Probably this really can't be done in a single regexp...
what is your failure test? this strips the strings and you can test for
failure afterwards:
assume the input is in $_
s/^x-|-x$//g && $_
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Mon, 23 Apr 2001 17:09:44 +0900
From: Kalin Kozhuharov <kalin@thinrope.net>
Subject: Re: removing the \n from the data obtained from a text area in a form
Message-Id: <3AE3E348.C923FC9B@thinrope.net>
Richard Antreasian wrote:
>
> I want to store a text area from a form in a flat file as a single line.
> Everytime a carrige return is present another line is created in the file.
> I tried to replace all \n by subsituting \n with <p> using a regular expression
> $data{thestory}=~s/\n/<P>/g;
> This dosent seem to make the text into one line,
> for example like this:
>
> First sentence.
> Second sentence.
>
> yields
>
> First sentence<p>
> Second sentence<p>
>
> instead of First sentence<p>Second sentence<p>
>
> Can anybody help me?
What about looking at the chop() and even better chomp() finctions?
Kalin.
--
||///_ o *******************************
||//,_/> WWW: http://ThinRope.Net/
|||\ <"
|||\\ ' *******************************
------------------------------
Date: Mon, 23 Apr 2001 10:19:01 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: use Filter::decrypt; How to encrypt source code first?
Message-Id: <9c03av$ffh@netnews.hinet.net>
"Anno Siegel" wrote
> According to John Lin:
> > For a program
> > print "Hello, world!\n";
> > I want to use Filter::decrypt, how shall I encrypt it first? To get
> > use Filter::decrypt;
> > JoYfkfGsQiLto # this line is the encrypted 'print "Hello, world!\n";'
> I suppose you're expected to look through the source
The source (of Filter::decrypt) is terribly simple:
bootstrap Filter::decrypt ;
It comes with a decrypt.dll only, so I think it's no hope to read its source
and know its algorithm.
Wait a minute... Actually I have known what's going wrong here:
All Unix version Filter::* packages are shipped with a "encrypt",
except for Win32 version. The ActiveState filter.zip doesn't contain
"encrypt" at all. Then how could I know the way to use Filter::decrypt? : (
Thank you.
John Lin
------------------------------
Date: 23 Apr 2001 03:14:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: use Filter::decrypt; How to encrypt source code first?
Message-Id: <9c06nd$kqj$1@mamenchi.zrz.TU-Berlin.DE>
According to John Lin <johnlin@chttl.com.tw>:
> "Anno Siegel" wrote
> > According to John Lin:
> > > For a program
> > > print "Hello, world!\n";
> > > I want to use Filter::decrypt, how shall I encrypt it first? To get
> > > use Filter::decrypt;
> > > JoYfkfGsQiLto # this line is the encrypted 'print "Hello, world!\n";'
> > I suppose you're expected to look through the source
>
> The source (of Filter::decrypt) is terribly simple:
> bootstrap Filter::decrypt ;
> It comes with a decrypt.dll only, so I think it's no hope to read its source
> and know its algorithm.
No, you don't understand. The module isn't ready to use, you are
supposed do download the whole thing, XS source and all, study it,
and write your own.
If you do that, you will soon discover, that the decryption mechanism
that is implemented by default (and *not* supposed to be used) is
it's own encryption: It is simply an xor of sufficiently many copies
of the string "Perl" with the source code. Two bytes of magic complete
the encryption:
my $code = 'print "Hello, world!\n";';
my $key = 'PerlPerlPerlPerlPerlPerl';
my $cryptmagic = "\xff\x00";
print $cryptmagic;
print $code ^ $key;
Run this to generate the "Hello world" you're after, but be aware
that there's more to it to make it even a bit secure.
Anno
------------------------------
Date: Mon, 23 Apr 2001 15:24:46 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: use Filter::decrypt; How to encrypt source code first?
Message-Id: <9c0l89$q9t@netnews.hinet.net>
"Anno Siegel" wrote
> You are supposed do download the whole thing, XS source and all, study it,
> and write your own.
Thank you. What I tried to say in the previous post was: "The Win32 version is
just partial, so I was mislead, I was unable to figure out what happened. Now I
download the Unix version which is complete, so I can study and know it better.
> Be aware that there's more to it to make it even a bit secure.
OK, I'll follow up the document and the FAQ. Thank you.
John Lin
Hey, as long as you write your own module to decrypt the source,
the crackers can study your .pm file to write a decryptor easily.
Even if your own module is XS and compiled, they can still easily just
use YourDecryptor;
to write a decryptor program (even without knowing your algorithm).
Am I right?
------------------------------
Date: Mon, 23 Apr 2001 11:46:38 +0200
From: Philip Newton <pne-news-20010423@newton.digitalspace.net>
Subject: Re: use Filter::decrypt; How to encrypt source code first?
Message-Id: <2du7et4toucshutpesivj0vvfpf5ve6j84@4ax.com>
On Mon, 23 Apr 2001 15:24:46 +0800, "John Lin" <johnlin@chttl.com.tw>
wrote:
> Hey, as long as you write your own module to decrypt the source,
> the crackers can study your .pm file to write a decryptor easily.
> Even if your own module is XS and compiled, they can still easily just
> use YourDecryptor;
> to write a decryptor program (even without knowing your algorithm).
> Am I right?
Depends on what you mean with a "decryptor program". If it's a source
filter, then perl (the interpreter) will see the source, but you
won't. So it doesn't really help you.
Having said that, see `perldoc perlsec` (or, equivalently, `perldoc -q
"hide the source"`) for a short discussion on how secure encryption
via source filters is.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Sun, 22 Apr 2001 15:52:10 +0200
From: "Ofir Goldberger" <gold123@netvision.net.il>
Subject: Visual perl installation
Message-Id: <9buk2s$al5$1@news.netvision.net.il>
I have tried installing ActiveState's visual perl (after having installed
all the dependencies like VisualStudio.NET etc.) I get an error message that
tells me the file I downloaded from ActiveSate is not a valid msi file.
I am working on Win2000 SP1.
Does anyone have a clue as to what is wrong ?
------------------------------
Date: Mon, 23 Apr 2001 14:32:40 +0600
From: "CitruSoft" <station@nursat.kz>
Subject: WebForm Processing With File Attachments.
Message-Id: <9c0mbn$s0h$7@proxy2.nursat.net>
What is Mail-A-File ?
Mail-A-File is a web-based email program (written in Perl) with file
attachment features. The program allows any user to send an email from a
web-based form to any recipient with a valid email address plus the ability
to attach a file to the email message. This is a great feature to add to
both business and personal web sites.
It Features:
+ No PERL knowledge to install
+ 4 step configuration, installs in minutes
+ Easy to modify Variables
+ Indicate required fields for data entry completeness
+ E-mail format validation on sender
+ Unlimited number of different forms can be called from this one script
+ Up to of 2 files attachments
+ And more...
If you interested please email me:
station@nursat.kz?subject=Web_Form_Processing
Andrew
WebDeweloper
CitruSoft - Software for the Internet
------------------------------
Date: Mon, 23 Apr 2001 04:54:31 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Whooo Hillary in '04
Message-Id: <x7zod8i5bm.fsf@home.sysarch.com>
and your perl question is?
uri
<groups narrowed>
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 744
**************************************