Some of your questions relate to the way that Perl modules work, and I suggest you get some experience of writing ordinary modules before you dive into OO. Play with namespaces, my, and our, but ignore exporting.
Now read the references mentioned by daveorg. I would add Daminan Conway's books.
The magic that creates an "object" is the bless command, and all that does is attach a tag to a reference indicating which package methods should be called from at runtime. That package need not even exist for bless to work, the tag is used when a method is called on that object (or ref is used).
A constuctor subroutine is often called 'new', but it need not. The first argument passed is the class name, subsequent arguments passed are application specific. So, when you say that Perl complained about $self->{link_file}, it looks to me that $self has been constructed elsewhere, as is/should be a reference to a hash - but you do not say what the error message was.
An object method gets the object reference (a blessed reference) as its first argument. What variables should be set in a method depends on the application, but remember there is no persistence of my variables declared within the sub unless you grab a reference to them.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.