[29129] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 373 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 23 11:10:12 2007

Date: Mon, 23 Apr 2007 08:09:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 23 Apr 2007     Volume: 11 Number: 373

Today's topics:
    Re: $ENV HOME on windows <Peter@PSDT.com>
        A regular expression query <dp_pearce@hotmail.com>
    Re: A regular expression query <jurgenex@hotmail.com>
    Re: A regular expression query <dp_pearce@hotmail.com>
    Re: Booleans in Perl anno4000@radom.zrz.tu-berlin.de
    Re: Booleans in Perl <zen13097@zen.co.uk>
        file name length must not exceed 260 characters... <nitte.sudhir@gmail.com>
    Re: file name length must not exceed 260 characters... anno4000@radom.zrz.tu-berlin.de
        How solve this error mukunthini@gmail.com
    Re: How solve this error anno4000@radom.zrz.tu-berlin.de
    Re: How to get the variable name, not values? anno4000@radom.zrz.tu-berlin.de
        im bobby223317@gmail.com
        regular expression for wc <chefmuetze@web.de>
    Re: regular expression for wc <jue@monster-berlin.de>
    Re: regular expression for wc <chefmuetze@web.de>
    Re: regular expression for wc <wahab-mail@gmx.de>
    Re: Suppress warning anno4000@radom.zrz.tu-berlin.de
        System process failed to die on Windows Server 2003 <no@email.com>
        The Hack of bitmask used as Predicate Parameters <xah@xahlee.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 23 Apr 2007 12:59:50 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: $ENV HOME on windows
Message-Id: <pan.2007.04.23.12.59.49.283725@PSDT.com>

On Sun, 22 Apr 2007 09:19:35 -0700, Bob wrote:
> I apologise for the basic question, but I am using perl on windows for
> the first time (after about 20 years using it on unix...) and the
> problem does not make sense to me. Perl (active state) complaints that
> the value is not initialized. Why in heaven?

See
http://search.cpan.org/~rkobes/File-HomeDir-Win32-0.04/lib/File/HomeDir/Win32.pm

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/



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

Date: 23 Apr 2007 05:53:53 -0700
From: Devon_Dan <dp_pearce@hotmail.com>
Subject: A regular expression query
Message-Id: <1177332833.203203.78510@b75g2000hsg.googlegroups.com>

First, thanks for taking the time to read this post. I have spent a
while trying to make this work but to no avail and I cant find a post
that explains it. Your time is appreciated.

Now I have a text file with a large amount of XML data in it. I am
trying to extract everything between <Folder>...</Folder> tags. These
extend over a number of lines and there are an undefined number of
these folders in the file. I would like the contents of each of the
folders to be assigned to a either a new variable or part of an array.
Something like:

$result[1] = "contents of folder one";
$result[2] = "contents of folder two";  etc...

I have the contents of the text file as a single variable $content and
I think I have the right regular expression to match the first folder:

$content =~ m/<(F|f)older>t.*?<\/(F|f)older>//s

Still I am unsure how to loop through and collect each of the
instances.

Any tips or hints? Perhaps its a basic hole in my understanding and
someone can even recommend a good tutorial/article that explains it?

Thanks

Dan



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

Date: Mon, 23 Apr 2007 13:03:16 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: A regular expression query
Message-Id: <o82Xh.3124$Zm.3010@trndny03>

Devon_Dan wrote:
> First, thanks for taking the time to read this post. I have spent a
> while trying to make this work but to no avail and I cant find a post
> that explains it. Your time is appreciated.
>
> Now I have a text file with a large amount of XML data in it. I am
> trying to extract everything between <Folder>...</Folder> tags.

Any of the XML modules should be able to handle this task easily, e.g. 
XML::Simple or XML::Parser

> I have the contents of the text file as a single variable $content and
> I think I have the right regular expression to match the first folder:
>
> $content =~ m/<(F|f)older>t.*?<\/(F|f)older>//s
>
> Still I am unsure how to loop through and collect each of the
> instances.

Maybe you are just looking for the g option (perldoc perlop, 'Regexp 
Quote-Like Operators').

> Any tips or hints? Perhaps its a basic hole in my understanding and
> someone can even recommend a good tutorial/article that explains it?

Use the proper tool for the job. REs are not the proper tool for parsing 
XML.

jue 




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

Date: 23 Apr 2007 06:11:05 -0700
From: Devon_Dan <dp_pearce@hotmail.com>
Subject: Re: A regular expression query
Message-Id: <1177333865.401525.72990@y5g2000hsa.googlegroups.com>

Doh! Thanks for that



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

Date: 23 Apr 2007 13:03:47 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Booleans in Perl
Message-Id: <593p5jF2ipdmnU2@mid.dfncis.de>

Randal L. Schwartz <merlyn@stonehenge.com> wrote in comp.lang.perl.misc:
> >>>>> "Mirco" == Mirco Wahab <wahab-mail@gmx.de> writes:
> 
> Mirco> Yours is much more adequate, but the !0 would (imho) always evaluate to
> Mirco> 1 in Perl, so why wouldn't one write it.
> 
> There's actually no promise of that.  "Boolean-returning" operations are free
> to return "any true" for true and "any false" for false, although in practice,
> they return a predefined scalar (internally) of "true" and "false", which
> look like "1" and "" respectively.  Yes, "false" is not 0, but "".

Perl's standard "false" is both, really.  It's "" as a string but 0
as a number.

    perl -wle 'print (not 1) + 0'

doesn't warn like it would when "not 1" were just "".  Devel::Peek shows
the situation in detail.

Anno


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

Date: 23 Apr 2007 14:48:47 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: Booleans in Perl
Message-Id: <462cc74f$0$21832$db0fefd9@news.zen.co.uk>

David Williams <dw149@acmex.gatech.edu> wrote:
> 
>  Busted :) 
>  I use php a lot and wrote echo instead of print.
>  I actually used print in my program.
> 
>  So, what I get is that Perl does not really understand FALSE.

It understands false values just fine, but the string "FALSE" is not a
false value.

I tend to use the values 1 & 0 when assigning to booleans, but you can
always define the constants TRUE/FALSE yourself.

    use constant TRUE  => 1;
    use constant FALSE => 0;


>  I guess my workaround is to use the eq operand.

No! Please, for the sake of anyone who has to maintain your code,
don't do that.

When checking the value of booleans, code is much more readable if
your tests are of the form:
 
   if ( $value ) ...
   if ( not $value ) ...

rather than 
  
   if ( $value eq 'TRUE' ) ...
   if ( $value eq 'FALSE' ) ...

Not to mention the fun of inverting the value if you use strings.

Here is your example program written so that it produces the effect
you desire:

    #!/usr/bin/perl
    use strict;
    use warnings;

    use constant TRUE  => 1;
    use constant FALSE => 0;

    my $a = FALSE;
    my $b = FALSE;
    my $c = ( $a && $b );
    if ( $c ) {
	    print "the expr evaluates to true\n";
    }
    else {
	    print "the expr evaluates to false\n";
    }



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

Date: 23 Apr 2007 06:30:40 -0700
From: kath <nitte.sudhir@gmail.com>
Subject: file name length must not exceed 260 characters...
Message-Id: <1177335040.726526.54280@d57g2000hsg.googlegroups.com>

Hi, I have a script which unzips an archive. As I unzip archive I get
some errors like,

Total path and file name length must not exceed 260 characters
    Access is denied.

When I check the path of the file it is actually having length of 259
characters.
Is there any way to solve this(may im asking stupid question) problem,
because when check the path-legth it is 259. And the thing is I have
to unzip it to that same destination, no other option.

I am running the script on Windows and the unzipping is happening on
Linux box. Is it really potential problem of the operating system or
is there a way I can overcome this.

Any thoughts will be appreciated.

Thank you,
kath.



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

Date: 23 Apr 2007 14:01:48 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: file name length must not exceed 260 characters...
Message-Id: <593sicF2ik7hdU1@mid.dfncis.de>

kath  <nitte.sudhir@gmail.com> wrote in comp.lang.perl.misc:
> Hi, I have a script which unzips an archive. As I unzip archive I get
> some errors like,
> 
> Total path and file name length must not exceed 260 characters
>     Access is denied.
> 
> When I check the path of the file it is actually having length of 259
> characters.

There is at least a trailing null byte.

> Is there any way to solve this(may im asking stupid question) problem,
> because when check the path-legth it is 259. And the thing is I have
> to unzip it to that same destination, no other option.

Haggling about the length which should nominally suffice won't
get you anywhere.  When you're forced to operate that close to
the limit, you must increase the limit.  You can probably modify
the kernel to accept longer path names.

> I am running the script on Windows and the unzipping is happening on
> Linux box. Is it really potential problem of the operating system or
> is there a way I can overcome this.
> 
> Any thoughts will be appreciated.

You should ask that question on a Unix- or Linux-related group.
Perl programmers aren't particularly qualified to answer it.

Anno


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

Date: 23 Apr 2007 05:24:22 -0700
From: mukunthini@gmail.com
Subject: How solve this error
Message-Id: <1177331062.352981.327530@b75g2000hsg.googlegroups.com>

I'm new to Perl and am trying to get a simple counter script to work.
It seems to be able to read the counter.dat file ok  but I can't get
it to write the new file count to the file. When im executing the
script in command line it's working well and updating the couner.dat
also to new value. but when im running the file in web browser it's
reading the counter value.The counter get's incremented just fine, But
I cannot get the thing to write back out to the counter.dat file with
the new value. My file permissions seem to be ok. It reads the
counter.dat file but will not write to it. and in the error log its
giving the following error
"hi.pl: Cannot open  for writing: Permission denied at /var/www/cgi-
bin/hi.pl line 13."
im using Fedora linux, apache 2.0 and perl 5.6.2 .......and mozilla
firefox browser to execute this file
Anybody ever seen this happen?
here is the code:

#!/usr/local/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use CGI qw/:standard/;
print "Content-type: text/html\n\n";      # Web page as default output
open (COUNT, "counter.dat");    # Open for read using COUNT file
handle
$hitcount = <COUNT>;             # Read in file to get current count
value
close COUNT;                         # Close the data file
$hitcount = $hitcount + 1;         # Increment count value
open (COUNT, "> counter.dat") or warn "Cannot open $file for writing:
$!";   # Open data file for write
flock(COUNT, 2);
print COUNT "$hitcount";         # Write updated count value
close COUNT;                     # Close the data file
print "$hitcount";               # Display updated count on the page
exit;

                           thankx in advance.....!
regards
mukunthini



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

Date: 23 Apr 2007 12:39:00 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How solve this error
Message-Id: <593nn4F2ipdmnU1@mid.dfncis.de>

 <mukunthini@gmail.com> wrote in comp.lang.perl.misc:
> I'm new to Perl and am trying to get a simple counter script to work.
> It seems to be able to read the counter.dat file ok  but I can't get
> it to write the new file count to the file. When im executing the
> script in command line it's working well and updating the couner.dat
> also to new value. but when im running the file in web browser it's
> reading the counter value.The counter get's incremented just fine, But
> I cannot get the thing to write back out to the counter.dat file with
> the new value. My file permissions seem to be ok. It reads the
> counter.dat file but will not write to it. and in the error log its
> giving the following error
> "hi.pl: Cannot open  for writing: Permission denied at /var/www/cgi-
> bin/hi.pl line 13."

In view of that error message, what makes you think your permissions
are ok?

> im using Fedora linux, apache 2.0 and perl 5.6.2 .......and mozilla
> firefox browser to execute this file
> Anybody ever seen this happen?
> here is the code:
> 
> #!/usr/local/bin/perl

No "strict"?  No "warnings"?

> use CGI::Carp qw(fatalsToBrowser);
> use CGI qw/:standard/;
> print "Content-type: text/html\n\n";      # Web page as default output
> open (COUNT, "counter.dat");    # Open for read using COUNT file
> handle

Why aren't you checking the result of open()?

> $hitcount = <COUNT>;             # Read in file to get current count
> value
> close COUNT;                         # Close the data file
> $hitcount = $hitcount + 1;         # Increment count value
> open (COUNT, "> counter.dat") or warn "Cannot open $file for writing:
> $!";   # Open data file for write

Here you *are* checking the success of open(), but the error message
is misleading.  You are opening "counter.dat", but in the error
message you refer to "$file", which is nowhere set in your code.

[rest of code snipped]

Correct your code and go back to permission checking, that is
likely the problem.

Anno


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

Date: 23 Apr 2007 08:25:09 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to get the variable name, not values?
Message-Id: <5938r5F2jbr93U1@mid.dfncis.de>

lihao0129@gmail.com <lihao0129@gmail.com> wrote in comp.lang.perl.misc:
> Hi, folks:
> 
> Is there a way in Perl to return the variable name instead of it's
> values, like in C, we can use the '#' token with macro:
> 
>   #define print_int(var) printf( #var " is %d\n", var)
> 
> then each time I want to print out an interger, I issue:
> 
>   print_int(number);
> 
> instead of
> 
>   printf("number is %d \n", number);
> 
> The output string might be very long and used for various variables,
> so I need to wrap it into a subroutine or something else available for
> this purpose. Can I do this with Perl? Many thank for your hints..

The standard DB module has a feature the allows something similar.
Put this in a Perl module:

    package Report;
    use strict; use warnings;
    use base 'Exporter';
    our @EXPORT = qw( report);

    {
        package DB;
        sub report {
            for my $expr ( @_ ) {
                my $val = eval $expr;
                $val = " = $val" if defined $val;
                $val = '-invalid-' if $@;
                $val = '-undef-' unless defined $val;
                print "$expr $val\n";
            }
        }
    }

    *report = \ &DB::report;

    1;

Then in another program you can do this:

    use Report;

    my ( $x, $y) = 123;
    our $z = 456;
    my %h = (
        abc => 789,
    );

    report( qw( $x $y $z $gibsnich $h{abc}));

That prints

    $x  = 123
    $y -undef-
    $z  = 456
    $gibsnich -invalid-
    $h{abc}  = 789

Anno


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

Date: 23 Apr 2007 02:32:52 -0700
From: bobby223317@gmail.com
Subject: im
Message-Id: <1177320772.770540.4760@p77g2000hsh.googlegroups.com>

i want to join plz



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

Date: 23 Apr 2007 05:02:42 -0700
From: Zeh Mau <chefmuetze@web.de>
Subject: regular expression for wc
Message-Id: <1177329762.361546.301780@q75g2000hsh.googlegroups.com>

Please go to this thread:

http://groups.google.de/group/regex/browse_thread/thread/e25c3e39aaafcd30?hl=de

Thanks for your support,

Zeh Mau



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

Date: 23 Apr 2007 07:06:17 -0700
From: "Thomas J." <jue@monster-berlin.de>
Subject: Re: regular expression for wc
Message-Id: <1177337176.992687.84740@n59g2000hsh.googlegroups.com>

REs are not able to "count".

so the Answer must be: No.

However they may help you to separate words like "wc", but you have to
count those words by yourself (your program).

Thomas



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

Date: 23 Apr 2007 07:21:32 -0700
From: Zeh Mau <chefmuetze@web.de>
Subject: Re: regular expression for wc
Message-Id: <1177338092.213824.7920@l77g2000hsb.googlegroups.com>

Hello Thomas,

I use LEX to count the results of the REs. So I have only to define
the correct REs which I don't know how they could look like.

Zeh



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

Date: Mon, 23 Apr 2007 16:52:50 +0200
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: regular expression for wc
Message-Id: <f0ihkf$mq5$1@mlucom4.urz.uni-halle.de>

Thomas J. wrote:
> REs are not able to "count".
> 
> so the Answer must be: No.
> 
> However they may help you to separate words like "wc", but you have to
> count those words by yourself (your program).

First shot:
<===

use strict;
use warnings;

my $text='Hello,

is it possible to create a regular expression,
which does exactly the same as the UNIX tool wc,
which means counting
lines, words and all signs of a file?

Thanks,
Zeh Mau';

my %count = (lines=>0, words=>0, characters=>0);
my $re = qr/(?:
                \b(?{$count{words}+=0.25})
                |
                \n(?{++$count{lines}})
                |
                .(?{++$count{characters}})
              )
            /xms;

  1 while $text =~ /$re/g;

  print "$_ => $count{$_}\n" for keys %count;

<===

Needs some more thinking (will look
at it today on evening again ;-)

Regards

M.


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

Date: 23 Apr 2007 11:24:17 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Suppress warning
Message-Id: <593jb1F2jfll2U1@mid.dfncis.de>

