[11363] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4963 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 26 11:19:48 1999

Date: Fri, 26 Feb 99 08:16:35 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 26 Feb 1999     Volume: 8 Number: 4963

Today's topics:
    Re: Change URL Displays (Greg Ward)
    Re: Change URL Displays <jeromeo@atrieva.com>
        Changing get_basic_auth_pw text <cunningt@primenet.com>
        Chap. 1 of  "Learning perl" <bgarrett@hamilton.net>
    Re: Chap. 1 of  "Learning perl" <tchrist@mox.perl.com>
    Re: Chap. 1 of  "Learning perl" (David Kurtz)
        character to integer <stevent@nagik.cs.colorado.edu>
    Re: character to integer <paladin@uvic.ca>
    Re: character to integer <Allan@due.net>
    Re: character to integer <kenhirsch@myself.com>
    Re: character to integer <jglascoe@giss.nasa.gov>
    Re: character to integer scraig@my-dejanews.com
        check email validy "in real time" (Peter Palfrader)
    Re: check email validy "in real time" (I R A Aggie)
    Re: check email validy "in real time" (Greg Bacon)
    Re: check email validy "in real time" <stampes@xilinx.com>
    Re: check email validy "in real time" (Peter Palfrader)
        coldfusion and/or php ? <otte@mail.cmo.de>
        Compile Perl <kenrose@home.com>
        compiling perl progs to be unreadable <gavin@optus.net.au.dontspam.myass>
    Re: compiling perl progs to be unreadable (Abigail)
    Re: compiling perl progs to be unreadable (I R A Aggie)
    Re: compiling perl progs to be unreadable <Arnold_Mueller@csi.com>
    Re: compiling perl progs to be unreadable <tchrist@mox.perl.com>
    Re: compiling perl progs to be unreadable (Greg Bacon)
    Re: compiling perl progs to be unreadable (I R A Aggie)
    Re: compiling perl progs to be unreadable (Greg Bacon)
        confused about $/ RABM@prodigy.net
    Re: confused about $/ <rick.delaney@home.com>
    Re: confused about $/ RABM@prodigy.net
    Re: confused about $/ <rick.delaney@home.com>
    Re: confused about $/ (Bart Lateur)
    Re: confused about $/ RABM@prodigy.net
    Re: confused about $/ <rick.delaney@home.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 22 Feb 1999 23:31:43 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Change URL Displays
Message-Id: <7aspcv$6hr$2@news0-alterdial.uu.net>

Jonathan Stowe <gellyfish@btinternet.com> wrote:
> > For example :
> > http://www.golfway.com/epga.shtml   I would like the people not to see
> > the portion of epga.shtml.
> > 
> > I would like to accomplish this using Perl, if anyone can help me with
> > this I would greatly appreciate it.
> > 
> 
> A) This cant be done and

Just to quibble, it *can* be done, I think by using frames excessively.
Existence proof: eGroups does it.  It might also be possible with some
evil JavaScript, but who knows (and who cares)?

> B) Even if it could be done it would be nothing to do with Perl.

Absolutely.  You forgot to mention that it's a really annoying thing to
do to a web site, will confuse and alienate users, is contrary to the
open spirit of the web and the Internet, and will generally lead to the
downfall of civilzation as we know it.  ;-)

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


------------------------------

Date: Mon, 22 Feb 1999 16:50:52 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Greg Ward <gward@cnri.reston.va.us>
Subject: Re: Change URL Displays
Message-Id: <36D1FB6C.C30D56A@atrieva.com>

Greg Ward wrote:

> > A) This cant be done and
> 
> Just to quibble, it *can* be done, I think by using frames excessively.
> Existence proof: eGroups does it.  It might also be possible with some
> evil JavaScript, but who knows (and who cares)?

A right click and "Open Frame in New Window" usualy solves things.  Or,
if you are using perl, LWP, and have a ball.

If a document has been transmited to a client, the client *must* know
the URL.

It can't be done.

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


------------------------------

Date: 23 Feb 1999 23:35:33 GMT
From: Thomas Cunningham <cunningt@primenet.com>
Subject: Changing get_basic_auth_pw text
Message-Id: <7ave05$t3b$1@nnrp03.primenet.com>

