[30918] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2163 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 27 06:09:43 2009

Date: Tue, 27 Jan 2009 03:09:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 27 Jan 2009     Volume: 11 Number: 2163

Today's topics:
    Re: How to select international text characters in a re <peter@makholm.net>
    Re: How to select international text characters in a re <amosyoffe@gmail.com>
        How to select international text characters in a regula <amosyoffe@gmail.com>
    Re: How to select international text characters in a re <peter@makholm.net>
    Re: I need a job in C/C++/Perl immediately. Telecomute  <jurgenex@hotmail.com>
        Including files (again) <marieregine@advalvas.be>
    Re: inputting the ephemerides <uri@stemsystems.com>
        new CPAN modules on Tue Jan 27 2009 (Randal Schwartz)
    Re: Perl Peeves (Tim McDaniel)
    Re: Perl Peeves (Tim McDaniel)
    Re: Perl Peeves (Tim McDaniel)
    Re: Perl Peeves <uri@stemsystems.com>
    Re: Perl Peeves <whynot@pozharski.name>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 27 Jan 2009 11:58:07 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: How to select international text characters in a regular  expression
Message-Id: <87zlhdf22o.fsf@vps1.hacking.dk>

Amos <amosyoffe@gmail.com> writes:

> I tried both of your recommendations, but in both cases the hebrew
> letters are removed.

You might have a byte-string with utf-8 encoded characters instead og
a real perl utf8-string. Try doing something like:

    use Encode 'decode_utf8';
    $string = decode_utf8($string);

(from 'perldoc perluniintro')

Otherwise you would have to match on the raw utf-8 byte sequence
instead no matter which method to solve you method you're using.

//Makholm


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

Date: Tue, 27 Jan 2009 02:17:16 -0800 (PST)
From: Amos <amosyoffe@gmail.com>
Subject: Re: How to select international text characters in a regular  expression
Message-Id: <6cc0e0fc-6108-4fca-82ca-da89c5da6c6d@r41g2000prr.googlegroups.com>

Thanks for the quick reply Makholm!

I tried both of your recommendations, but in both cases the hebrew
letters are removed.

In addition, this character =E2=80=99 is replaced by this character =D7=92.=
 Perhaps
I have some encoding issues?
The text is UTF-8 encoded and I'm using ActivePerl on Windows XP.

Maybe I can use a character range ([\x{###}-\x{###}]) instead of the
unicode property?

Any ideas?

Thanks!

Amos


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

Date: Tue, 27 Jan 2009 01:04:52 -0800 (PST)
From: Amos <amosyoffe@gmail.com>
Subject: How to select international text characters in a regular expression
Message-Id: <fc420986-2e26-4233-9f50-8291618f785b@q30g2000prq.googlegroups.com>

Hi,

I'm a perl newbie, so I apologize for this simple question.

I need to modify an existing perl script to handle languages other
than English (specifically Hebrew as a start).
The script has this line:

    y/a-z0-9/ /cs;  # retain only alpha-numeric entries

which replaces all non-alphanumeric chars with spaces.
I need it to keep Hebrew characters as well, but haven't been able to
find a regex that works.
I tried stuff like this:

y/a-z0-9=D7=90-=D7=AA/ /cs;
y/a-z0-9[\x{05D0}-\x{05EA}]/ /cs; # the unicode codes for the first
and last alphabet letters

But nothing seems to work.

Any ideas?

Thanks!
Amos


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

Date: Tue, 27 Jan 2009 10:43:48 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: How to select international text characters in a regular expression
Message-Id: <874ozlgk2z.fsf@vps1.hacking.dk>

Amos <amosyoffe@gmail.com> writes:

> I need to modify an existing perl script to handle languages other
> than English (specifically Hebrew as a start).
> The script has this line:
>
>     y/a-z0-9/ /cs;  # retain only alpha-numeric entries

Note: This is not a regular expression. Even thoug y/// looks like the
operators using regular expressions it isn't using regular
expressions.

> which replaces all non-alphanumeric chars with spaces.
> I need it to keep Hebrew characters as well, but haven't been able to
> find a regex that works.

By using the substitution operator which uses regular expressions, you
can use unicode properties to do the matching:

  s/\P{Letter}/ /g;

or if you find it more readable probably also

  s/\p{^Letter}/ /g;
 
But both are untestet...

//Makholm


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

Date: Mon, 26 Jan 2009 22:34:50 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: I need a job in C/C++/Perl immediately. Telecomute only. Full-Time. Regex/XML/Database/Parsing(et all) Expert. Will work for 60k the first year guaranteed !!
Message-Id: <lgatn4lck6jogth7b93oj7hv4b2c561un9@4ax.com>

Tim Greer <tim@burlyhost.com> wrote:
>sln@netherlands.com wrote:

>> BS degree,
>
>In?

He got a degree in _B_ull_S_hitting, what else. And actually -given his
performance here- I am certain he graduated summa cum laude.

jue


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

Date: Tue, 27 Jan 2009 11:18:22 +0100
From: =?ISO-8859-1?Q?Marie-R=E9gine?= SAPIR <marieregine@advalvas.be>
Subject: Including files (again)
Message-Id: <20090127111822.596b7612.marieregine@advalvas.be>

Hi,

I've read the perl monks tutorial on including files and I think I understood most of it. But I would still like to include a file, so I'm going to ask anyway ;-)

The file I'd like to include is sort of like an argument to the script - there are a whole bunch of them and I'd I like to be able to say:
$ my-script.plx <file> <more arguments>
(Or more likely, in the shell: 
$ for i in *some-pattern* ; do my-script.plx $i <further args> ; done)

Usually when I do this the file is very simple, but in this case it has structure, so I coded that in perl like:

%hash1 = (fruits => ["apple", "pear"], 
          things => ["table", "chair"]
         );

%hash2 = (fruits => ["pear", "banana"]
          countries => ["Turkey"]
         );

Using pure text and parsing it with split,... instead of Perl code seems like quite a hassle I'd like to avoid. 

Is there any way to do this in Perl? The one thing I didn't understand is what "eval" does, and I couldn't get the syntax right. Does anyone have a hint for me? 

I'd also welcome ideas on how to re-design this, if it's the case that I'm being blind as to a much easier way ;-)


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

Date: Tue, 27 Jan 2009 03:39:21 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: inputting the ephemerides
Message-Id: <x7k58hkurq.fsf@mail.sysarch.com>

>>>>> "JE" == Jürgen Exner <jurgenex@hotmail.com> writes:

  JE> Uri Guttman <uri@stemsystems.com> wrote:
  >>>>>>> "LG" == Larry Gates <larry@example.invalid> writes:
  >> 
  LG> my $filename = 'eph6.txt';
  LG> my $filename2 = 'outfile1.txt';
  LG> open(my $fh, '<', $filename) or die "cannot open $filename: $!";
  LG> open(my $gh, $filename2) or die "cannot open $filename2: $!";
  >> 
  LG> while (my $line = <$fh>) {
  LG> $line =~ s/\t/   /g;
  LG> $line =~ s/ER/ /g;
  LG> $line =~ s/°/ /g;
  LG> }
  LG> close($fh);
  >> 
  >> i said this before. WHY ARE YOU WRITING out the changed data and then
  >> reading it back in again? 

  JE> If at least he would write them out. But he is reading them, modifying
  JE> the read text, and then discarding the modified text by overwriting it
  JE> with the next line from the file.

yes, but he THINKS he is writing it out. the whole subthread on using
seek and its constants makes even less sense now that he isn't writing
out the modified text. i would still like to know why he thinks he needs
to write it out and then read it in together. this illogic is beyond
merely learning a new language and its quirks but seems to be a poor
understanding of basic data flow. this is more than coding fortran or c
in any language.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Tue, 27 Jan 2009 05:42:28 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Jan 27 2009
Message-Id: <KE47us.1wwp@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Ante-Deluvian-Dialog-0.01
http://search.cpan.org/~bhm/Ante-Deluvian-Dialog-0.01/
Perl extension for very old style user interaction 
----
App-Sequence-0.01_01
http://search.cpan.org/~kimoto/App-Sequence-0.01_01/
useful plaggable subroutine engine. 
----
Bio-PrimerDesigner-0.05
http://search.cpan.org/~smckay/Bio-PrimerDesigner-0.05/
Design PCR Primers using primer3 and epcr 
----
Bot-BasicBot-0.81
http://search.cpan.org/~tomi/Bot-BasicBot-0.81/
simple irc bot baseclass 
----
CPAN-Testers-WWW-Statistics-0.58
http://search.cpan.org/~barbie/CPAN-Testers-WWW-Statistics-0.58/
CPAN Testers Statistics website. 
----
CatalystX-CRUD-YUI-0.014
http://search.cpan.org/~karman/CatalystX-CRUD-YUI-0.014/
YUI for your CatalystX::CRUD view 
----
Class-Attribute-0.01
http://search.cpan.org/~deepfryed/Class-Attribute-0.01/
Another way to define class attributes!!! 
----
Class-OWL-0.0.5
http://search.cpan.org/~leifj/Class-OWL-0.0.5/
Generate perl classes from OWL schema 
----
Config-IniHash-3.00.05
http://search.cpan.org/~jenda/Config-IniHash-3.00.05/
Perl extension for reading and writing INI files 
----
Data-FeatureFactory-0.0404
http://search.cpan.org/~sixtease/Data-FeatureFactory-0.0404/
evaluate features normally or numerically 
----
Devel-Backtrace-0.12
http://search.cpan.org/~pepe/Devel-Backtrace-0.12/
Object-oriented backtrace 
----
Dotiac-addon-json-0.1
http://search.cpan.org/~maluku/Dotiac-addon-json-0.1/
----
Encode-HanConvert-0.35
http://search.cpan.org/~audreyt/Encode-HanConvert-0.35/
Traditional and Simplified Chinese mappings 
----
File-Find-Rule-Ext2-FileAttributes-0.02
http://search.cpan.org/~dwilson/File-Find-Rule-Ext2-FileAttributes-0.02/
rules to match on Ext2::FileAttributes 
----
File-Lockfile-1.0.1
http://search.cpan.org/~glorybox/File-Lockfile-1.0.1/
create lockfile to prevent process simultaneous run 
----
Finance-Bank-IE-PermanentTSB-0.05
http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB-0.05/
Perl Interface to the PermanentTSB Open24 homebanking on <http://www.open24.ie> 
----
Finance-Bank-IE-PermanentTSB-0.06
http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB-0.06/
Perl Interface to the PermanentTSB Open24 homebanking on <http://www.open24.ie> 
----
Finance-Bank-IE-PermanentTSB-0.07
http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB-0.07/
Perl Interface to the PermanentTSB Open24 homebanking on <http://www.open24.ie> 
----
Finance-Bank-IE-PermanentTSB-0.07-erratacorrige
http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB-0.07-erratacorrige/
Perl Interface to the PermanentTSB Open24 homebanking on <http://www.open24.ie> 
----
Graphics-GnuplotIF-Shortcut-0.02
http://search.cpan.org/~borisz/Graphics-GnuplotIF-Shortcut-0.02/
Alternate interface to Graphics::GnuplotIF 
----
HTML-FormHandler-0.09
http://search.cpan.org/~gshank/HTML-FormHandler-0.09/
form handler written in Moose 
----
HTTP-Engine-0.0.99_03
http://search.cpan.org/~yappo/HTTP-Engine-0.0.99_03/
Web Server Gateway Interface and HTTP Server Engine Drivers (Yet Another Catalyst::Engine) 
----
Heap-MinMax-0.05
http://search.cpan.org/~mbeebe/Heap-MinMax-0.05/
Perl implementation of a Min-Max Heap 
----
Helix-0.01
http://search.cpan.org/~abel/Helix-0.01/
web application framework. 
----
Log-Report-0.22
http://search.cpan.org/~markov/Log-Report-0.22/
report a problem, pluggable handlers and language support 
----
Media-Type-Simple-0.02
http://search.cpan.org/~rrwo/Media-Type-Simple-0.02/
MIME Media Types and their file extensions 
----
MediaWiki-Bot-2.0.1
http://search.cpan.org/~dcollins/MediaWiki-Bot-2.0.1/
a Wikipedia bot framework written in Perl 
----
MediaWiki-Bot-Plugin-2GIRLS1CUP-0.0.1
http://search.cpan.org/~dcollins/MediaWiki-Bot-Plugin-2GIRLS1CUP-0.0.1/
----
MediaWiki-Bot-Plugin-CUP-0.3.0
http://search.cpan.org/~dcollins/MediaWiki-Bot-Plugin-CUP-0.3.0/
a plugin for MediaWiki::Bot which contains data retrieval tools for the 2009 WikiCup hosted on the English Wikipedia 
----
Memoize-Memcached-0.03
http://search.cpan.org/~dtrischuk/Memoize-Memcached-0.03/
use a memcached cache to memoize functions 
----
Modern-Perl-1.00
http://search.cpan.org/~chromatic/Modern-Perl-1.00/
enable all of the features of Modern Perl with one command 
----
Modern-Perl-1.01
http://search.cpan.org/~chromatic/Modern-Perl-1.01/
enable all of the features of Modern Perl with one command 
----
MooseX-Attribute-Prototype-0.03
http://search.cpan.org/~ctbrown/MooseX-Attribute-Prototype-0.03/
Borrow and Extend Moose Attrtibutes 
----
Net-DNS-0.65
http://search.cpan.org/~olaf/Net-DNS-0.65/
Perl interface to the DNS resolver 
----
Net-SIP-0.53
http://search.cpan.org/~sullr/Net-SIP-0.53/
Framework SIP (Voice Over IP, RFC3261) 
----
Net-SPAMerLookup-0.10
http://search.cpan.org/~lushe/Net-SPAMerLookup-0.10/
Perl module to judge SPAMer. 
----
Net-SSH-Perl-1.33_1
http://search.cpan.org/~turnstep/Net-SSH-Perl-1.33_1/
Perl client Interface to SSH 
----
Net-Twitter-2.05
http://search.cpan.org/~cthom/Net-Twitter-2.05/
Perl interface to twitter.com 
----
Net-Twitter-2.06
http://search.cpan.org/~cthom/Net-Twitter-2.06/
Perl interface to twitter.com 
----
NetAddr-IP-4.024
http://search.cpan.org/~miker/NetAddr-IP-4.024/
Manages IPv4 and IPv6 addresses and subnets 
----
OODoc-1.05
http://search.cpan.org/~markov/OODoc-1.05/
object oriented production of code related documentation 
----
POE-Component-Pluggable-1.14
http://search.cpan.org/~bingos/POE-Component-Pluggable-1.14/
A base class for creating plugin enabled POE Components. 
----
POE-Component-Server-IRC-1.37_01
http://search.cpan.org/~bingos/POE-Component-Server-IRC-1.37_01/
A fully event-driven networkable IRC server daemon module. 
----
POE-Component-SmokeBox-Recent-1.04
http://search.cpan.org/~bingos/POE-Component-SmokeBox-Recent-1.04/
A POE component to retrieve recent CPAN uploads. 
----
Parse-BooleanLogic-0.07
http://search.cpan.org/~ruz/Parse-BooleanLogic-0.07/
parser of boolean expressions 
----
RMI-0.02
http://search.cpan.org/~sakoht/RMI-0.02/
Remote Method Invocation with transparent proxies 
----
Roguelike-Utils-0.4.225
http://search.cpan.org/~earonesty/Roguelike-Utils-0.4.225/
----
Rose-DBx-Object-Indexed-0.004
http://search.cpan.org/~karman/Rose-DBx-Object-Indexed-0.004/
full-text search for RDBO classes 
----
SWISH-Prog-0.25
http://search.cpan.org/~karman/SWISH-Prog-0.25/
information retrieval application framework 
----
Spreadsheet-XLSX-0.09
http://search.cpan.org/~dmow/Spreadsheet-XLSX-0.09/
Perl extension for reading MS Excel 2007 files; 
----
Tell-0.0.6
http://search.cpan.org/~roscio/Tell-0.0.6/
Print messages with balance, indentation, severity, and autoclosure. 
----
Term-Emit-0.0.1
http://search.cpan.org/~roscio/Term-Emit-0.0.1/
Print with indentation, status, and closure 
----
Term-TermKey-0.03
http://search.cpan.org/~pevans/Term-TermKey-0.03/
perl wrapper around libtermkey 
----
Unix-Uptime-0.3
http://search.cpan.org/~pioto/Unix-Uptime-0.3/
Determine the current uptime, in seconds, across different *NIX architectures 
----
WebService-Google-Sets-0.03
http://search.cpan.org/~dwilson/WebService-Google-Sets-0.03/
Perl access to Google Labs Sets site 
----
Workflow-1.32
http://search.cpan.org/~jonasbn/Workflow-1.32/
Simple, flexible system to implement workflows 
----
YAML-Perl-0.01_03
http://search.cpan.org/~ingy/YAML-Perl-0.01_03/
----
ZConf-Bookmarks-0.0.0
http://search.cpan.org/~vvelox/ZConf-Bookmarks-0.0.0/
ZConf backed bookmark storage system. 
----
self-0.32
http://search.cpan.org/~gugod/self-0.32/
provides '$self' in OO code. 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Mon, 26 Jan 2009 23:48:05 -0600
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Perl Peeves
Message-Id: <lpj256-85d.ln1@tmcd.austin.tx.us>

In article <gllp4p$psn$1@reader1.panix.com>,
Tim McDaniel <tmcd@panix.com> wrote:
>Just venting.
>
>(1) I hate that
>
>    Unary "+" has no effect whatsoever, even on strings.
>
>(per "man perlop").  Unary plus LOOKS like a unary arithmetic
>operator, like "-".  ...
>
>(I could do "- -@a", but that's just not as elegant as "+@a" would
>be.)

Of course, "0+@a" would work as well as "scalar @a", but none of the
choices really look elegant.

-- 
Tim McDaniel; Reply-To: tmcd@panix.com


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

Date: Mon, 26 Jan 2009 23:46:08 -0600
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Perl Peeves
Message-Id: <0mj256-85d.ln1@tmcd.austin.tx.us>

In article <7crsn4hardgt8fvgn3p0uopfv1mtgdfj7k@4ax.com>,
Jürgen Exner  <jurgenex@hotmail.com> wrote:
>tmcd@panix.com (Tim McDaniel) wrote:
>>(3) "man perlop" has
>>
>>    Binary "<" returns true if the left argument is numerically less
>>    than the right argument.
>>
>>et cetera, but it doesn't even mention "false" in that context 
>
>Well, ok, wording might be better as 
>	"... returns true if and only if the left argument..."
>No big deal. Most people will understand it that way anyway.

Hey, I did say "Peeves", not "Self-Evident Perl Bugs".

>>doesn't define "true".  
>
>Why should it? There is no point in repeating the definition of true
>for every single operator or function that returns a boolean value.

I think "true" and "false" could be logically defined in perlop --
hey, they're actually computed by operators there -- than in perlsyn.
So I'd move the paragraph from perlsyn to perlop, or copy it, or at
least have one place point to the other.

>>    $ perl -w -e 'my $j =   (17 < 5); print "<$j>\n"'
>>    <>
>>
>>    $ perl -w -e 'my $j = 0+(17 < 5); print "<$j>\n"'
>>    <0>
>
>Why on earth would you do something like that?

If I want to write it to a properties file to be read in again later,
or to output it for debugging.
    my $output_value = (CONDITION) ? 1 : 0;
just feels amateurish and too verbose to me.

>It is not logical (and a _VERY_ bad practice carried over from C) to
>add a number and a boolean value? What + operator and what algebra is
>that supposed to be?

"As you know, Bob" (you allude to it later), Perl 5 doesn't have a
boolean type, but uses strings and integers.  So they can't go
preaching type purity to me.  If there *were* a boolean type built in,
I'd quite agree with you.

>Granted, Perl does a lot of implicit type conversions or rather any
>scalar automatically has numerical, boolean, and text values. But if
>you make use of them, then you better know exactly what they do

and I think it should at least be consistent with the rest of the
language.  I'd like 1 versus 0, or -1 versus 1, or 1 versus a real ''
(though that looks weird).

>>(6) The stupidity that I've mentioned before, of the -r / -w / -x
>>being defined as being ignorant of ACLs, when they should truly
>>follow their definitions in "man perlfunc":
>
>Yeah, you got a point. Feel free to submit a patch.

Given that it was long-since defined in the man pages, and given that
there's a partial workaround with a pragma, it would probably be
rejected.

-- 
Tim McDaniel; Reply-To: tmcd@panix.com


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

Date: Mon, 26 Jan 2009 23:48:37 -0600
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Perl Peeves
Message-Id: <lqj256-85d.ln1@tmcd.austin.tx.us>

In article <slrngnsvu6.tkh.tadmc@tadmc30.sbcglobal.net>,
Tad J McClellan  <tadmc@seesig.invalid> wrote:
>Tim McDaniel <tmcd@panix.com> wrote:
>> Just venting.
>>
>> (4) It doesn't say which true value is returned.  
>
>Because the programmer does not need do know.
>
>You only need to know if it is one of the true values or one of the
>false values.

Then why do the man pages define it?

-- 
Tim McDaniel; Reply-To: tmcd@panix.com


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

Date: Tue, 27 Jan 2009 03:46:39 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl Peeves
Message-Id: <x7fxj5kufk.fsf@mail.sysarch.com>

>>>>> "JE" == Jürgen Exner <jurgenex@hotmail.com> writes:

  JE> tmcd@panix.com (Tim McDaniel) wrote:
  >> Just venting.
  >> 
  >> (1) I hate that
  >> 
  >> Unary "+" has no effect whatsoever, even on strings.

  JE> Agree, that is not very user friendly.

unless you use it as intended which is to disambiguate parsing issues
like print (3 + 4) * 5 vs print +(3 + 4) * 5.

  >> doesn't define "true".  

  JE> Why should it? There is no point in repeating the definition of true for
  JE> every single operator or function that returns a boolean value.

perl defines the set of false values. all others are true. this is a
good concept.

  >> (5) That "special false".  I was going nuts trying to figure out what
  >> was different between
  >> 
  >> $ perl -w -e 'my $j =   (17 < 5); print "<$j>\n"'
  >> <>
  >> 
  >> $ perl -w -e 'my $j = 0+(17 < 5); print "<$j>\n"'
  >> <0>

  JE> Why on earth would you do something like that? It is not logical (and a
  JE> _VERY_ bad practice carried over from C) to add a number and a boolean
  JE> value? What + operator and what algebra is that supposed to be? 
  JE> Operators for boolean values are e.g. and, or, ||, not. 
  JE> Granted, Perl does a lot of implicit type conversions or rather any
  JE> scalar automatically has numerical, boolean, and text values. But if you
  JE> make use of them, then you better know exactly what they do, e.g. what
  JE> is the value of 
  JE> 	5 + "Hello World"
  JE> or 
  JE> 	"The answer is 42" + 9

agreed. boolean values should be used in boolean contexts. if you decide
to use a false value in string or numeric contexts it will be coerced as
desired without a warning. this is also true for undef which is false
but this will trigger a warning.

  >> (6) The stupidity that I've mentioned before, of the -r / -w / -x
  >> being defined as being ignorant of ACLs, when they should truly follow
  >> their definitions in "man perlfunc":

  JE> Yeah, you got a point. Feel free to submit a patch.

perl derived its -rwx ops from the original unix file modes. this was
way before any system that perl was on had ACL's. there is no easy way
to retrofit acl's onto such a simple API.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Tue, 27 Jan 2009 11:08:37 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: Perl Peeves
Message-Id: <slrngntjok.6gs.whynot@orphan.zombinet>

On 2009-01-27, Tim McDaniel <tmcd@panix.com> wrote:
> Just venting.

oh, come on, just get used to it.

*SKIP*
> (5) That "special false".  I was going nuts trying to figure out what
> was different between

Lots of things

>     $ perl -w -e 'my $j =   (17 < 5); print "<$j>\n"'
>     <>

{4185:3} [0:29]$ perl -mO=Deparse -wle 'my $j = (17 < 5); print "<$j>"'
BEGIN { $^W = 1; }
BEGIN { $/ = "\n"; $\ = "\n"; }
my $j = !1;
print "<$j>";
-e syntax OK

>     $ perl -w -e 'my $j = 0+(17 < 5); print "<$j>\n"'
>     <0>

{4192:4} [0:0]$ perl -mO=Deparse -wle 'my $j = 0+(17 < 5); print "<$j>"'
BEGIN { $^W = 1; }
BEGIN { $/ = "\n"; $\ = "\n"; }
my $j = 0;
print "<$j>";
-e syntax OK

>     $ perl -w -e 'my $j = 0+(""    ); print "<$j>\n"'
>     Argument "" isn't numeric in addition (+) at -e line 1.
>     <0>

That special false is evaluated to blah-blah-blah *immediately* since
the context is known at compile time (am I right?).  (just out of
curiosity, what that "special false" would evaluate in void context?)

{7152:24} [0:0]$ perl -mO=Deparse -wle '(17 < 5); print "<$j>"'
Name "main::j" used only once: possible typo at -e line 1.
BEGIN { $^W = 1; }
BEGIN { $/ = "\n"; $\ = "\n"; }
'???';
print "<$j>";
-e syntax OK

he-he, it bails out

> (6) The stupidity that I've mentioned before, of the -r / -w / -x
> being defined as being ignorant of ACLs, when they should truly follow
> their definitions in "man perlfunc":
>
>     -r  File is readable by effective uid/gid.
>     -w  File is writable by effective uid/gid.
>     -x  File is executable by effective uid/gid.

"Patches are welcome" (c)

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 2163
***************************************


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