Ian Wilson  <scobloke2@infotop.co.uk> wrote in comp.lang.perl.misc:
> When I run the code below I get an unwanted warning and the expected result.
> 
>  > soapclientauto.pl
> Use of inherited AUTOLOAD for non-method main::c2f() is deprecated at 
> soapclientauto.pl line 11.
> 41.1C = 105.98F.
> 
> ------------------------------------------------------
> #!perl
> use strict;
> use warnings;
> 
> use SOAP::Lite +autodispatch =>
>    uri => 'http://www.example.com/Temperature',
>    proxy => 'http://localhost/cgi-bin/soapservice.pl';
> 
> {
>    no warnings 'deprecated';
>    print "41.1C = ", c2f(41.1), "F.\n";
> }
> ------------------------------------------------------
> ActiveState Perl 5.8.8 on XP
> 
> The warning arises when I use SOAP::Lite's "autodispatch" feature.
> 
> `no warnings;` suppresses the warning but seems overkill.

The warning can be suppressed by excluding *two* warning categories:

    no warnings qw( syntax deprecated);

I have not seen a case like that before.

Anno


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

Date: Mon, 23 Apr 2007 14:08:24 +0100
From: Brian Wakem <no@email.com>
Subject: System process failed to die on Windows Server 2003
Message-Id: <593pe8F2i8t5pU1@mid.individual.net>

I am unfortunate enough to have to automate Word on Windows Server 2003.

The WINWORD.EXE processes are being launched as the user SYSTEM, pressumable
because Apache (which is automating it through mod_perl) is running as
SYSTEM.

kill 9, $pid does not seem to be able to kill SYSTEM processes even when my
reaper is running as Administrator.

Win32::Process::KillProcess($pid, $exitcode) also fails with a permission
denied message.


I guess my question is this:

How do I kill system process from Perl as the Administrator.


My experience is all Linux and I am new to Windows servers.  This may best
be asked in a Window newsgroup but I am looking for a Perl specific answer
so I think here is my best bet.



-- 
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png


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

Date: 23 Apr 2007 03:53:11 -0700
From: Xah Lee <xah@xahlee.org>
Subject: The Hack of bitmask used as Predicate Parameters
Message-Id: <1177325591.380907.262730@n76g2000hsh.googlegroups.com>

In this article, i explain how the use of bit masks is a hack in many
imperative languages.

