[18569] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 737 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 21 18:06:12 2001

Date: Sat, 21 Apr 2001 15:05:09 -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: <987890709-v10-i737@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 21 Apr 2001     Volume: 10 Number: 737

Today's topics:
    Re: (do not read, only a test) <hafner-usenet@ze.tu-muenchen.de>
    Re: Append <vtbowes@superaje.com>
    Re: Append (E.Chang)
    Re: Append <keesh@users.pleaseremovethisbit.sourceforge.net>
        Comparison of Time <kienyeny@uci.edu>
    Re: File path not getting resolved correctly. <farber@cpan.org>
    Re: GD/TrueType weirdness (CODE SAMPLE) <jdpepin@optonline.net>
    Re: Getting character codes (echo 'Rudolf Polzer'>/dev/null)
    Re: Getting character codes (Logan Shaw)
        help with htaccess <andrew.fase@btinternet.com>
    Re: Is it a hash or not? (echo 'Rudolf Polzer'>/dev/null)
        Make test error installing 5.6.1 <sbicknel@prodigy.net>
        Most popular membership management for small sites? (Richard Wilkerson)
    Re: Multi dimensional array dimensions (Anno Siegel)
    Re: Perl as scripting language for C app (Anno Siegel)
    Re: Silly User Friendly module...any interest to put it <mmorency@wpi.edu>
    Re: Silly User Friendly module...any interest to put it (echo 'Rudolf Polzer'>/dev/null)
    Re: Things I'm just not getting in Perl (echo 'Rudolf Polzer'>/dev/null)
    Re: Things I'm just not getting in Perl (Anno Siegel)
    Re: Things I'm just not getting in Perl (echo 'Rudolf Polzer'>/dev/null)
    Re: Things I'm just not getting in Perl (Damian Conway)
    Re: Things I'm just not getting in Perl (Anno Siegel)
    Re: use Filter::decrypt;  How to encrypt source code fi (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 21 Apr 2001 23:52:35 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: (do not read, only a test)
Message-Id: <srjitjx9azg.fsf@w3proj1.ze.tu-muenchen.de>

abigail@foad.org (Abigail) writes:

>     If you do your testing over in alt.test, your acne will clear up, your
>     compiles will run in half the time, and you will become irresistible to
>     the opposite sex.  Much good karma will accrue to you and the Usenet gods
>     will smile.
> 
>     If you post tests HERE, small boys will taunt your mother, you'll be
>     unable to mount your CD even as root, and strangers will cross the
>     street to kick your dog.
> 
>     In other words, THIS AIN'T A FLIPPING TEST GROUP!!!
>                  (Kevin Martin)

*LOL*

If I knew Kevin Martin, and he came my way one day, I'd buy him a drink
for these lines!

-Walter


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

Date: Sat, 21 Apr 2001 15:46:13 -0500
From: "Tom Bowes" <vtbowes@superaje.com>
Subject: Re: Append
Message-Id: <yslE6.18342$u7.7847996@e3500-chi1.usenetserver.com>


<nobull@mail.com> wrote in message news:u9wv8ebgvj.fsf@wcl-l.bham.ac.uk...
> "Tom Bowes" <vtbowes@superaje.com> writes:
>
> > <nobull@mail.com> wrote in message
news:u9hezid05x.fsf@wcl-l.bham.ac.uk...
> > > "Tom Bowes" <vtbowes@superaje.com> writes:
> > >
> > > > use cgi ':standard';
> > > > open (APPEND, ">>messages.htm") or die "$! error trying to append";
> > > > print APPEND "Name:";
> > > > print APPEND (param('name'));
> > > > print APPEND (param('message'));
> > > >
> > > > what is wrong with this the variables will not append to the file?
> > >
> > > This is not the actual code you are running is it?  I can tell that
> > > because there's a typo that would cause it to fail to
> > > compile.
> >
> > This is the code I am running I am a newbie and can not see the typo o
if
> > you can point it out it would be of great help
>
> Actually it would not be a great help.  I would be re-enforcing
> incorrect behaviour.
>
> Much better that you try to run the script and see what error it
> generates.
>
> Sooner or later you are going to have to start looking at error
> messages and working out what's wrong.
>
> Anyhow, I did, tell you that you'd got the case of a filename wrong.
> Clearly I couldn't know what case you'd used for you file
> "messages.htm" so there's only one other filename I could be talking
> about.  If you can't spot another filename in your code then perhaps
> you should lookup what use() does.
>
> --
>      \\   ( )
>   .  _\\__[oo
>  .__/  \\ /\@
>  .  l___\\
>   # ll  l\\
>  ###LL  LL\\

how can I get the dos window that opens and says the error to stay open. I
can tell their is an error but it opens and closes to fast for me to see it.
Jeff





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

Date: Sat, 21 Apr 2001 20:27:54 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Append
Message-Id: <Xns908AA7128B7C7echangnetstormnet@207.106.93.86>

"Tom Bowes" <vtbowes@superaje.com> wrote in
<yslE6.18342$u7.7847996@e3500-chi1.usenetserver.com>: 


>how can I get the dos window that opens and says the error to stay open.
>I can tell their is an error but it opens and closes to fast for me to
>see it. Jeff
>

Open a DOS window first and change to the directory containing your script.   
You should be able to run your script by entering the command "perl 
scriptname" -- with your own scriptname, of course.

Look very carefully at the source where you got the line "use cgi 
':standard';".  I think you will see that you did not type it _exactly_ the 
same way.

-- 
EBC


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

Date: Sat, 21 Apr 2001 20:59:32 +0100
From: "Ciaran McCreesh" <keesh@users.pleaseremovethisbit.sourceforge.net>
Subject: Re: Append
Message-Id: <9bsooi$eef$1@newsg1.svr.pol.co.uk>

In article <yslE6.18342$u7.7847996@e3500-chi1.usenetserver.com>, "Tom
Bowes" <vtbowes@superaje.com> wrote:
> how can I get the dos window that opens and says the error to stay open.
> I can tell their is an error but it opens and closes to fast for me to
> see it. Jeff

Either use Linux (oops, or any other real^H^H^H^H operating system) and
run it in a terminal, or get a MESS-DRO$ box up from the start menu, type
in perl.exe filename.pl and watch.

It's now time for some smart remark about qualifications, except that I
anticipate about twenty people abusing me about this post already :)

Ciaran

-- 
Ciaran McCreesh
mail:    keesh@users.sourceforge.net
web:     http://www.opensourcepan.com/


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

Date: Sat, 21 Apr 2001 12:01:41 -0700
From: "KY" <kienyeny@uci.edu>
Subject: Comparison of Time
Message-Id: <9bslgt$s54$1@news.service.uci.edu>


Hi All,
I wrote the code to output the time of 2 servers but now need to compare
their time & output the time difference between them.
Below is the code written but I can't seem to get it working.
Pls help.
-----------------------------------------
use IO::Socket;
my $SERVICE = "daytime";
for my $host (qw(ABC.com)) {
 my $c = IO::Socket::INET->new("$host:$SERVICE")
  or warn("Can't connect to $host: $@"), next;
 my $result = <$c>;
}
for my $host (qw(123.com)) {
 my $c = IO::Socket::INET->new("$host:$SERVICE")
  or warn("Can't connect to $host: $@"), next;
 my $result1 = <$c>;
 my $answer = $result - $result1;
 print $answer;
}
-------------------------------

Thanks
Regards,
KY





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

Date: Sun, 22 Apr 2001 00:33:12 +0200
From: Alex Farber <farber@cpan.org>
To: tmerenes@sybase.com
Subject: Re: File path not getting resolved correctly.
Message-Id: <3AE20AA8.DAD1D65A@cpan.org>

tmerenes.dontspam@sybase.com wrote:
> 
> I'm running MKS perl in a WinNT 4.0 SP 6a DOS session.
> 
> The file path in the following statement does not get resolved correctly:
> 
> system ("isql -SDB2SOL -Utmerenes -PCOGRULES
> -iD:\DC\12.00.03\236669\repro.sql");

Why do you call isql instead of using DBD::Sybase?


-- 
http://home.t-online.de/home/Alexander.Farber/


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

Date: Sat, 21 Apr 2001 21:55:30 GMT
From: "Joseph Pepin" <jdpepin@optonline.net>
Subject: Re: GD/TrueType weirdness (CODE SAMPLE)
Message-Id: <mlnE6.16427$Xr.3074391@news02.optonline.net>

There's a bug in libgd that seems to have returned in 1.8.4 and 2.0.x, in
that if a font has multiple character maps, only the first will be used.  In
some Windows fonts (most notably the Symbols, WingDings and WebDings) the
first character map is blank, and the actual glyphs are in the second
character map.  There's a simple fix for this, if you have source and can
re-compile libgd: e-mail me for the details.





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

Date: Sat, 21 Apr 2001 21:03:21 +0200
From: rpolzer@durchnull.de (echo 'Rudolf Polzer'>/dev/null)
Subject: Re: Getting character codes
Message-Id: <slrn9e3mbp.gv7.rpolzer@www42.t-offline.de>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to Peter Reid  <peter.reid2000@ntlworld.com>:
> > Does anyone know how to get the character code of a letter (eg X is 88)
> > and also how to get a letter from its code ????
> 
> ord() and chr().

Oh no, I always used pack and unpack for this :( 

-- 
#!/usr/bin/perl -W -- WARNING: This copies a random file from
use strict;my$s;my$n=0;for # the  current  directory  to your 
(<*>){++$n;int rand$n or$s # signature  file.   Use  at  your
=$_};`cp $s ~/.signature`; # own risk! (c) 2001 Rudolf Polzer


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

Date: 21 Apr 2001 16:15:37 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Getting character codes
Message-Id: <9bst9p$3vs$1@charity.cs.utexas.edu>

In article <slrn9e3mbp.gv7.rpolzer@www42.t-offline.de>,
echo 'Rudolf Polzer'>/dev/null <null@durchnull.de> wrote:
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> According to Peter Reid  <peter.reid2000@ntlworld.com>:
>> > Does anyone know how to get the character code of a letter (eg X is 88)
>> > and also how to get a letter from its code ????
>> 
>> ord() and chr().
>
>Oh no, I always used pack and unpack for this :( 

That's sort of silly, but not nearly silly enough, I think.  If you do
this:

	$mapping = join ("", map (chr, 0 .. 255));

Then you can use

	$code = index($mapping, $character);

and

	$character = $mapping[$code];

  - Logan
-- 
my  your   his  her   our   their   _its_
I'm you're he's she's we're they're _it's_


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

Date: Sat, 21 Apr 2001 18:54:54 +0100
From: "Andy" <andrew.fase@btinternet.com>
Subject: help with htaccess
Message-Id: <9bsho0$esn$1@uranium.btinternet.com>

I'm trying to write a script which can add users to my .htaccess and .htpass
files, whats the easiest ways of doing this?

Bearing in mind i'm only using a hosted web server...not sure if i can set
my script to have higher privilages than "noone" can I ? .....

Any help appreciated even if its a link to a tutorial on this sort of thing

Cheers

Andy





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

Date: Sat, 21 Apr 2001 20:35:45 +0200
From: rpolzer@www42.t-offline.de (echo 'Rudolf Polzer'>/dev/null)
Subject: Re: Is it a hash or not?
Message-Id: <slrn9e3ko1.c68.rpolzer@www42.t-offline.de>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> The elevated ranks of the Perl Order tend to overlook how close the
> sin of symrefs is to the ordinary being.

There are not many reasons to use symlinks, and AFAIK all such cases 
could be handled using 'evil eval'.

Try:

% { eval ('\%' . $hashname) } = (A => 1);

instead of

%$hashname = (A => 1);

Both do the same, but the first one is bloated. The same thing was 
done from C to C++, where 'C-style casts' are a reason for warnings 
and the reinterpret_cast<type>(value) notation was introduced for 
unsafe typecasts - why not eliminate symrefs the same way?
So nothing will be lost when removing symlinks from Perl - nothing 
except variables like ${'Kewl I can use spaces in a variable name'} 
and %{'$A + 3 - 5'}. Security? Variable names can be easily checked 
for safety by a regex and allowing only names that match 
/^[A-Za-z]\w*$/ because they should be eval-safe.

-- 
#!/usr/bin/perl -W -- WARNING: This copies a random file from
use strict;my$s;my$n=0;for # the  current  directory  to your 
(<*>){++$n;int rand$n or$s # signature  file.   Use  at  your
=$_};`cp $s ~/.signature`; # own risk! (c) 2001 Rudolf Polzer


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

Date: Fri, 20 Apr 2001 15:29:09 -0700
From: Scott Bicknell <sbicknel@prodigy.net>
Subject: Make test error installing 5.6.1
Message-Id: <9bqcsq$38a6$1@newssvr05-en0.news.prodigy.com>

Hi,

I am having trouble upgrading Perl from 5.6.0 to 5.6.1 on Linux kernel 
2.4.0. Everything is fine until I run make test. I get one error:

        lib/odbm.../perl: error while loading shared libraries:
                ../lib/auto/ODBM_File.so:
                undefined symbol: dbminit FAILED at test 0

ODBM_File.so is a binary file, so looking there for a clue about any 
undefined symbols seems fruitless.

I'm scratching my head looking at the INSTALL document's "make test" 
section and the t/README file is no help either. I checked the news 
archives and found a post with a similar problem, but there were no 
replies. And the Perl FAQ only refers me back to the INSTALL document.

Does anyone have a solution to this problem?

Scott


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

Date: Sat, 21 Apr 2001 20:14:28 GMT
From: rcwilk@dreamgate.com (Richard Wilkerson)
Subject: Most popular membership management for small sites?
Message-Id: <3ae1e9b5.16803767@news.telocity.com>

Hi,

 I need a simple membership management system for my site.  Nothing
fancy, no database isp, just a perl.  sign up, get in.  members
managne their own password stuff. maybe I get to approve via email
notification. 

  I have tried a couple of systems, but have been unhappy with the
installation.  I was wondering what the most popular freeware used ?

~~~~~~ as long as I'm wishing, anyone have something installed on
hypermart or shellx.ba.best.com   ? 


 many thanks,
Richard 


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

Date: 21 Apr 2001 19:07:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Multi dimensional array dimensions
Message-Id: <9bslqe$ltd$5@mamenchi.zrz.TU-Berlin.DE>

According to  <nobull@mail.com>:

[...]
 
> I bet even most Perl programmers couldn't with certainty what the
> semantics of a slice are in a scalar context without checking.

Why?  A slice is a list, which evaluates to its last element in
scalar context.

If asked directly I'd have to admit that I *did* check.

Anno


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

Date: 21 Apr 2001 18:18:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl as scripting language for C app
Message-Id: <9bsiso$ltd$3@mamenchi.zrz.TU-Berlin.DE>

According to Martin Craig <mcra98@esc.cam.ac.uk>:
> Hi,
> 
> Apologies if there's already good documentation on this elsewhere - I 
> couldn't find it.
> 
> I have a C application & want to use Perl as a scripting language. I was 
> going to use Guile, but I don't think the people I'm aiming it at are
> likely to know this language, wheras Perl looks ideal. I've read about how
> to embed a perl interpreter in C, however I need to make some of my C
> functions available to the embedded perl. Is there something like
> gh_new_procedure() to do this?
> 
> I have read about calling C libraries from perl, but this is a running
> program, not a library, so I'm not clear about if I can use this.

Well, you could *put* the routines that have to be called from both
Perl and C in a library and use the standard approach.  That involves
writing an XS module to interface Perl to your routines and use'ing
the module to make your routines available.  The equivalent of the
XS-generated code must be somewhere if you want to call C functions
from Perl.

There may be a shortcut approach where you include the XS-generated
code in your source, but I'm not sure if I want to know about it...

Anno


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

Date: Sat, 21 Apr 2001 16:12:44 -0400
From: Matthew Morency <mmorency@wpi.edu>
Subject: Re: Silly User Friendly module...any interest to put it on CPAN?
Message-Id: <3AE1E9BC.B72C1260@wpi.edu>

Personally I think that that would be cool.
    --Matt Morency

Zenin wrote:

> Being a User Friendly fan (www.userfriendly.org for the uninitiated), I
> hacked a quick module up to help me automate setting my desktop wallpaper to
> the UF cartoon of the day.  Would anyone else be interested in it?  If so,
> I'll upload it to CPAN.  For now, Silly::UserFriendly can be found at:
>
>         ftp://thrush.omix.com/pub/perl/modules/Silly-UserFriendly-1.001.tar.gz
>
> Enjoy...
>
> --
> -Zenin (zenin@rhps.org)                   From The Blue Camel we learn:
> BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
> Berkeley or thereabouts.  Similar in many ways to the prescription-only
> medication called "System V", but infinitely more useful. (Or, at least,
> more fun.)  The full chemical name is "Berkeley Standard Distribution".



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

Date: Sat, 21 Apr 2001 23:26:04 +0200
From: rpolzer@durchnull.de (echo 'Rudolf Polzer'>/dev/null)
Subject: Re: Silly User Friendly module...any interest to put it on CPAN?
Message-Id: <slrn9e3unc.tqp.rpolzer@www42.t-offline.de>

Matthew Morency <mmorency@wpi.edu> wrote:
> Personally I think that that would be cool.
>     --Matt Morency
> 
> Zenin wrote:
> 
> > Being a User Friendly fan (www.userfriendly.org for the uninitiated), I
> > hacked a quick module up to help me automate setting my desktop wallpaper to
> > the UF cartoon of the day.  Would anyone else be interested in it?  If so,
> > I'll upload it to CPAN.  For now, Silly::UserFriendly can be found at:
> >
> >         ftp://thrush.omix.com/pub/perl/modules/Silly-UserFriendly-1.001.tar.gz

Why is this a module?

-- 
#!/usr/bin/perl -W -- WARNING: This will print 22,307 bytes! <strictsafe!>
use strict;for(my$y=-1;$y<1;$y+=.1){for(my$x=-1.9;$x<.4;$x+=.03){print'+';
my$X=my$Y=0;for(0..99){($X,$Y)=($X*$X-$Y*$Y+$x,2*$X*$Y+$y);print"\b "if$X*
$X+$Y*$Y>9;}}print"\n"};print''.reverse"\nHPAJ \a!rezloP .R yb torblednaM"


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

Date: Sat, 21 Apr 2001 20:37:59 +0200
From: rpolzer@www42.t-offline.de (echo 'Rudolf Polzer'>/dev/null)
Subject: Re: Things I'm just not getting in Perl
Message-Id: <slrn9e3ks7.c68.rpolzer@www42.t-offline.de>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to Damian Conway <damian@cs.monash.edu.au>:
> 
> [...]
>  
> > Or just use the special C<< 1-print >> built-in:
> > 
> > 	do { print "enter a number: " }
> > 		until ($response)=<>=~/^(\d+)$/
> > 		   or 1-print "No, stupid, ";
> 
> The 1-print operator has been deemed unsafe.  Use the newer !print.

Why exactly? Isn't true always returned as 1 in boolean functions?

-- 
#!/usr/bin/perl -W -- WARNING: This copies a random file from
use strict;my$s;my$n=0;for # the  current  directory  to your 
(<*>){++$n;int rand$n or$s # signature  file.   Use  at  your
=$_};`cp $s ~/.signature`; # own risk! (c) 2001 Rudolf Polzer


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

Date: 21 Apr 2001 18:50:33 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Things I'm just not getting in Perl
Message-Id: <9bskpp$ltd$4@mamenchi.zrz.TU-Berlin.DE>

According to echo 'Rudolf Polzer'>/dev/null <null@durchnull.de>:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > According to Damian Conway <damian@cs.monash.edu.au>:
> > 
> > [...]
> >  
> > > Or just use the special C<< 1-print >> built-in:
> > > 
> > > 	do { print "enter a number: " }
> > > 		until ($response)=<>=~/^(\d+)$/
> > > 		   or 1-print "No, stupid, ";
> > 
> > The 1-print operator has been deemed unsafe.  Use the newer !print.
> 
> Why exactly? Isn't true always returned as 1 in boolean functions?

What boolean function?  "print" is part of an arithmetic expression.

Anno


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

Date: Sat, 21 Apr 2001 23:23:45 +0200
From: rpolzer@durchnull.de (echo 'Rudolf Polzer'>/dev/null)
Subject: Re: Things I'm just not getting in Perl
Message-Id: <slrn9e3uj0.tqp.rpolzer@www42.t-offline.de>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to echo 'Rudolf Polzer'>/dev/null <null@durchnull.de>:
> > Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > > According to Damian Conway <damian@cs.monash.edu.au>:
> > > 
> > > [...]
> > >  
> > > > Or just use the special C<< 1-print >> built-in:
> > > > 
> > > > 	do { print "enter a number: " }
> > > > 		until ($response)=<>=~/^(\d+)$/
> > > > 		   or 1-print "No, stupid, ";
> > > 
> > > The 1-print operator has been deemed unsafe.  Use the newer !print.
> > 
> > Why exactly? Isn't true always returned as 1 in boolean functions?
> 
> What boolean function?  "print" is part of an arithmetic expression.

OK, the other way round.

1-print is evaluated in boolean context =>
print is evaluated in numeric context =>
true for OK is casted to 1 =>
1-1 is calculated =>
the result is false (boolean context).

-- 
#!/usr/bin/perl -W -- WARNING: This will print 22,307 bytes! <strictsafe!>
use strict;for(my$y=-1;$y<1;$y+=.1){for(my$x=-1.9;$x<.4;$x+=.03){print'+';
my$X=my$Y=0;for(0..99){($X,$Y)=($X*$X-$Y*$Y+$x,2*$X*$Y+$y);print"\b "if$X*
$X+$Y*$Y>9;}}print"\n"};print''.reverse"\nHPAJ \a!rezloP .R yb torblednaM"


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

Date: 21 Apr 2001 21:27:07 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Things I'm just not getting in Perl
Message-Id: <9bstvb$hu6$1@towncrier.cc.monash.edu.au>

rpolzer@durchnull.de (echo 'Rudolf Polzer'>/dev/null) writes:

>> > > The 1-print operator has been deemed unsafe.  Use the newer !print.
>> > 
>> > Why exactly? Isn't true always returned as 1 in boolean functions?
>> 
>> What boolean function?  "print" is part of an arithmetic expression.

>OK, the other way round.

>1-print is evaluated in boolean context =>
>print is evaluated in numeric context =>
>true for OK is casted to 1 =>
>1-1 is calculated =>
>the result is false (boolean context).

Anno's simply pointing out that, although perlfunc states that C<print>
returns a true value, it doesn't guarantee what that true value is.
Jarkko would be within his rights to change it in 5.8.0 to return the
string C<"this will teach Conway not to dispense ironic advice on c.l.p.m">.

The point is: Anno's C<!print> operator would continue to work in that
situation.

Thanks, Anno. It's always good to be reminded how careful one should be
when manipulating Perl booleans.

Damian 


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

Date: 21 Apr 2001 21:31:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Things I'm just not getting in Perl
Message-Id: <9bsu83$2go$1@mamenchi.zrz.TU-Berlin.DE>

According to echo 'Rudolf Polzer'>/dev/null <null@durchnull.de>:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > According to echo 'Rudolf Polzer'>/dev/null <null@durchnull.de>:
> > > Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > > > According to Damian Conway <damian@cs.monash.edu.au>:
> > > > 
> > > > [...]
> > > >  
> > > > > Or just use the special C<< 1-print >> built-in:
> > > > > 
> > > > > 	do { print "enter a number: " }
> > > > > 		until ($response)=<>=~/^(\d+)$/
> > > > > 		   or 1-print "No, stupid, ";
> > > > 
> > > > The 1-print operator has been deemed unsafe.  Use the newer !print.
> > > 
> > > Why exactly? Isn't true always returned as 1 in boolean functions?
> > 
> > What boolean function?  "print" is part of an arithmetic expression.
> 
> OK, the other way round.
> 
> 1-print is evaluated in boolean context =>
> print is evaluated in numeric context =>
> true for OK is casted to 1 =>
> 1-1 is calculated =>
> the result is false (boolean context).

No, that's not the way context propagates, even supposing "boolean
context" actually exists in Perl.  "Boolean" is really a property of
some operators (which otherwise provide scalar context) to look only
at the boolean value of an expression.  The "-" operator is none of
these, so if one day print() decides to return something else for
success the result may be different.

Anno


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

Date: 21 Apr 2001 20:55:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: use Filter::decrypt;  How to encrypt source code first?
Message-Id: <9bss4j$ltd$6@mamenchi.zrz.TU-Berlin.DE>

According to John Lin <johnlin@chttl.com.tw>:
> Dear all,
> 
> 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";'

Well, the documentation says, first thing:

       This is a sample decrypting source filter.

       Although this is a fully functional source filter and it
       does implement a very simple decrypt algorithm, it is not
       intended to be used as it is supplied. Consider it to be a
       template which you can combine with a proper decryption
       algorithm to develop your own decryption filter.

So I suppose you're expected to look through the source and supply
your own decryption method (in which case you would know how to
do the corresponding encryption).  The source is where I'd look to
see if there's an encryption method supplied, or if it can be
derived from the code.

Anno


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

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 737
**************************************


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