[30493] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1736 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 21 14:09:49 2008

Date: Mon, 21 Jul 2008 11:09:12 -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, 21 Jul 2008     Volume: 11 Number: 1736

Today's topics:
    Re: C linked lists in Perl <rvtol+news@isolution.nl>
    Re: C linked lists in Perl <joost@zeekat.nl>
    Re: C linked lists in Perl <m@rtij.nl.invlalid>
    Re: C linked lists in Perl <m@rtij.nl.invlalid>
    Re: C linked lists in Perl <tzz@lifelogs.com>
    Re: comma puzzle <nick@maproom.co.uk>
    Re: Editing HTML Page <imanuk2007@googlemail.com>
    Re: how to change the effective UID <rtfm.rtfm.rtfm@gmail.com>
    Re: how to change the effective UID <rtfm.rtfm.rtfm@gmail.com>
    Re: how to change the effective UID <ben@morrow.me.uk>
    Re: how to change the effective UID <spamtrap@dot-app.org>
    Re: How to identify a 32 or 64 bit OS? <tzz@lifelogs.com>
    Re: Languages that don't suck after Perl? <wahab@chemie.uni-halle.de>
    Re: Languages that don't suck after Perl? <tadmc@seesig.invalid>
    Re: Languages that don't suck after Perl? <fawaka@gmail.com>
    Re: Languages that don't suck after Perl? <cwilbur@chromatico.net>
    Re: Languages that don't suck after Perl? <spamtrap@dot-app.org>
    Re: Languages that don't suck after Perl? <vtatila@gmailRemoveToReply.com>
    Re: Languages that don't suck after Perl? <jurgenex@hotmail.com>
    Re: Languages that don't suck after Perl? <tzz@lifelogs.com>
        Net::Ldap  pb with  SASL under multidomain MS Lan.  <jeancharles__and__g@free.fr.invalid>
    Re: Net::Ldap  pb with  SASL under multidomain MS Lan.  <jeancharles__and__g@free.fr.invalid>
    Re: Net::Ldap  pb with  SASL under multidomain MS Lan. <fawaka@gmail.com>
        Using WWW::Curl::Easy with Perl <alex.buell@munted.org.uk>
    Re: Using WWW::Curl::Easy with Perl <glex_no-spam@qwest-spam-no.invalid>
    Re: Using WWW::Curl::Easy with Perl <alex.buell@munted.org.uk>
    Re: Using WWW::Curl::Easy with Perl <glex_no-spam@qwest-spam-no.invalid>
    Re: Using WWW::Curl::Easy with Perl <alex.buell@munted.org.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 21 Jul 2008 12:00:27 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: C linked lists in Perl
Message-Id: <g61tue.168.1@news.isolution.nl>

Martijn Lievaart schreef:
> Uri Guttman:

>> and i want to kill the cow-orker who said perl has no linked lists.
>> or better, make him code in cobol for 10 years!
> 
> Better yet, make him implement linked lists in COBOL!

Here is an "over-the-heap" implementation: 
    http://www.ibmmainframes.com/about20758.html 
(150+ lines, incl. alloc and free and such) 


Some articles: 
http://home.swbell.net/mck9/cobol/tech/linklist.html 

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: Mon, 21 Jul 2008 12:16:14 +0200
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: C linked lists in Perl
Message-Id: <8763qzczkh.fsf@zeekat.nl>

"szr" <szrRE@szromanMO.comVE> writes:

> Joost Diepenmaat wrote:
>> But expect perl's garbage collector to get in your face if you create
>> giant linked lists. Not that you'd want to do that, anyway.
>
> Why would the GC get in the way? In a nutshell, it doesn't free 
> something until no one is referring to it anymore (the ref-count is 
> zero), so I'd imagine there would be no problem, or have you run into 
> issue in certain circumstances?

The problem is that perl's CG is buggy and relatively slow for large
linked lists (or any kind of deeply nested structure):

#!/usr/local/bin/perl -w
use strict;
$|=1;

sub test {
  print "Building list\n";
  my $head = [];
  my $tail = $head;
  for (0 .. 1000000) {
    $tail = ($tail->[1] = [$_]);
  }
  print "Exiting sub\n";
}

test();
print "Exiting program\n";

ouput:

Building list
Exiting sub
Segmentation fault

This is perl, v5.10.0 built for i686-linux-thread-multi


-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


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

Date: Mon, 21 Jul 2008 15:18:19 +0200
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: C linked lists in Perl
Message-Id: <pan.2008.07.21.13.18.18@rtij.nl.invlalid>

On Mon, 21 Jul 2008 12:00:27 +0200, Dr.Ruud wrote:

> Martijn Lievaart schreef:
>> Uri Guttman:
> 
>>> and i want to kill the cow-orker who said perl has no linked lists. or
>>> better, make him code in cobol for 10 years!
>> 
>> Better yet, make him implement linked lists in COBOL!
> 
> Here is an "over-the-heap" implementation:
>     http://www.ibmmainframes.com/about20758.html
> (150+ lines, incl. alloc and free and such)

OH! MY! GOD! Even sendmail.cf is readable compared to that.

M4


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

Date: Mon, 21 Jul 2008 15:23:16 +0200
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: C linked lists in Perl
Message-Id: <pan.2008.07.21.13.23.16@rtij.nl.invlalid>

On Mon, 21 Jul 2008 12:16:14 +0200, Joost Diepenmaat wrote:

> The problem is that perl's CG is buggy and relatively slow for large
> linked lists (or any kind of deeply nested structure):
> 
(snip)
> 
> This is perl, v5.10.0 built for i686-linux-thread-multi

[martijn@cow ~]$ perl -e '#!/usr/local/bin/perl -w
> use strict;
> $|=1;
> 
> sub test {
>   print "Building list\n";
>   my $head = [];
>   my $tail = $head;
>   for (0 .. 1000000) {
>     $tail = ($tail->[1] = [$_]);
>   }
>   print "Exiting sub\n";
> }
> 
> test();
> print "Exiting program\n";
> '
Building list
Exiting sub
Segmentation fault
[martijn@cow ~]$ perl -v

This is perl, v5.8.8 built for x86_64-linux-thread-multi

Same on v5.8.8 built for i386-linux-thread-multi

M4


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

Date: Mon, 21 Jul 2008 11:49:59 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: C linked lists in Perl
Message-Id: <86bq0ri3m0.fsf@lifelogs.com>

On Fri, 18 Jul 2008 14:10:44 -0700 "szr" <szrRE@szromanMO.comVE> wrote: 

s> Ted Zlatanov wrote:
>> On Thu, 17 Jul 2008 17:26:58 GMT Uri Guttman <uri@stemsystems.com>
>> wrote:
s> [...]
>> I really don't know how much more "built-in" linked lists can be than
>> what you find in Lisp, considering that code and data both are lists
>> and treated as such by the language, and you can construct either
>> dynamically.  At this point you're arguing that with Lisp you have an
>> assembled band saw (vs. Perl's Swiss Army knife or Java's
>> diesel-powered hammer-screwdriver) but you can't use it until you
>> plug it in.  Well, yeah, but that is not an argument worth having.

s> You forgot PHP's nuclear-powered 10,000 piece rachet set.  :-)

I tried to resist but you made me do it...

Emacs Lisp = the band saw everyone has lost a fingertip to
C = a club dotted with razor blades dipped in iodine "for better lubrication"
C++ = machine gun that shoots dandellions
Python = a Swedish Army knife
COBOL = enough rubber bands WILL shoot you to the moon, apparently
Fortran = a calculator embedded in a rock
HTML/CSS/Javascript = a flail that keeps flinging back at you
APL = a unicorn horn
Ruby = Lisp's band saw and Perl's army knife used to decorate a princess
       birthday cake ("so cute!")

Ted


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

Date: Mon, 21 Jul 2008 13:52:48 +0100
From: Nick Wedd <nick@maproom.co.uk>
Subject: Re: comma puzzle
Message-Id: <3a3ZaLugaIhIFAk7@maproom.demon.co.uk>

In message <20080720194305.759$GD@newsreader.com>, xhoster@gmail.com 
writes
>Nick Wedd <nick@maproom.co.uk> wrote:
>> In message <slrng86i28.chm.tadmc@tadmc30.sbcglobal.net>, Tad J McClellan
>> <tadmc@seesig.invalid> writes
>>
>> >
>> >There are *two* variables named $i in your code.
>> >
>> >"my $i=1" and "print $i" refer to the lexical variable named $i.
>> >
>> >"$i<10" and "$i++" refer to the package variable named $i (ie.
>> >$main::i).
>>
>> I see.  I have been in the habit of writing things like
>>
>> for ( my $suit=0 ; $suit<4 ; $suit++ )
>>
>> and assuming they did the same as
>>
>> my $i;
>> for ( $suit=0 ; $suit<4 ; $suit++ )
>
>They will be different in that in the first one, $i goes out of
>scope after the loop, while in the second one it doesn't.  So which
>one to use depends on whether you want to access $i after the loop
>is done (for example, if the loop can end with a "last", and afterwards you
>want to know what value of $i triggered this termination.
>
>
>> Generally they have behaved as I intended.  But now I see that I have
>> been lucky.  I guess I was copying the C style:
>>
>> for ( int suit=0 ; suit<4 ; suit++ )
>>
>> in which the variable declared is the same as the one compared and
>> incremented
>
>When you properly use ';', then Perl uses the same one as well.  Only
>when you improperly use ',', does it access different variables.  (And if
>you used strict, it would probably have notified you of this.)
>
>The variable declared by my isn't ready for separate use until the next
>statement.  ";" is a statement separator, "," is not.

Yes, it makes sense now.  Thank you for this clear explanation.

Nick
-- 
Nick Wedd    nick@maproom.co.uk


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

Date: Mon, 21 Jul 2008 02:24:34 -0700 (PDT)
From: invincible <imanuk2007@googlemail.com>
Subject: Re: Editing HTML Page
Message-Id: <584637e7-182a-44d5-abd0-479061414eb5@z72g2000hsb.googlegroups.com>

On Jul 18, 11:55 pm, Bill H <b...@ts1000.us> wrote:
> On Jul 18, 2:20 pm,invincible<imanuk2...@googlemail.com> wrote:
>
>
>
> > All,
>
> > I have a problem which I thought of discussing with you lot so as to
> > get your views on the solution.
>
> > In my intranet there is an section where we have our customer details.
> > This is fairly straight as all the details are saved in customer.log
> > file on the unix directory.
>
> > There is one index.cgi file which has certain columns which allow us
> > to add customer and search by several fields including customer name,
> > location etc.
>
> > Now the PROBLEM:  We do not have any cgi script to edit these details.
> > As told before the details are stored in
> > customer.log file and I suppose I would have to create a link in
> > index.cgi to edit all the details displayed .
>
> > Would somebody be able to let me know how to change these details ,
> > creating a new link in index.cgi.
>
> > Sample fields in the index.cgi is as below.
>
> > <tr><td>Almstrong</td><td>Cust Name</td><td>Shit Bing</td><td>Liabel
> > Support Team</td><td>Number:</td></tr>
> > <tr><td>Almstrong</td><td>Cust Name</td><td>Dove Solo</td><td>Liabel
> > Support Team</td><td>Number:</td></tr>
>
> > Any help would be greatly appreciated.
>
> > Ciao.
>
> Did you type this in or do you really have a field called "<td>Shit
> Bing</td>"?
>
> Bill H

It ws just for testing


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

Date: Mon, 21 Jul 2008 20:49:10 +0400
From: Daneel Yaitskov <rtfm.rtfm.rtfm@gmail.com>
Subject: Re: how to change the effective UID
Message-Id: <g62ep3$qsf$1@aioe.org>

Leon Timmermans wrote:
> In that case the problem seems to be that you're not running as root. 
Ho! The suid flag exists that a process with the normal rights could 
take the super rights.

In short, I have taken luck. The perl printed the notice, suid isn't 
supported, to me when I had seted the suid to $(which perl). It offered 
the following variants:

1) to use a wrap in C
2) to start the perl with the -u option (dump) and then to generate the 
true program from the dump with help the undump program.


Daneel


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

Date: Mon, 21 Jul 2008 21:00:41 +0400
From: Daneel Yaitskov <rtfm.rtfm.rtfm@gmail.com>
Subject: Re: how to change the effective UID
Message-Id: <g62fem$t9g$1@aioe.org>

Sherman Pendley wrote:
> Many operating systems don't allow setuid scripts for security
> reasons. Have you tried checking the value of $< to see if you're
> *really* running as root? Have you tried running your script with sudo
> or su, to see if it behaves correctly that way?
> 
> sherm--
> 

The script works good with the super rights. I found a solve of the 
problem. See my answer to Leon Timmermans above.

Daneel


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

Date: Mon, 21 Jul 2008 18:19:18 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: how to change the effective UID
Message-Id: <m1tel5-8tc.ln1@osiris.mauzo.dyndns.org>


Quoth Daneel Yaitskov <rtfm.rtfm.rtfm@gmail.com>:
> Leon Timmermans wrote:
> > In that case the problem seems to be that you're not running as root. 
> Ho! The suid flag exists that a process with the normal rights could 
> take the super rights.
> 
> In short, I have taken luck. The perl printed the notice, suid isn't 
> supported, to me when I had seted the suid to $(which perl). It offered 
> the following variants:

Yow! *DON'T* make /usr/bin/perl set-uid. That would be a major security
problem.

Are you sure you ought to be writing programs which run setid? I think
you should learn a little more about writing secure systems before you
start randomly making things setuid root.

> 1) to use a wrap in C
> 2) to start the perl with the -u option (dump) and then to generate the 
> true program from the dump with help the undump program.

If your system doesn't support setid scripts (because of a long-standing
kernel security hole), you can use suidperl to emulate them. But, again,
you *really* need to better understand the security implications of what
you are doing before you try this.

Ben

-- 
The Earth is degenerating these days. Bribery and corruption abound.
Children no longer mind their parents, every man wants to write a book,
and it is evident that the end of the world is fast approaching.
       Assyrian stone tablet, c.2800 BC                        ben@morrow.me.uk


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

Date: Mon, 21 Jul 2008 13:34:29 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: how to change the effective UID
Message-Id: <m11w1ni1ju.fsf@dot-app.org>

Daneel Yaitskov <rtfm.rtfm.rtfm@gmail.com> writes:

> Leon Timmermans wrote:
>> In that case the problem seems to be that you're not running as
>> root. 
> Ho! The suid flag exists that a process with the normal rights could
> take the super rights.

*Some* processes. On many operating systems, it's not supported for
scripts - that is, anything that begins with a #!. On those OSes,
only binaries can be run as setuid - hence the workaround of writing
a compiled C "wrapper" for your script.

sherm--

-- 
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Mon, 21 Jul 2008 11:59:20 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: How to identify a 32 or 64 bit OS?
Message-Id: <86zlobgolz.fsf@lifelogs.com>

On Mon, 21 Jul 2008 01:58:08 +0000 (UTC) Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote: 

IZ> [A complimentary Cc of this posting was sent to
IZ> sisyphus 
IZ> <sisyphus359@gmail.com>], who wrote in article <6de96735-4e00-43e3-8433-02f8c9d0651b@v21g2000pro.googlegroups.com>:

>> And even if $Config{d_longlong} eq 'define', I find that quad
>> operations will not work unless $Config{ivsize} =3D=3D 8.

IZ> As I said: as expected without my patch.

I mentioned it on perl5-porters and CC-d you but the mail bounced.  Do
you want to put the effort into putting something together?

Ted


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

Date: Mon, 21 Jul 2008 11:37:43 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: Languages that don't suck after Perl?
Message-Id: <g61ld6$2or5$1@nserver.hrz.tu-freiberg.de>

Tim Smith wrote:
> I've found that as I've spent more time in Perl, my tolerance for other 
> languages has gone down.  I keep finding myself muttering "why is this 
> stupid language making me go through so much work just make a simple 
> data structure that I only will need for a few lines?" or "why is it so 
> damned hard in this language to take this hash of names and values and 
> turn it into an SQL insert statement to store these values in my table?".
> 
> Java seems particularly annoying after Perl, if I'm trying to do any 
> text processing or database work.
> 
> Has anyone else noticed this?  If so, what languages have you found are 
> not annoying after Perl?

For Perl's usual problem domain, none.

If speed is important, I'd say that contemporary C++ starts
to get somehow usable, especially after the Boost libraries
became mature and widely available.

After starting with using Boost::Regex, this made me
completely drop the "Embedding Perl" approach. But
getting along with the intricacies of C++ and Boost
requires a deep understanding of the language and
hard work to get it work.

Regarding Hashes, there is the good old C++ hash_map imple-
mentation available (used to be in std or std/ext) - this is
(about as ) fast (as Perl's hashes). Same point as above - you
need to  know what to do and where to search for stuff in
order to get along.

Even some Perl idioms (map, grep) can be approximated
using STL container algorithms.

In my opinian, C++ is somehow 'perlish' because it
supports TIMTOWTDI.

my €0.02

Regards

M.


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

Date: Mon, 21 Jul 2008 06:09:38 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Languages that don't suck after Perl?
Message-Id: <slrng88rji.lal.tadmc@tadmc30.sbcglobal.net>

Tim Smith <reply_in_group@mouse-potato.com> wrote:

> I've found that as I've spent more time in Perl, my tolerance for other 
> languages has gone down.  I keep finding myself muttering "why is this 
> stupid language making me go through so much work just make a simple 
> data structure that I only will need for a few lines?" or "why is it so 
> damned hard in this language to take this hash of names and values and 
> turn it into an SQL insert statement to store these values in my table?".
>
> Java seems particularly annoying after Perl, if I'm trying to do any 
> text processing or database work.
>
> Has anyone else noticed this?


I tell people:

   Using Perl is like digging a ditch with a backhoe.

   Using C is like digging a ditch with a shovel.

   Using Java is like digging a ditch with a spoon.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Mon, 21 Jul 2008 13:21:27 +0200
From: Leon Timmermans <fawaka@gmail.com>
Subject: Re: Languages that don't suck after Perl?
Message-Id: <a9bcb$48847137$89e0e08f$11251@news1.tudelft.nl>

On Mon, 21 Jul 2008 11:37:43 +0200, Mirco Wahab wrote:
> 
> For Perl's usual problem domain, none.
> 

Full agreement.

> If speed is important, I'd say that contemporary C++ starts to get
> somehow usable, especially after the Boost libraries became mature and
> widely available.
> 

I concur.

> After starting with using Boost::Regex, this made me completely drop the
> "Embedding Perl" approach.

Actually, I'm working on making embedding perl into C++ easier.

> But getting along with the intricacies of C++
> and Boost requires a deep understanding of the language and hard work to
> get it work.

True. C++ is a big language. Once you really know it it's a bliss, but 
halfway many people seem to hate its syntactic complexity. Then again, 
same has been said of Perl.

> Regarding Hashes, there is the good old C++ hash_map implementation
> available (used to be in std or std/ext) - this is (about as ) fast (as
> Perl's hashes). Same point as above - you need to  know what to do and
> where to search for stuff in order to get along.

The new and official (since TR1) version is called unsorted_map.

> Even some Perl idioms (map, grep) can be approximated using STL
> container algorithms.
> 

Yeah, though the method (explicit iterators) is quite different.

> In my opinian, C++ is somehow 'perlish' because it supports TIMTOWTDI.
> 

Yeah, though there's something else too. Like Perl and unlike many 
languages (Java and PHP in particular), it has very orthogonal 
containers (it doesn't try to pretend arrays and hashes have too much in 
common). I very much prefer that.

Regards,

Leon Timmermans


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

Date: Mon, 21 Jul 2008 09:37:36 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Languages that don't suck after Perl?
Message-Id: <86ljzv8ijj.fsf@mithril.chromatico.net>

>>>>> "TS" == Tim Smith <reply_in_group@mouse-potato.com> writes:

    TS> I've found that as I've spent more time in Perl, my tolerance
    TS> for other languages has gone down.  [...] Has anyone else
    TS> noticed this?  If so, what languages have you found are not
    TS> annoying after Perl?

It depends largely on the problem.  For quick text wrangling and
database access, it's hard to beat Perl.  But if you want to do
low-level text processing (like an LALR parser), native UIs, or
low-level bit twiddling, Perl gets frustrating quickly itself.  

(For most of those, I'd go to C or Objective-C.)

Also, if you rely on the language to enforce discipline (which is an
attribute of many corporate shops), Perl is best avoided, because it
relies on the programmer to enforce discipline.   The best argument in
favor of Java in the 'enterprise' is 500 lines of Perl code written by
an ignoramus who fancies himself a hacker.

Charlton




-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Mon, 21 Jul 2008 10:45:00 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: Languages that don't suck after Perl?
Message-Id: <m1bq0re1oz.fsf@dot-app.org>

Tim Smith <reply_in_group@mouse-potato.com> writes:

> Has anyone else noticed this?  If so, what languages have you found are 
> not annoying after Perl?

For many of the tasks for which I'd use Perl - none. I don't find
Python or Ruby to be annoying, but neither do I see them offering
anything I can't already do in Perl.

For mid-level code, I like Objective-C. Dynamic typing and message
passing help make it much less annoying than C++. Still no central
location for class libraries though, which is mildly annoying. CPAN
is, IMHO, one of the most essential ingredients in Perl's recipe for
non-annoyance.

sherm--

-- 
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Mon, 21 Jul 2008 18:18:35 +0300
From: "Veli-Pekka Tätilä" <vtatila@gmailRemoveToReply.com>
Subject: Re: Languages that don't suck after Perl?
Message-Id: <4884a877$0$25384$9b536df3@news.fv.fi>

Tim Smith wrote:
> I've found that as I've spent more time in Perl, my tolerance for other
> languages has gone down.  I keep finding myself muttering "why is this
> stupid language making me go through so much work just make a simple
> data structure that I only will need for a few lines?" <snippage>
> what languages have you found are not annoying after Perl?
I might get flamed for this <shy smile>, but for me, Lua was such a 
language. I had to pick it up recently and after an initial great dislike 
that had to do with lack of programmer convenience and the Perlish TIMTOWTDI 
I found myself greatly enjoying its simplicity and minimalism, even 
preffering it to Perl at times given some small convenience wrappers. To me 
it is a clean redesign of many of the cool, core mechanisms already in perl 
with a much more orthogonal and less messy legacy-free design. It was about 
the quickest language for me to learn, ever, since there's so much I've 
learned in Perl over the years that can be directly applied in a Lua 
context. I guess this is true for many other dynamically typed langs, 
though.

Frankly, I'm happy that when I program in Lua I have a feeling I've mastered 
most of the language well, and can hold a significant subset in my head, 
where as I always have to go and re-read the man page for the more obscure 
Perlisms whose limitations and obscurities annoy me.

Lua is also very clean and punctuation free syntactically, which is an 
important difference if you ever have to code legally blind based on 
synthetic speech and Braille, granted this is very unlikely. Perl regexp, 
which I love for saving me from having to cursor through text linearly with 
speech in my text editor, are about the most horrible speech read, though, 
you have to go character by character to parse them mentally with a naive 
screen reader like Hal for Windows or Gnome's Orca.

Here are some examples of Perl and Lua similarities. If you know Perl 
hashes, Lua hashes work much the same. Except that they can be indexed with 
any type other than nil (undef), including ints for fast arrays. And in 
stead of type globs and packages, you have just global hashes mapping 
strings to data and a bit of syntactic sugar. Rather than explicit 
dereffing, you have separate, very simple ref types for tables, functions 
etc..

Again, Lua OOp after Perl was quite palatable: classes and objects are 
hashes. Rather than blessing, just overload indexing on a per object basis 
such that it looks in the class hash for methods and data fields not found 
in the object. You can also give a code ref for multiple inheritance, 
autoloading, or whatever rather than a hash to look missing fields in. In 
Lua, Accessing string keys of a hash with a dot and calling functions like 
methods, are just a bit of true syntactic sugar around indexing a hash and 
passing the invocant as the first arg. Where Perl has ISA, Overload, bless, 
tie, package etc... all Lua has are tables, and the ability to set their 
operations.

In fact I've written a bit of a conversion guide for folks who already know 
Perl and need to learn Lua for one reason or another. This works best for 
folks who have a similar, rather informal way of thinking of coding,than I 
do:

http://vtatila.kapsi.fi/luatut.html

Be warned this is just an initial version, and I'm only an intermediate 
Perler rather new to Lua. Still, loads of shortcuts can be taken if you know 
Perl. here's my explanation of Lua patterns, which is not long:

Quote
Quantifiers and Character Classes
The primary simplification is that a quantifier may only follow a character 
class, you cannot quantify a parenthesize subexpression or a capturing 
group. *, question ? and + work exactly like their greedy counter parts in 
regexp. The only other quantifier is minus - which is like the lazy star, *?

Character classes are locale sensitive in Lua and Perl. Syntactically, in 
stead of backslashing symbols, you use the percent sign for the same thing. 
%a, %u and %l for alphabetic, caps and lowwercase letters, %d and %x for 
ordinary and hex digits, %c, %p and %z for control, punctuation and null 
characters. Uppercased versions of these classes are the complements, much 
as in Perl. Additionally, %% is a percent sign and the dot %. is any 
character, including new lines, unlike in regexp by default.

Bracketed sets of characters including character ranges and classes as part 
of them can be used much as in regexp. Exception: you cannot augment a 
character class with a range. You can, however, invert a range with a 
leading caret [^...].

Finally, lua patterns may also contain %b followed by two characters. The 
construct will match an expression with the counts of these characters being 
balanced, e.g. %b() for matching nested parens. Again, a balanced expression 
may not be quantified but may be captured.

Capturing Groups and Anchors
Parens in Lua patterns neither group nor change precedence, they only 
surround bits of patterns to be captured. captured are numbered from 1 
onwards and referred to in the same pattern as %1, %2 and so on. %0 in a 
replacement is the whole matched string. An empty pair of parens 
exceptionally captures the 1-based match position in stead.

The only anchors in Lua patterns are the caret ^and dollar $, which always 
only anchor at the beginning and end of the whole pattern, new lines in 
matched text don't affect their meaning.
End quote.

-- 
With kind regards Veli-Pekka Tätilä
Accessibility, Apps and Coding plus Synths and Music:
http://vtatila.kapsi.fi




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

Date: Mon, 21 Jul 2008 15:58:05 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Languages that don't suck after Perl?
Message-Id: <bpb984hl510uvdvrovsp5kr8gl1gkiveht@4ax.com>

Tim Smith <reply_in_group@mouse-potato.com> wrote:
>
>I've been mostly programming in Perl for several years.  Not fancy Perl.  
>Just keeping it simple, so that any maintenance programmer that comes 
>after me will only need to be an intermediate Perl programmer to 
>understand the code.
>
>I've found that as I've spent more time in Perl, my tolerance for other 
>languages has gone down.  I keep finding myself muttering "why is this 
>stupid language making me go through so much work just make a simple 
>data structure that I only will need for a few lines?"

A large part of your annoyance with other languages comes from you being
familiar with Perl at this time and you are thinking in Perl, and
therefore you are trying to mentally translate a Perl script into a
program in some other language. This happens on a subconcious level and
most likely you are not even aware of it.

It is just like learning a new language. As long as you are thinking in
your native language you will form a sentence in your native language
and then try to translate it. Ain't gonna work that way. You will always
run into "why is that language so awkward!" 
Once you are familiar enough with the new language to think in that
language, then you realize that things are simply expressed in a
different way and it's not more awkward than your own, it is just
different. This becomes very apparent when trying to translate in the
opposite direction. Suddenly your native language is so awkward to use
because again you are translating between languages instead of thinking
in the right language from the beginning.

jue


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

Date: Mon, 21 Jul 2008 11:57:13 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Languages that don't suck after Perl?
Message-Id: <864p6ji39y.fsf@lifelogs.com>

On Sun, 20 Jul 2008 23:24:03 -0700 Tim Smith <reply_in_group@mouse-potato.com> wrote: 

TS> I've found that as I've spent more time in Perl, my tolerance for other 
TS> languages has gone down.  I keep finding myself muttering "why is this 
TS> stupid language making me go through so much work just make a simple 
TS> data structure that I only will need for a few lines?" or "why is it so 
TS> damned hard in this language to take this hash of names and values and 
TS> turn it into an SQL insert statement to store these values in my table?".

TS> Java seems particularly annoying after Perl, if I'm trying to do any 
TS> text processing or database work.

TS> Has anyone else noticed this?  If so, what languages have you found are 
TS> not annoying after Perl?

I feel the same with Lisp, which is almost as comfortable for me as
Perl.  Also, SQL is actually a very nice language for some tasks, and
learning it gives a fresh perspective on Perl and others.  I'd recommend
those two if you're interested in learning more.  Ruby may also be of
interest to you.

If I find myself wondering why a language doesn't provide X, I often
find that X is not the best approach in that language.  C-style macros,
for example, are not a part of Perl and they are very convenient, but
Perl doesn't need them in 99% of the cases.

Ted


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

Date: Mon, 21 Jul 2008 16:38:16 +0200
From: "jean-charles Gibier" <jeancharles__and__g@free.fr.invalid>
Subject: Net::Ldap  pb with  SASL under multidomain MS Lan. 
Message-Id: <48849f97$0$24362$426a74cc@news.free.fr>

Hello,

I had to connect several Ldap servers under MS Lan via Net::Ldap module
My Attempts fails and I receive an "invalid credential".
I suspect that SASL layer does not handle this service as SSPI does.
Can someone confirm ?
Is there any other solution to do that ?




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

Date: Mon, 21 Jul 2008 16:44:35 +0200
From: "jean-charles Gibier" <jeancharles__and__g@free.fr.invalid>
Subject: Re: Net::Ldap  pb with  SASL under multidomain MS Lan. 
Message-Id: <4884a112$0$10994$426a74cc@news.free.fr>


"jean-charles Gibier" <jeancharles__and__g@free.fr.invalid> a écrit dans le 
message de news: 48849f97$0$24362$426a74cc@news.free.fr...
> Hello,
>
> I had to connect several Ldap servers under MS Lan via Net::Ldap module

I forgot :
several ldap servers "located in external ms domains"


> My Attempts fails and I receive an "invalid credential".
> I suspect that SASL layer does not handle this service as SSPI does.
> Can someone confirm ?
> Is there any other solution to do that ?
>
> 




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

Date: Mon, 21 Jul 2008 17:39:31 +0200
From: Leon Timmermans <fawaka@gmail.com>
Subject: Re: Net::Ldap  pb with  SASL under multidomain MS Lan.
Message-Id: <b1e2d$4884adb3$89e0e08f$21095@news1.tudelft.nl>

On Mon, 21 Jul 2008 16:38:16 +0200, jean-charles Gibier wrote:

> Hello,
> 
> I had to connect several Ldap servers under MS Lan via Net::Ldap module
> My Attempts fails and I receive an "invalid credential". I suspect that
> SASL layer does not handle this service as SSPI does. Can someone
> confirm ?
> Is there any other solution to do that ?

Really, we can't help you if you give that little information. Can you 
give a little more. A code sample, some information about how the AD is 
configured, etc...

Leon Timmermans


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

Date: Mon, 21 Jul 2008 14:21:49 +0100
From: Alex Buell <alex.buell@munted.org.uk>
Subject: Using WWW::Curl::Easy with Perl
Message-Id: <20080721142149.c66a719e.alex.buell@munted.org.uk>

Hi,

Does anyone in here have a good working knowledge of using the
WWW::Curl::Easy module with Perl? Basically, my problem is that I have
been trying to download a file using the WWW::Curl::Easy module without
any success, in a Perl cgi-bin. 

For some reason, it is not putting the requested data into a file,
instead I get it printed on the page itself. 

Any ideas why?

---cut here---
#!/usr/bin/perl

use WWW::Curl::Easy;
use CGI;

use strict;

my $cgi = new CGI;

print $cgi->header;
print $cgi->start_html("downloader");

my $file = "temp/" . $$ . "sitemap.gz";
my $url = "http://www.talkcycling.co.uk/sitemap_index.xml.gz";

my $curl = WWW::Curl::Easy->new;

print $cgi->p("[" . $url . "][" . $file . "]");

$curl->setopt(CURLOPT_URL, $url);
$curl->setopt(CURLOPT_CONNECTTIMEOUT, 5);
$curl->setopt(CURLOPT_TIMEOUT, 120);
$curl->setopt(CURLOPT_REFERER, "Fubra_Sitemap_Validator");
$curl->setopt(CURLOPT_WRITEDATA, 0);

open SITEMAP, "> $file";
$curl->setopt(CURLOPT_FILE, *SITEMAP);

my $return_code = $curl->perform;
my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE);

print $cgi->p("DEBUG [" . $response_code . "][" . $return_code . "]");
print $cgi->p($curl->strerror($return_code));

if ($response_code <= 400 && $return_code == 0)
{
        print $cgi->p("success");
}

close SITEMAP;
$curl->cleanup();
---cut here---


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

Date: Mon, 21 Jul 2008 11:32:54 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Using WWW::Curl::Easy with Perl
Message-Id: <4884ba36$0$48227$815e3792@news.qwest.net>

Alex Buell wrote:
> Hi,
> 
> Does anyone in here have a good working knowledge of using the
> WWW::Curl::Easy module with Perl? 

What other language would you use a Perl module?  :-)


 > Basically, my problem is that I have
> been trying to download a file using the WWW::Curl::Easy module without
> any success, in a Perl cgi-bin.

No such thing as "a Perl cgi-bin". :-)

> 
> For some reason, it is not putting the requested data into a file,
> instead I get it printed on the page itself. 
> 
> Any ideas why?

Never used it before, it's only a couple lines when using LWP, but...

> 
> ---cut here---
> #!/usr/bin/perl
> 
> use WWW::Curl::Easy;
> use CGI;
> 
> use strict;
> 
> my $cgi = new CGI;
> 
> print $cgi->header;
> print $cgi->start_html("downloader");
> 
> my $file = "temp/" . $$ . "sitemap.gz";
> my $url = "http://www.talkcycling.co.uk/sitemap_index.xml.gz";
> 
> my $curl = WWW::Curl::Easy->new;
> 
> print $cgi->p("[" . $url . "][" . $file . "]");
> 
> $curl->setopt(CURLOPT_URL, $url);
> $curl->setopt(CURLOPT_CONNECTTIMEOUT, 5);
> $curl->setopt(CURLOPT_TIMEOUT, 120);
> $curl->setopt(CURLOPT_REFERER, "Fubra_Sitemap_Validator");
> $curl->setopt(CURLOPT_WRITEDATA, 0);

I'd guess that's the problem.  Comment out that last line. Don't
set CURLOPT_WRITEDATA to 0.

> 
> open SITEMAP, "> $file";

And if open() fails?

