[31440] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2692 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 25 06:09:43 2009

Date: Wed, 25 Nov 2009 03:09:05 -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           Wed, 25 Nov 2009     Volume: 11 Number: 2692

Today's topics:
    Re: How to get at the perl options <derykus@gmail.com>
    Re: perl hash: low-level implementation details? <nospam-abuse@ilyaz.org>
    Re: perl hash: low-level implementation details? <xhoster@gmail.com>
    Re: Problem parsing HTML <tadmc@seesig.invalid>
    Re: Problem parsing HTML <nickli2000@gmail.com>
    Re: Problem parsing HTML <tadmc@seesig.invalid>
    Re: Problem parsing HTML <nickli2000@gmail.com>
    Re: Why is "use 5.010" necessary <abc@def.com>
    Re: Why is "use 5.010" necessary <ben@morrow.me.uk>
    Re: Why is "use 5.010" necessary <uri@StemSystems.com>
    Re: Why is "use 5.010" necessary <abc@def.com>
    Re: Why is "use 5.010" necessary <ben@morrow.me.uk>
    Re: Why is "use 5.010" necessary <rvtol+usenet@xs4all.nl>
    Re: Why is "use 5.010" necessary <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 25 Nov 2009 01:59:09 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: How to get at the perl options
Message-Id: <6b686422-c9b6-4982-8de2-ddd2f81219fe@u25g2000prh.googlegroups.com>

On Nov 23, 1:53=A0pm, Ted Zlatanov <t...@lifelogs.com> wrote:
> On Sun, 22 Nov 2009 22:41:47 +0000 Ben Morrow <b...@morrow.me.uk> wrote:
> ...
> BM> Or just write a little bit of XS to grab PL_origargv and PL_origargc.
> BM> You need to make sure you look at them before anyone gets a chance to
> BM> assign to $0, though, since those assignments reuse that memory (for
> BM> obvious reasons).
>
> Ilya, would that be sufficient in your opinion? =A0Devel::OriginalARGV?
> I'll write it if no one else wants to.
>
> I can't think of plausible security issues, since the script can already
> look at the process list in almost all cases as Oliver and others
> pointed out. =A0Any opinions?

Great idea.  I'm sure it would delight many more
if it were a magic variable from the Perl core
but that's a mission for another day  :)

--
Charles DeRykus


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

Date: Wed, 25 Nov 2009 03:25:19 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: perl hash: low-level implementation details?
Message-Id: <slrnhgp8sv.rau.nospam-abuse@powdermilk.math.berkeley.edu>

On 2009-11-24, Xho Jingleheimerschmidt <xhoster@gmail.com> wrote:
> I'd guess roughly it comes up to something like: 48 bytes for the key 
> and associated structure, 40 bytes for the value-scalar (which holds an 
> arrayref), 160 bytes for the array overhead, and 48 bytes for each 
> scalar (usually 1) inside each array.

???  Where do you get these numbers?  On 32-bit machine, it is 16 bytes
per scalar (more for strings), and 40 bytes + 4*num_elts for array
envelop.

Ilya


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

Date: Tue, 24 Nov 2009 19:53:54 -0800
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: perl hash: low-level implementation details?
Message-Id: <4b0cabd2$0$30653$ed362ca5@nr5-q3a.newsreader.com>

Ilya Zakharevich wrote:
> On 2009-11-24, Xho Jingleheimerschmidt <xhoster@gmail.com> wrote:
>> I'd guess roughly it comes up to something like: 48 bytes for the key 
>> and associated structure, 40 bytes for the value-scalar (which holds an 
>> arrayref), 160 bytes for the array overhead, and 48 bytes for each 
>> scalar (usually 1) inside each array.
> 
> ???  Where do you get these numbers?

Memory of past experiments, and a little guessing.

> On 32-bit machine, 

He isn't using a 32 bit machine.

Xho


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

Date: Tue, 24 Nov 2009 15:19:24 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Problem parsing HTML
Message-Id: <slrnhgoj97.irh.tadmc@tadbox.sbcglobal.net>


[ Please do not full quote.
  Quote only enough to provide context for your comments.
  Please see the Posting Guidelines that are posted here frequently.
]

Ninja Li <nickli2000@gmail.com> wrote:
> On Nov 24, 2:32 pm, Tad McClellan <ta...@seesig.invalid> wrote:

[snip]

>> my $html = get 'http://biz.yahoo.com/c/e.html';
              ^^^
              ^^^

[snip]

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


You are not supposed to quote .sigs either...


> however I didn't get any output.


> my $html = 'http://www.earnings.com/conferencecall.asp?client=cb';


Try this:

    print $html;

and see if that doesn't give you hint...


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


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

Date: Tue, 24 Nov 2009 13:48:32 -0800 (PST)
From: Ninja Li <nickli2000@gmail.com>
Subject: Re: Problem parsing HTML
Message-Id: <bdcbea6f-af84-46b4-8c04-54154c641f25@x15g2000vbr.googlegroups.com>

Tad,

  Maybe I am too slow on this, print $html only shows the web link,
right? I can confirm it does contain valid data. Could you give more
details?

  Thanks.

  Nick


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