Hi all,

I'm writing an DBI-based authentication handler in mod_perl. I've read
through the relevant perldocs (Apache, Apache::AuthenDBI,
Apache::AuthzDBI), but I can't figure out how to change the title line on
the dialog box that get_basic_auth_pw returns. Is there an easy way to do
this in the code formy authentication handler, or am I going to have to edit the Apache code
and recompile httpd? 

Thanks for any help you can give me. 


------------------------------

Date: Tue, 23 Feb 1999 20:34:12 -0800
From: Bill Garrett <bgarrett@hamilton.net>
Subject: Chap. 1 of  "Learning perl"
Message-Id: <36D38143.9019C296@hamilton.net>

Does all the code in the first chapter "A stroll through perl" in
"Learning Perl" only work from the shell.
Also,  Someone sent me the address of a place on the net that offered
free shell access.  Could that person please send me that address again.

Thanks,
Jason



------------------------------

Date: 23 Feb 1999 20:08:20 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Chap. 1 of  "Learning perl"
Message-Id: <36d36d24@csnews>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Bill Garrett <bgarrett@hamilton.net> writes:
:Does all the code in the first chapter "A stroll through perl" in
:"Learning Perl" only work from the shell.

As opposed to in your editor?  Say what?

--tom
-- 
"There is no reason for people to have computers in their homes."
			 -- Ken Olsen, president of Digital, 1977


------------------------------

Date: Wed, 24 Feb 1999 03:24:51 -0800
From: david_@ucla.edu (David Kurtz)
Subject: Re: Chap. 1 of  "Learning perl"
Message-Id: <david_-2402990324520001@s188-236.resnet.ucla.edu>

In article <36D38143.9019C296@hamilton.net>, Bill Garrett
<bgarrett@hamilton.net> wrote:

> Does all the code in the first chapter "A stroll through perl" in
> "Learning Perl" only work from the shell.
> Also,  Someone sent me the address of a place on the net that offered
> free shell access.  Could that person please send me that address again.
> 
> Thanks,
> Jason

IIRC, I went through most (all?) of the exercises in Learning Perl (2nd
ed.) without having to do stuff from a command line, if that's what you
mean. I guess it depends on your particular implementation. I was using
MacPerl and it puts up a console window so that you can type line input
for simple programs. What platform are you using Perl on?

-- 
David Kurtz -- remove the underscore from my email address to reply
PGP key and more... http://www.lightside.net/~david/


------------------------------

Date: Tue, 23 Feb 1999 12:02:07 -0700
From: STEVENS  TRAVIS <stevent@nagik.cs.colorado.edu>
Subject: character to integer
Message-Id: <Pine.GHP.4.05.9902231154490.21680-100000@nagik.cs.colorado.edu>

Hello,

I'm a bit confused on this.   I was hoping perl would take care of this
for me, but it doesn't seem to.

I read in a character value from a file.  This charval=008.
I have to keep this 008 but I need an integer representation of this;
So i $intval = $charval; then  $intval =~s/^0*//;
now if I print out $intval it is "8", wich looks very nice.
But later on in the program I say 

if ($intval gt 72){ } 

