in reply to Re: Using constants as methods
in thread Using constants as methods
This constant won't be available from other files, especially it won't be inherited, but the getter method would.No! It works fine (when we talk about method)! Seems it's available from any other place, and can be inherited. Example:
package XX; use constant timeout => 42; 1; package YY; use parent -norequire, 'XX'; 1; package main; use strict; use warnings; my $y = bless +{}, "YY"; print $y->timeout; # fine! 1;
So shall it be private or not?Not necessary.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Using constants as methods
by LanX (Saint) on Mar 13, 2016 at 01:52 UTC |