Date: Tue, 24 Nov 2009 16:03:13 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Problem parsing HTML
Message-Id: <slrnhgolrd.j62.tadmc@tadbox.sbcglobal.net>

Ninja Li <nickli2000@gmail.com> wrote:

>   print $html only shows the web link,


And what _should_ it show?

It should contain HTML, not a URL.

Why does it contain the URL instead of HTML that was fetched
from that URL?


> I can confirm it does contain valid data. 


If $html does not contain <html>, then it does NOT contain valid data.


> Could you give more
> details?


Did you see the part of my code that I underlined in my followup?

Does your code have the part that was underlined?

You will smack your forehead when you see the mistake you've made...

:-)


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


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

Date: Tue, 24 Nov 2009 14:44:16 -0800 (PST)
From: Ninja Li <nickli2000@gmail.com>
Subject: Re: Problem parsing HTML
Message-Id: <034ba05f-b65b-4a9a-8573-3b5f55fc4664@m11g2000vbo.googlegroups.com>

On Nov 24, 5:03=A0pm, Tad McClellan <ta...@seesig.invalid> wrote:
> Ninja Li <nickli2...@gmail.com> wrote:
> > =A0 print $html only shows the web link,
>
> And what _should_ it show?
>
> It should contain HTML, not a URL.
>
> Why does it contain the URL instead of HTML that was fetched
> from that URL?
>
> > I can confirm it does contain valid data.
>
> If $html does not contain <html>, then it does NOT contain valid data.
>
> > Could you give more
> > details?
>
> Did you see the part of my code that I underlined in my followup?
>
> Does your code have the part that was underlined?
>
> You will smack your forehead when you see the mistake you've made...
>
> :-)
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"

Thanks a million. A smack on the head is required and deserved for me.

Nick


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

Date: Tue, 24 Nov 2009 22:55:19 +0000
From: zaphod <abc@def.com>
Subject: Re: Why is "use 5.010" necessary
Message-Id: <WcadneM6juHF-ZHWnZ2dnUVZ7rudnZ2d@brightview.co.uk>

On 24/11/2009 17:57, Ben Morrow wrote:
> Quoth zaphod<abc@def.com>:
>> Why is it necessary to state:
>>
>> use 5.010;
>>
>> ... simply to have access to Perl 5.10's features? If I didn't want to
>> use it's features I wouldn't have installed it in the first place. 5.10
>> is backwards compatible in any case so it all seems a bit pointless.
>
> It's only necessary to say that if you want a feature that might be
> incompatible with code written for previous versions of Perl. For
> instance, the '//' operator is always available, but the 'say' operator
> isn't, in case you have some code that uses a sub called 'say'.
>
> Ben
>

So the whole Perl community has to put 'use 5.010;' in every Perl program they write for eternity just because someone might have a sub called 'say' somewhere in their old code that they're now running under Perl 5.10? Mistaken priorties surely?

zaphod


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

Date: Tue, 24 Nov 2009 23:53:59 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Why is "use 5.010" necessary
Message-Id: <n98ut6-km72.ln1@osiris.mauzo.dyndns.org>


Quoth zaphod <abc@def.com>:
> On 24/11/2009 17:57, Ben Morrow wrote:
> > Quoth zaphod<abc@def.com>:
> >> Why is it necessary to state:
> >>
> >> use 5.010;
> >>
> >> ... simply to have access to Perl 5.10's features? If I didn't want to
> >> use it's features I wouldn't have installed it in the first place. 5.10
> >> is backwards compatible in any case so it all seems a bit pointless.
> >
> > It's only necessary to say that if you want a feature that might be
> > incompatible with code written for previous versions of Perl. For
> > instance, the '//' operator is always available, but the 'say' operator
> > isn't, in case you have some code that uses a sub called 'say'.
> 
> So the whole Perl community has to put 'use 5.010;' in every Perl
> program they write for eternity just because someone might have a sub
> called 'say' somewhere in their old code that they're now running under
> Perl 5.10?

Yes. Apart from anything else, encouraging people to put a compile-time
version requirement is a Good Thing. A sane and straightforward error
message is a lot better than a series of confusing syntax errors.

You should be thankful that 'use 5.010' is sufficient. IIRC there was
quite some objection to that idea when it was proposed (on the grounds
that it was confusing and changed the semantics of 'use VERSION') so you
might have been left needing an explicit 'use feature' line.

> Mistaken priorties surely?

You should check out the archives of p5p :). This is a conversation that
has been had many many times, with vocal arguments on both sides. The
current policies on backwards-compatibility are necessarily a
compromise, IMHO a reasonable one.

Ben



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

Date: Tue, 24 Nov 2009 19:04:13 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Why is "use 5.010" necessary
Message-Id: <87iqcztqpu.fsf@quad.sysarch.com>

