> On Sat, Oct 23, 2010 at 07:52:50PM +0200, Shlomi Fish wrote:

>
> Just be sure you know what you are doing.  Adding a method to somone
> else's
> class can be considered rude.  See the NOTE in perldoc perlmodlib.
>

He/she is maybe coming from other language like Ruby.
In ruby it's free to add methods to any class including the built-in ones.

irb(main):001:0> class String
irb(main):002:1>   def greeting
irb(main):003:2>     puts "hello I'm in string"
irb(main):004:2>   end
irb(main):005:1> end
=> nil
irb(main):006:0> s=String.new
=> ""
irb(main):007:0> s.greeting
hello I'm in string
=> nil


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to