> $curl->setopt(CURLOPT_FILE, *SITEMAP);
> 
> my $return_code = $curl->perform;
> my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE);
> 
> print $cgi->p("DEBUG [" . $response_code . "][" . $return_code . "]");
> print $cgi->p($curl->strerror($return_code));
> 
> if ($response_code <= 400 && $return_code == 0)
> {
>         print $cgi->p("success");
> }
> 
> close SITEMAP;
> $curl->cleanup();
> ---cut here---


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

Date: Mon, 21 Jul 2008 17:36:17 +0100
From: Alex Buell <alex.buell@munted.org.uk>
Subject: Re: Using WWW::Curl::Easy with Perl
Message-Id: <20080721173617.960f1726.alex.buell@munted.org.uk>

On Mon, 21 Jul 2008 11:32:54 -0500
"J. Gleixner" <glex_no-spam@qwest-spam-no.invalid> wrote:

> > $curl->setopt(CURLOPT_URL, $url);
> > $curl->setopt(CURLOPT_CONNECTTIMEOUT, 5);
> > $curl->setopt(CURLOPT_TIMEOUT, 120);
> > $curl->setopt(CURLOPT_REFERER, "Fubra_Sitemap_Validator");
> > $curl->setopt(CURLOPT_WRITEDATA, 0);
> 
> I'd guess that's the problem.  Comment out that last line. Don't
> set CURLOPT_WRITEDATA to 0.