and it enters in this loop.  Now, the theory is 8 is less than 72.  So is
this
not changing to an int (yeah I know all #'s are floats) so let me
rephrase.

Is $intval a float or a char? 
How can I  fix this problem?

-Trav
stevent@colorado.edu



------------------------------

Date: Tue, 23 Feb 1999 11:53:45 -0800
From: Draco Paladin <paladin@uvic.ca>
To: stevent@colorado.edu
Subject: Re: character to integer
Message-Id: <Pine.A41.4.05.9902231149530.47010-100000@unix3.UVic.CA>

On Tue, 23 Feb 1999, STEVENS  TRAVIS wrote:

<snip>
> But later on in the program I say 
> 
> if ($intval gt 72){ } 
> 
> and it enters in this loop.  Now, the theory is 8 is less than 72.  So is

Yes 8 < 72, but you are using gt which is the string comparison operator
and "8" is greater than "72"

> Is $intval a float or a char? 

$intval is a float or a char depending on the context in which it is used.
If you use it like a float it will act like a float, if you use it like a
string it will act like a string.

stevent@colorado.edu
> 
> 
> 

---------------------------------------------
Mother is the name for GOD on the lips and
hearts of all children.  - Eric Draven



------------------------------

Date: Tue, 23 Feb 1999 15:03:41 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: character to integer
Message-Id: <7av172$e36$1@samsara0.mindspring.com>

STEVENS TRAVIS wrote in message ...
:Hello,
:I'm a bit confused on this.   I was hoping perl would take care of this
:for me, but it doesn't seem to.


Confusion is often a signal of impending learning, congratulations <g>.

:I read in a character value from a file.  This charval=008.
:I have to keep this 008 but I need an integer representation of this;
:So i $intval = $charval; then  $intval =~s/^0*//;
:now if I print out $intval it is "8", wich looks very nice.
:But later on in the program I say
:if ($intval gt 72){ }
:and it enters in this loop.  Now, the theory is 8 is less than 72.  So is
:this
:not changing to an int (yeah I know all #'s are floats) so let me
:rephrase.
:Is $intval a float or a char?


sting, no float, no string, no both, no it depends <g>.

:How can I  fix this problem?

You might want to check out perlop a little more closely.  Especially in the
section entitled Relational Operators where it states:

Binary ``>'' returns true if the left argument is numerically greater than
the right argument.

Binary ``gt'' returns true if the left argument is stringwise greater than
the right argument.

I don't think a stringwise comparision is what you are looking for.  Perl is
really good about figuring out what to do with a string/number but you are
asking it to be a string.  I think the following snippet is illustrative.

$temp = '008';
$temp++;
print $temp,"\n";
    if ($temp < 72) {print "yes\n"}
$temp--;
print $temp;

gives:
009
yes
8

HTH

AmD
--
$email{'Allan M. Due'} = ' Allan@Due.net ';
--random quote --
People get annoyed when you try to debug them.
  Larry Wall





------------------------------

Date: Tue, 23 Feb 1999 14:48:10 -0500
From: "Ken Hirsch" <kenhirsch@myself.com>
Subject: Re: character to integer
Message-Id: <7av0lj$3nt$1@holly.prod.itd.earthlink.net>


STEVENS TRAVIS wrote in message ...
>if ($intval gt 72){ }


gt does a string compare
use ">" instead.

Ken Hirsch
Carrboro, NC







------------------------------

Date: Tue, 23 Feb 1999 15:12:21 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: STEVENS TRAVIS <stevent@nagik.cs.colorado.edu>
Subject: Re: character to integer
Message-Id: <36D30BA5.F975914D@giss.nasa.gov>

[courtesy copy of post sent to Steven]

hi Steven,

STEVENS TRAVIS wrote:
> 
> Hello,
> 

hi Steven,

> So i $intval = $charval; then  $intval =~s/^0*//;
> now if I print out $intval it is "8", wich looks very nice.
> But later on in the program I say
> 
> if ($intval gt 72){ }

If I understand you correctly, you may want to try "($intval > 72)".  

print "8 gt 72 \n" if 8 gt 72;
print "8 > 72 \n"  if 8  > 72;

> Is $intval a float or a char?
> How can I  fix this problem?

I think it can be both at once (internally I mean).


------------------------------

Date: Wed, 24 Feb 1999 01:01:18 GMT
From: scraig@my-dejanews.com
Subject: Re: character to integer
Message-Id: <7avj0o$e52$1@nnrp1.dejanews.com>

In article <Pine.GHP.4.05.9902231154490.21680-100000@nagik.cs.colorado.edu>,
  STEVENS  TRAVIS <stevent@nagik.cs.colorado.edu> wrote:

> if ($intval gt 72){ }
             ^^^^

> Is $intval a float or a char?

  It can be either. Perl will interpret it the way you ask it to.  In this
case, you have asked Perl to compare $intval to "72" as strings.  And "72"
comes before "8".

   You probably want numeric comparison via < .  i.e., $intval < 72 .



-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Thu, 25 Feb 1999 19:52:44 GMT
From: palfrader@usa.net (Peter Palfrader)
Subject: check email validy "in real time"
Message-Id: <36d5a27c.3961186@news.uibk.ac.at>

I just asked myself if and how it was possible to check wheter an
entered email address is valid.


I came to the idea to connect to the smtp-host of the email address'
domain part and ask wheter there exists a user with the entered name.

I do not have any experience with SMTP but I think there must be a way
to find this out since the mail bounce messages always come from "my"
mailserver. and if the mailserver can find out, I should be able to do
so too.


Can anyone tell me if this was possible in perl or if there are mush
smarter solutions than mine. I'm also interested if this is possible
in realtime (i.e. while the user waits for this  ok/not ok  answer)



--
Weasel                               mailto:palfrader@writeme.com
-----------------------------------------------------------------
             "With a rubber duck, one's never alone"
             -- The Hitchhiker's Guide to the Galaxy


------------------------------

Date: 25 Feb 1999 20:43:42 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: check email validy "in real time"
Message-Id: <slrn7dbdkn.pm1.fl_aggie@enso.coaps.fsu.edu>

On Thu, 25 Feb 1999 19:52:44 GMT, Peter Palfrader <palfrader@usa.net> wrote:

+ I came to the idea to connect to the smtp-host of the email address'
+ domain part and ask wheter there exists a user with the entered name.

This is a nice idea. However, some sites turn off vrfy and expn commands.
Some sites will lie like dogs and vrfy anything you feed them.

+ I do not have any experience with SMTP but I think there must be a way
+ to find this out since the mail bounce messages always come from "my"
+ mailserver. and if the mailserver can find out, I should be able to do
+ so too.

The same way the server finds out: it attempts to actually deliver
something.

+ Can anyone tell me if this was possible in perl or if there are mush
+ smarter solutions than mine. I'm also interested if this is possible
+ in realtime (i.e. while the user waits for this  ok/not ok  answer)

What happens if the server is down? Mail delivery agents are patient
enough to try to deliver for several day, if necessary, before
generating a bounce.

No, mail isn't a real-time transport mechanism...

James - even if it seems that fast...


------------------------------

Date: 25 Feb 1999 20:26:13 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: check email validy "in real time"
Message-Id: <7b4bl5$fb9$2@info.uah.edu>

In article <36d5a27c.3961186@news.uibk.ac.at>,
	palfrader@usa.net (Peter Palfrader) writes:
: I just asked myself if and how it was possible to check wheter an
: entered email address is valid.

This is a FAQ.  Please read Section 9 of the Perl FAQ, and pay most
careful attention after reading

    How do I check a valid mail address?

Greg
-- 
Please, Lord, let me prove that winning the lottery won't spoil me.


------------------------------

Date: 25 Feb 1999 20:25:48 GMT
From: Jeff Stampes <stampes@xilinx.com>
Subject: Re: check email validy "in real time"
Message-Id: <7b4bkc$7q3@courier.xilinx.com>

Peter Palfrader <palfrader@usa.net> wrote:
: I just asked myself if and how it was possible to check wheter an
: entered email address is valid.

Don't ask yourself...you don't know.  Ask DejaNews...this topic has
been rehashed ad nauseum here

: I came to the idea to connect to the smtp-host of the email address'
: domain part and ask wheter there exists a user with the entered name.

That's at least better than trying to validate with some lame regex,
but is fraught with it's own perils that you can find discussed in 
the DejaNews threads.

-Jeff

-- 
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


------------------------------

Date: Thu, 25 Feb 1999 22:34:48 GMT
From: palfrader@usa.net (Peter Palfrader)
Subject: Re: check email validy "in real time"
Message-Id: <36d5cfa5.901933@news.uibk.ac.at>

Thanks for the pointers. I'll actually use the send/reply methode now.
(i.e. send a message to the account and the user should then reply the
message as a confirmation. so I also restrict abuse (I hope))


--
Weasel                               mailto:palfrader@writeme.com
-----------------------------------------------------------------
             "With a rubber duck, one's never alone"
             -- The Hitchhiker's Guide to the Galaxy


------------------------------

Date: Tue, 23 Feb 1999 12:50:00 -0000
From: "Steffen" <otte@mail.cmo.de>
Subject: coldfusion and/or php ?
Message-Id: <7au4ns$1fh$1@news4.muc.eurocyber.net>

has had any experience with cold fusion and/or
php. what do you recommend ,and what are the
advantages and pitfalls of each ??

regards, steffen




------------------------------

Date: Thu, 25 Feb 1999 23:09:16 GMT
From: Kenneth Rose <kenrose@home.com>
Subject: Compile Perl
Message-Id: <36D5D7C1.16EC4306@home.com>

Hi all,

OK, here's the scoop.  I have a programming contest on March 2.  I would
like to use Perl for this, but one of the requirements of the program is
you submit an executable.  That is, an EXE file.  Does anyone know of
anyway to compile Perl source code into an EXE?  I'd be using Perl for
Win32.

Thanks to anyone who can help.

/<enneth Rose


------------------------------

Date: Tue, 23 Feb 1999 04:14:38 GMT
From: "Gavin Cato" <gavin@optus.net.au.dontspam.myass>
Subject: compiling perl progs to be unreadable
Message-Id: <OWpA2.6$qp1.412770@news0.optus.net.au>

Hiya,

I know this is against the interests of open source etc.. etc...

I'm consulting for a ISP writing some perl scripts and their requirement is
that their junior sysadmins don't see the source code of these scripts.

As these sysadmins have root access, I can't protect the script with
chmod/grp.

So my question is ; is there a way to "compile" a perl program so that you
can't see the source code? i.e. similar to when you "vi" a binary file.



--

--
Gavin Cato - Optus Network Engineer - gavin@optus.net.au

gawk; talk; date; wine; grep; touch; unzip; touch; gasp; finger; gasp;
mount; \
 fsck; more; yes; gasp; umount; make clean; make mrproper; sleep






------------------------------

Date: 23 Feb 1999 16:30:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: compiling perl progs to be unreadable
Message-Id: <7aul2h$20b$2@client2.news.psi.net>

Gavin Cato (gavin@optus.net.au) wrote on MMII September
MCMXCIII in <URL:news:OWpA2.6$qp1.412770@news0.optus.net.au>:
@@ 
@@ I'm consulting for a ISP writing some perl scripts and their requirement is
@@ that their junior sysadmins don't see the source code of these scripts.


Tell the ISP to get a clue. 



Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


------------------------------

Date: 23 Feb 1999 16:21:04 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: compiling perl progs to be unreadable
Message-Id: <slrn7d5lga.t50.fl_aggie@enso.coaps.fsu.edu>

On Tue, 23 Feb 1999 04:14:38 GMT, Gavin Cato
<gavin@optus.net.au.dontspam.myass> wrote:

+ I'm consulting for a ISP writing some perl scripts and their requirement is
+ that their junior sysadmins don't see the source code of these scripts.

If they don't trust them, then the junior admins should be fired. Security
thru obscurity is a security flaw waiting to be exploited, presuming that
it hasn't already been exploited.

+ So my question is ; is there a way to "compile" a perl program so that you
+ can't see the source code? i.e. similar to when you "vi" a binary file.

And this protects your code how? It isn't going to stop the determined
person.  Do you develop your code on machines these people have access
to? you shouldn't -- they can look at what you're working on.

James


------------------------------

Date: Tue, 23 Feb 1999 16:04:32 +0100
From: "Arnold M|ller" <Arnold_Mueller@csi.com>
Subject: Re: compiling perl progs to be unreadable
Message-Id: <uG6S11zX#GA.131@nih2naac.prod2.compuserve.com>

If windows is enough for you:
I once found a tool called 'perl2exe' oder 'perltoexe' or sth. You will
surely find it via Yahoo etc. It compiles perlscripts. I.e.: it links Perl
and the script to one singel exe-file that runs on systems where no perl is
installed.
Perhaps there are some UNIX-clones, too.
Hope you can find it.

Gavin Cato wrote in message ...
>Hiya,
>
>I know this is against the interests of open source etc.. etc...
>
>I'm consulting for a ISP writing some perl scripts and their requirement is
>that their junior sysadmins don't see the source code of these scripts.
>
>As these sysadmins have root access, I can't protect the script with
>chmod/grp.
>
>So my question is ; is there a way to "compile" a perl program so that you
>can't see the source code? i.e. similar to when you "vi" a binary file.





------------------------------

Date: 23 Feb 1999 08:47:53 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: compiling perl progs to be unreadable
Message-Id: <36d2cda9@csnews>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, after despamming his address and
posting it in public view, "Gavin Cato" <gavin@optus.net.au> writes:

:I know this is against the interests of open source etc.. etc...
:
:I'm consulting for a ISP writing some perl scripts and their requirement is
:that their junior sysadmins don't see the source code of these scripts.
:
:As these sysadmins have root access, I can't protect the script with
:chmod/grp.

You cannot protect yourself from your own company.  If I have
root access, I can do anything, including modify your perl 
interpreter, your perl compiler, or edit your silly binaries.

This is a political problem, not a technical one.

So is your address mungeing, now revealed to the world.

--tom
-- 
The best defense against logic is ignorance.


------------------------------

Date: 24 Feb 1999 16:58:31 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: compiling perl progs to be unreadable
Message-Id: <7b1b3n$6e8$1@info.uah.edu>

In article <OWpA2.6$qp1.412770@news0.optus.net.au>,
	"Gavin Cato" <gavin@optus.net.au.dontspam.myass> writes:
: So my question is ; is there a way to "compile" a perl program so that you
: can't see the source code? i.e. similar to when you "vi" a binary file.

>From <URL:http://www.cs.uah.edu/~gbacon/perl/encrypt>

#! /usr/bin/perl -w

# Copyright (c) 1998 Greg Bacon.  All Rights Reserved.
# This program is free software.  You may distribute it or modify
# it (perhaps both) under the terms of the Artistic License that
# comes with the Perl Kit.

use strict;
use integer;

foreach my $file (@ARGV) {
    unless (open FILE, $file) {
        warn "$0: failed open $file: $!\n";
        next;
    }

    my $key = int rand 256;

    my $out = <<EOTop;
#! /usr/bin/perl

my \$prog = '';

{
    my \$key  = $key;
    local \$/;
 
    \$prog = pack "c*",
             map { \$_ ^= \$key }
             unpack "c*", <DATA>;
}

eval \$prog;
__END__
EOTop

    while (<FILE>) {
        $out .= pack "c*",
                map { $_ ^= $key }
                unpack "c*", $_;
    }
    close FILE;

    unless (open FILE, ">$file") {
        warn "$0: failed open >$file: $!\n";
        next;
    }

    print FILE $out;
    close FILE;;
}

Enjoy,
Greg
-- 
Democracy: Two wolves and a sheep voting on what's for dinner.


------------------------------

Date: 24 Feb 1999 17:29:45 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: compiling perl progs to be unreadable
Message-Id: <slrn7d8dt4.b63.fl_aggie@enso.coaps.fsu.edu>

On 24 Feb 1999 16:58:31 GMT, Greg Bacon <gbacon@itsc.uah.edu> wrote:
+ In article <OWpA2.6$qp1.412770@news0.optus.net.au>,
+ 	"Gavin Cato" <gavin@optus.net.au.dontspam.myass> writes:
+ : So my question is ; is there a way to "compile" a perl program so that you
+ : can't see the source code? i.e. similar to when you "vi" a binary file.
+ 
+ From <URL:http://www.cs.uah.edu/~gbacon/perl/encrypt>

Interesting...nice little toy, but that's about it.

James - security...obscurity...exclusive


------------------------------

Date: 24 Feb 1999 17:49:08 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: compiling perl progs to be unreadable
Message-Id: <7b1e2k$9tn$1@info.uah.edu>

In article <slrn7d8dt4.b63.fl_aggie@enso.coaps.fsu.edu>,
	fl_aggie@thepentagon.com (I R A Aggie) writes:
: Interesting...nice little toy, but that's about it.

Shhhh... :-)

Greg
-- 
I can please only one person per day.
Today is not your day.
Tomorrow isn't looking good either.
    -- Dogbert 


------------------------------

Date: 23 Feb 1999 21:28:34 -0500
From: RABM@prodigy.net
Subject: confused about $/
Message-Id: <uiucssffx.fsf@prodigy.net>


Hi,

I am trying to parse my rmail file (emacs) and am having trouble with
paragraph mode.  If I set the variable to ctrl-_ctrl-L () I get an
error stating "Modification of non-creatable array value attempted,
subscript -1 at e:\bin/pars e_rmail.bat line 66, <RMAIL> chunk 1."

Any help shedding light on this is appreciated.  The code is as follows:


$/="";  # ctrl-_ ctrl-L
my @msgs = ();
open( RMAIL, "$rmail") || die "can't open $rmail $!\n";
while ( <RMAIL> ) {
    push @msgs, {
	SUBJECT => /^Subject:\s*(?:Re:\s*)*(.*)/mi,
	NUMBER  => scalar @msgs,  # which msgno this is
	TEXT    => '',
	} if /^From/m;

    $msgs[-1]{TEXT} .= $_;
}
close RMAIL || die "can't close $rmail $!\n";
for my $msg ( sort {
		    $a->{SUBJECT} cmp $b->{SUBJECT}
				   ||
		    $a->{NUMBER}  cmp $b->{NUMBER}
		} @msgs )
{
    print $msg->{SUBJECT}, "\n";
}

The code is taken completely from the _Perl Cookbook_ except for the
paragraph mode - the part that doesn't work :-(


-vjm


------------------------------

Date: Wed, 24 Feb 1999 03:10:34 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: confused about $/
Message-Id: <36D36F67.9262084B@home.com>

[posted & mailed]

RABM@prodigy.net wrote:
> 
> $/="";  # ctrl-_ ctrl-L

I don't think you can put control characters directly in your code.

Try "\cL" or in this case, "\f".

"\cx" is the way to write control-x in Perl.  This is documented in
perlre which you might easily have missed since $/ has nothing to do
with regular expressions.

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: 24 Feb 1999 20:29:36 -0500
From: RABM@prodigy.net
Subject: Re: confused about $/
Message-Id: <uiucrp8xr.fsf@prodigy.net>

>>>>> "Rick" == Rick Delaney <rick.delaney@home.com> writes:

    Rick> [posted & mailed]
    Rick> RABM@prodigy.net wrote:
    >> 
    >> $/="";  # ctrl-_ ctrl-L

    Rick> I don't think you can put control characters directly in your code.

    Rick> Try "\cL" or in this case, "\f".

    Rick> "\cx" is the way to write control-x in Perl.  This is documented in
    Rick> perlre which you might easily have missed since $/ has nothing to do
    Rick> with regular expressions.

I tried it where the value is \c_\cL and \c_\f with the same result.  To
test to see if I wasn't loosing my mind, I did $/="\n\n" and, of course,
this works.

To further confuse the issue I did a perl -pi.bak "s/\c_\L/#VJM#/"
MAIL.tmp.  Then I ran the script with $/="#VJM#" as the input record
separator.  Basically it just slurped the file in as if $/ was undefined.
Go figure.

-- vjm



------------------------------

Date: Thu, 25 Feb 1999 03:29:20 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: confused about $/
Message-Id: <36D4C56B.6A4F5D22@home.com>

[posted & mailed]

RABM@prodigy.net wrote:
> 
> I tried it where the value is \c_\cL and \c_\f with the same result.  

I missed the ctrl-_ the first time but what you tried should work.

[snip]

> To further confuse the issue I did a perl -pi.bak "s/\c_\L/#VJM#/"
                                                          ^^
                  Did you really do this or did you have \cL?

Try running this:

    #!/usr/local/perl -w
    # temp.pl

    if (@ARGV) {
        $/ = "\c_\cL";
        $\ = "\n";
        while(<>){ chomp; print }
    }
    else {
        $\ = "\c_\cL";
        for (1..3) { print }
    }

$ perl -w temp.pl > temp.txt
$ perl -w temp.pl   temp.txt
1
2
3
$

Maybe your data doesn't have ctrl-_?.  Try an octal or hex dump and set
$/ to whatever octal or hex value you actually have.

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: Thu, 25 Feb 1999 09:26:06 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: confused about $/
Message-Id: <36d61615.4027979@news.skynet.be>

RABM@prodigy.net wrote:

>I am trying to parse my rmail file (emacs) and am having trouble with
>paragraph mode.  If I set the variable to ctrl-_ctrl-L () I get an
>error stating "Modification of non-creatable array value attempted,
>subscript -1 at e:\bin/pars e_rmail.bat line 66, <RMAIL> chunk 1."

Paragraph mode? Is that, where there is at least one empty line?
According to perlvar:

	Setting $/ to "" will treat two or more consecutive empty lines
        as a single empty line.


BTW what Ascii code is "ctrl-_"? Control characters using "\c" only go
from "a" to "z". Use the literal Ascii code instead, and it might work.

   HTH,
   Bart.


------------------------------

Date: 25 Feb 1999 20:56:37 -0500
From: RABM@prodigy.net
Subject: Re: confused about $/
Message-Id: <uzp62lyga.fsf@prodigy.net>

>>>>> "Bart" == Bart Lateur <bart.lateur@skynet.be> writes:

    Bart> RABM@prodigy.net wrote:
    >> I am trying to parse my rmail file (emacs) and am having trouble with
    >> paragraph mode.  If I set the variable to ctrl-_ctrl-L () I get an
    >> error stating "Modification of non-creatable array value attempted,
    >> subscript -1 at e:\bin/pars e_rmail.bat line 66, <RMAIL> chunk 1."

    Bart> Paragraph mode? Is that, where there is at least one empty line?
    Bart> According to perlvar:

Correct $="", or perl -w -00 is paragraph mode.  I meant to say input
record separator. Your answer of using the literal Ascii code instead gets
me past the "Modification of non-creatable..." error message.  Thanks.

    Bart> 	Setting $/ to "" will treat two or more consecutive empty lines
    Bart>         as a single empty line.

Now my problem is I only get one large array if I set the $/ that way. What
I really want is to have it like paragraph mode in the sense that when I do

    # ctrl-_ctrl-L
    $/="\025\010"; while (<RMAIL>) { push @msg, {...} if /^From/m }

the ctrl-_ctrl-L is the beginning/end of each message.  I can't figure out,
even in the debugger, what is going on with the input record separator. The
file is set up like:

ctrl-_ctrl-L   # record 1 start
Subject: I wish my program worked
From: me@somewhere.com
:
:
ctrl-_ctrl-L   # record 2 start
Subject: $/ doesn't give weird error with \025\010
From: me@somewhere.com
:

-- Vinny


------------------------------

Date: Fri, 26 Feb 1999 03:17:47 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: confused about $/
Message-Id: <36D61435.7F1453B0@home.com>

[posted & mailed]

RABM@prodigy.net wrote:
> 
> Now my problem is I only get one large array if I set the $/ that way. 

Now you're going to have to show some of your actual code.  What array?

> What I really want is to have it like paragraph mode in the sense that 
> when I do
> 
>     # ctrl-_ctrl-L
>     $/="\025\010"; while (<RMAIL>) { push @msg, {...} if /^From/m }
> 
> the ctrl-_ctrl-L is the beginning/end of each message.

That sets the record separator to "\025\010".  Let's refer to it as this
from now on.  I don't know what system you're on, but that's "\cu\ch" on
mine.

For your enlightenment/amusement (and Bart's):

    for ('a' .. 'z', qw/ [ ] \\\\ ^ _ ` /) {
        printf "%s %o\n", eval qq/'$_', ord("\\c$_")/;
    }

Okay, try this:

$/ = "\025\010";
$\ = "***END OF RECORD HERE***\n\n";
while (<>) { chomp; print }

If you get something like this then your input record separator is set
the way you want and you can move on to processing the records.

***END OF RECORD HERE***

Subject: I wish my program worked
From: me@somewhere.com
:
:
***END OF RECORD HERE***

Subject: $/ doesn't give weird error with \025\010
From: me@somewhere.com
:

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4963
**************************************

home help back first fref pref prev next nref lref last post