CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: Re: [jc1742] Accessing package variables?: Edit Log

Veteran / Moderator

Jul 28, 2011, 8:07 AM

Views: 6619
Re: [jc1742] Accessing package variables?

Your new sub needs to declare and assign default values to the vars (which is typically done via a hash ref) and then return the blessed hash ref. The new sub could also accept args, i.e., a hash ref, containing the desired values to be put into the object. Then you need to write accessor/mutator subs which retrieve and/or set the vars.

See the following perldocs.
perlboot Perl OO tutorial for beginners
perltoot Perl OO tutorial, part 1
perltooc Perl OO tutorial, part 2
perlbot Perl OO tricks and examples

(This post was edited by FishMonger on Jul 28, 2011, 8:09 AM)

Edit Log:
Post edited by FishMonger (Veteran) on Jul 28, 2011, 8:09 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives