Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: RFC: new.pm - a perl -e use/new shortener (constructor)

by LanX (Bishop)
on Dec 24, 2016 at 13:15 UTC ( #1178463=note: print w/replies, xml ) Need Help??


in reply to RFC: new.pm - a perl -e use/new shortener

As a side note: new is not a builtin in Perl.

Classes are free to choose any method as constructor and are even free to have multiple of them.

Though I'm not aware of an example right now.

Update: this case is a negligence, no code needed, just mention in doc.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re: RFC: new.pm - a perl -e use/new shortener (constructor)

Replies are listed 'Best First'.
Re^2: RFC: new.pm - a perl -e use/new shortener (constructor)
by Dallaylaen (Hermit) on Dec 24, 2016 at 14:20 UTC

    Good point, say, DBI->connect(...); behaves much like a constructor. However, this would clutter the interface, making it less funny. And many Very::Long::Modules are in fact parts of a big production system that standardizes constructors. Maybe there is a way though, need to think more...

      As I already said, in the rare cases one can always fall back to explicit code.

      Just making it clear in documentation that some modules fail should be enough.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1178463]
help
Chatterbox?
and dust plays in a shaft of sunlight...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2018-07-19 21:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (420 votes). Check out past polls.

    Notices?