What is considered to be the proper way of naming internal subroutines? Example: my_special_subroutine or mySpecialSubroutine
-----Original Message----- From: Uri Guttman [mailto:u...@stemsystems.com] Sent: Thursday, April 28, 2011 12:50 AM To: Shawn H Corey Cc: beginners@perl.org Subject: Re: special method name start with "_" Importance: High >>>>> "SHC" == Shawn H Corey <shawnhco...@ncf.ca> writes: SHC> On 11-04-28 12:20 AM, Uri Guttman wrote: >> methods starting with _ are conventionally private >> methods. SHC> Actually, I think they are "protected" methods. Those methods that SHC> should not be access by other objects but can be by their child SHC> classes. A truly private method can be written as a sub reference: SHC> my $private_method = sub { SHC> # good stuff goes here SHC> }; SHC> Since $private_method can not be access outside of the file, it is SHC> completely private. and that isn't a method since it isn't in the symbol table. what you have there is a private sub. methods must be visible to be found at runtime. that sub isn't visible to anything except code in that block or file. the _ prefix is the only common way to mark a private OR protected method as perl doesn't directly provide any support for it. moose and other OO systems may support this. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/