>>>>> "z" == zaphod  <abc@def.com> writes:

  z> On 24/11/2009 17:57, Ben Morrow wrote:
  >> Quoth zaphod<abc@def.com>:
  >>> Why is it necessary to state:
  >>> 
  >>> use 5.010;
  >>> 
  >>> ... simply to have access to Perl 5.10's features? If I didn't want to
  >>> use it's features I wouldn't have installed it in the first place. 5.10
  >>> is backwards compatible in any case so it all seems a bit pointless.
  >> 
  >> It's only necessary to say that if you want a feature that might be
  >> incompatible with code written for previous versions of Perl. For
  >> instance, the '//' operator is always available, but the 'say' operator
  >> isn't, in case you have some code that uses a sub called 'say'.
  >> 
  >> Ben
  >> 

  z> So the whole Perl community has to put 'use 5.010;' in every Perl
  z> program they write for eternity just because someone might have a
  z> sub called 'say' somewhere in their old code that they're now
  z> running under Perl 5.10? Mistaken priorties surely?

no, it is called backwards compatability. perl has always had that in
mind and with 5.10 they made serious changes in adding functions and
some syntax that would break older programs. as perl could be upgraded
without changed the programs (happens all the time on shared servers,
etc.) that would cause many programs to break for no obvious reason. so
the priority is well chosen here. if you want those new 5.10 features
you must explicitly enable them in your program.

uri

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


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

Date: Wed, 25 Nov 2009 00:13:21 +0000
From: zaphod <abc@def.com>
Subject: Re: Why is "use 5.010" necessary
Message-Id: <ouudnSN2Q4E865HWnZ2dnUVZ8s6dnZ2d@brightview.co.uk>

On 25/11/2009 00:04, Uri Guttman wrote:
> no, it is called backwards compatability. perl has always had that in
> mind and with 5.10 they made serious changes in adding functions and
> some syntax that would break older programs. as perl could be upgraded
> without changed the programs (happens all the time on shared servers,
> etc.) that would cause many programs to break for no obvious reason. so
> the priority is well chosen here. if you want those new 5.10 features
> you must explicitly enable them in your program.
>
> uri
>

So when we get to Perl 5.12 and 5.14 are we going to have to remember exactly which features were added in exactly which versions and add 'use 5.0xx' accordingly? I envisage Perl programming getting a lot more messy. Furthermore, why did I not have to include 'use 5.08x' following the release of Perl 5.8?

The day Perl starts adding lines at the top of scripts to appease the Perl-indifference of shared hosting providers is the day I reconsider using it. That's just not the Perl way.

zaphod


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

Date: Wed, 25 Nov 2009 01:00:06 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Why is "use 5.010" necessary
Message-Id: <m5cut6-qv72.ln1@osiris.mauzo.dyndns.org>


Quoth zaphod <abc@def.com>:
> On 25/11/2009 00:04, Uri Guttman wrote:
> > no, it is called backwards compatability. perl has always had that in
> > mind and with 5.10 they made serious changes in adding functions and
> > some syntax that would break older programs. as perl could be upgraded
> > without changed the programs (happens all the time on shared servers,
> > etc.) that would cause many programs to break for no obvious reason. so
> > the priority is well chosen here. if you want those new 5.10 features
> > you must explicitly enable them in your program.
> 
> So when we get to Perl 5.12 and 5.14 are we going to have to remember
> exactly which features were added in exactly which versions and add 'use
> 5.0xx' accordingly?

Yes. You should be doing this anyway. If you want to take a shortcut,
you can always just 'use' the version of perl you happen to be
developing on.

> I envisage Perl programming getting a lot more
> messy. Furthermore, why did I not have to include 'use 5.08x' following
> the release of Perl 5.8?

Because 5.8 didn't add any new keywords that might conflict with
existing code.

> The day Perl starts adding lines at the top of scripts to appease the
> Perl-indifference of shared hosting providers is the day I reconsider
> using it. That's just not the Perl way.

And yet there are people who yell blue murder if a script that was
written for Perl 3 fails to work as designed on the latest release. I
suggest you catch up on some of the last 20 years of p5p before you
start making pronouncements about what is and isn't 'the Perl way'.

Ben



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

Date: Wed, 25 Nov 2009 02:26:23 +0100
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: Why is "use 5.010" necessary
Message-Id: <4b0c87bf$0$22938$e4fe514c@news.xs4all.nl>

zaphod wrote:

> So the whole Perl community has to put 'use 5.010;' in every Perl 
> program they write

TIMTOWTDI: PERL5OPT.

-- 
Ruud


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

Date: Tue, 24 Nov 2009 19:46:58 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Why is "use 5.010" necessary
Message-Id: <slrnhgp2ut.jvk.tadmc@tadbox.sbcglobal.net>

Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth zaphod <abc@def.com>:
>> On 24/11/2009 17:57, Ben Morrow wrote:
>> > Quoth zaphod<abc@def.com>:
>> >> Why is it necessary to state:
>> >>
>> >> use 5.010;
>> >>
>> >> ... simply to have access to Perl 5.10's features? 

>> Mistaken priorties surely?
>
> You should check out the archives of p5p :). This is a conversation that
> has been had many many times, with vocal arguments on both sides. The
> current policies on backwards-compatibility are necessarily a
> compromise, IMHO a reasonable one.


But it is not what zaphod would have chosen, and is therefore foolish!


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


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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 2692
***************************************


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