Often, a function will need to take many True/False parameters. For
example, suppose i have a function that can draw a rainbow, and each
color of the rainbow can be turned on or off individually. My function
specification can be of this form: =E2=80=9Crainbow(red, orange, yellow,
green, blue, violet, purple)=E2=80=9D. Each parameter is a true or false
value. So, to draw a rainbow with only red and yellow stripes on, one
would code, for example =E2=80=9Crainbow(t,f,t,f,f,f,f)=E2=80=9D, where =E2=
=80=9Ct=E2=80=9D stands for
true and =E2=80=9Cf=E2=80=9D stands for false. (or, similar values for the =
true/false
of the language's boolean system)

The problem with this simple approach is that when a function has too
many parameters, =E2=80=9Cwhich position means what=E2=80=9D becomes diffic=
ult to
remember and manage. Alternatively, a high-level language may provide
a system for named parameters. So, for example, the function may be
called like this with 2 arguments =E2=80=9Crainbow(red:t, yellow:t)=E2=80=
=9D, meaning,
give the true values to the parameters named =E2=80=9Cred=E2=80=9D and =E2=
=80=9Cyellow=E2=80=9D.
Parameters not given may automatically assumed to have false values by
default. Similarly, the language can simply have the function call
look like this: =E2=80=9Crainbow(red, yellow)=E2=80=9D, where omitted param=
eter names
simply means false.

LSL deals with this issue by using a concept of bit-mask that came
from low-level languages. From the programer's point of view, the way
to call this rainbow function would look like this: =E2=80=9Crainbow(red|
yellow)=E2=80=9D. On the surface, it seems just a syntax variation. But
actually, the =E2=80=9Cred=E2=80=9D and =E2=80=9Cyellow=E2=80=9D here are g=
lobal constants of type
integer, defined by the language, and the =E2=80=9C|=E2=80=9D is actually a=
 bit-wise
binary operator. To explain this to a educated person (e.g. a
mathematician) but who are not a professional programer, it gets a bit
complex as one has to drag in binary notation, boolean operation on
binary notation realized as a sequence of slots, and the compiler ease
in processing numbers as binary digits, and the compiler writer and
language designer's laziness in resorting to these instead of a high-
level interface of named parameters.

The hack of using the so-called bit-mask as a interface for functions
that need named parameters, is similar to languages using =E2=80=9C1=E2=80=
=9D and =E2=80=9C0=E2=80=9D
as the true/false symbols in its boolean system, and languages using
the =E2=80=9Cor=E2=80=9D operator =E2=80=9C||=E2=80=9D as a method of neste=
d =E2=80=9Cif else=E2=80=9D program flow
constructs. The problem with these hacks, is that they jam logically
disparate semantics into the same construct. Their effects is making
the source code more difficult to read, and thus increased programer
error.

----

It may seem like nickpicking to say that it is a hack. However, when
many such seemingly trivially improper designs appear in a language,
adds up to the language's illness, and overall making the language
difficult to learn, difficult to read, difficult to extend, increase
programing errors, and most importantly, reduce a clear understanding
of key concepts.

Unix and C, are the primary perpetrator of this sin. Due to their
=E2=80=9C$free$=E2=80=9D and =E2=80=9Cspeedy=E2=80=9D and =E2=80=9Csimplist=
ic=E2=80=9D nature as cigarettes given to
children, have passed these designs to many imperative languages and
left programers not understanding the basic issues of a function's
parameters and named parameters.

Examples of using bitmask as a hack:

=E2=80=A2 Many functions in C. (e.g. fcntl)

=E2=80=A2 Unix's function/=E2=80=9Ccommand line tool=E2=80=9D's error value=
s=2E (as bits)

=E2=80=A2 Perl's =E2=80=9Csysopen=E2=80=9D, =E2=80=9Cselect=E2=80=9D, and o=
thers. (if you know a perl example
that isn't related to unix, pls let me known)

=E2=80=A2 Second Life's Linden Scripting Language.
(see http://xahlee.org/sl/ls-prob.html )

A example of confusion about function's parameters is exhibited in
unix's bewildering, inconsist syntaxes in its command line tools's
ways of taking arguments. (some parameter influence other parameters.
Argument order sometimes matter, sometimes doesn't, sometimes causing
unintented output and sometimes causing syntax error. Named parameters
sometimes have the names optional(!). Named parameters that are
predicates sometimes act by their presence along, sometimes by their
value, sometimes accept both, sometimes causes syntax error. Some
defaults are supplied to unnamed parameters, and some are to named
parameters. Some parameters has synonyms. ...)

For another example in a more modern language, is Python's
=E2=80=9Cre.search()=E2=80=9D function for text pattern matching. Its optio=
nal third
parameter is a bitmask.  ( see =E2=80=9CRegular Expressions in Python=E2=80=
=9D
http://xahlee.org/perl-python/python_re-write/lib/node111.html )

As a example of not clearly understanding a function's parameters and
the need and role of named parameters in computing languages, Python's
=E2=80=9Csorted=E2=80=9D function as well as its =E2=80=9Clambda=E2=80=9D c=
onstruct are both victims.

(Further reading:
=E2=80=A2 =E2=80=9CSorting in Python and Perl=E2=80=9D
http://xahlee.org/perl-python/python_doc_sort.html

=E2=80=A2 =E2=80=9CPython Doc Problem Example: sort()=E2=80=9D
http://xahlee.org/perl-python/sort_list.html

=E2=80=A2 =E2=80=9CLambda in Python 3000=E2=80=9D
http://xahlee.org//perl-python/python_3000.html
)

Bitmask used as a function's parameter but not considered as a hack,
would be if it actually deals with bits necessarily (e.g. in protocols
that employ bits. (e.g. in networking), byte processing, binary digit
computation, ...)

I would appreciate other examples you know in the above languages, and
or in particular if Java, Lisp, Haskell.

----
This article is a modified excerpt from
=E2=80=9CLinden Scripting Language Problems=E2=80=9D at
http://xahlee.org/sl/ls-prob.html

  Xah
  xah@xahlee.org
=E2=88=91 http://xahlee.org/



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

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


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