Perl Object system in javascript way