Oh, I took that out, still didn't work.

> > 
> > open SITEMAP, "> $file";
> 
> And if open() fails?

Added a die but still refuses to work. For now I call out to the curl
executable to do the work but I'd really like to get this one solved!

Regards,
Alex


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

Date: Mon, 21 Jul 2008 12:09:06 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Using WWW::Curl::Easy with Perl
Message-Id: <4884c2b3$0$48222$815e3792@news.qwest.net>

Alex Buell wrote:
> On Mon, 21 Jul 2008 11:32:54 -0500
> "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid> wrote:
> 
>>> $curl->setopt(CURLOPT_URL, $url);
>>> $curl->setopt(CURLOPT_CONNECTTIMEOUT, 5);
>>> $curl->setopt(CURLOPT_TIMEOUT, 120);
>>> $curl->setopt(CURLOPT_REFERER, "Fubra_Sitemap_Validator");
>>> $curl->setopt(CURLOPT_WRITEDATA, 0);
>> I'd guess that's the problem.  Comment out that last line. Don't
>> set CURLOPT_WRITEDATA to 0.
> 
> Oh, I took that out, still didn't work.
> 
>>> open SITEMAP, "> $file";
>> And if open() fails?
> 
> Added a die but still refuses to work. For now I call out to the curl
> executable to do the work but I'd really like to get this one solved!
> 
> Regards,
> Alex

How about:

$curl->setopt(CURLOPT_FILE, \*SITEMAP);


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

Date: Mon, 21 Jul 2008 18:12:45 +0100
From: Alex Buell <alex.buell@munted.org.uk>
Subject: Re: Using WWW::Curl::Easy with Perl
Message-Id: <20080721181245.5dd9ec91.alex.buell@munted.org.uk>

On Mon, 21 Jul 2008 12:09:06 -0500
"J. Gleixner" <glex_no-spam@qwest-spam-no.invalid> wrote:

> $curl->setopt(CURLOPT_FILE, \*SITEMAP);

Hooray!!

That worked!

Regards,
Alex


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

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


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