equivalent

S

sreservoir

*STDOUT{PACKAGE} returns a string indicating which package *STDOUT is
in, in this case "main". And no, it doesn't get preferentially treated
as a package name, not even if you use *STDOUT::new{PACKAGE}.

er, I misread the docs on that.

can we just say that this part of perl is _weird_?
 
J

Justin C

I apologise (somewhat). I was being something of a smartass, which while
generally expected on Usenet is less than helpful to those trying to
learn the language. (The group isn't solely (or even mostly) for their
benefit, of course.)

Thanks Ben, and Tad, for the follow-up on this. I'll re-read the
Indirect Object Syntax from perlobj again later, I find that several
read-throughs are necessary with some time to digest in between!


Justin.
 
U

Uri Guttman

JC> Thanks Ben, and Tad, for the follow-up on this. I'll re-read the
JC> Indirect Object Syntax from perlobj again later, I find that several
JC> read-throughs are necessary with some time to digest in between!

there isn't much more to learn. just do Foo->new() and you will be fine
in all normal cases with little to worry about. avoid new Foo() too. the
fact that old docs show indirect calls is irrelevent, they haven't been
encouraged to update them to direct method calls.

uri
 
P

Philip Potter

JC> Thanks Ben, and Tad, for the follow-up on this. I'll re-read the
JC> Indirect Object Syntax from perlobj again later, I find that several
JC> read-throughs are necessary with some time to digest in between!

there isn't much more to learn. just do Foo->new() and you will be fine
in all normal cases with little to worry about. avoid new Foo() too. the
fact that old docs show indirect calls is irrelevent, they haven't been
encouraged to update them to direct method calls.

Agreed. And if you want to enforce direct object syntax, you can use
indirect.pm from CPAN like this:

no indirect ':fatal';

(This isn't necessarily a good idea, particularly if you're working with
existing code; but I feel the arguments for its use are similar to 'use
strict')

Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top