I am new to perl objects, so please excuse me if this question seems a tad basic ;-)
I have a few rather large data structures that I want to use in a package (currently stuffed in a single file and required as needed).
Now I've decided that I really should try to get the hang of this OO stuff, and I'd like to know whether I can (or should!) use a require in the package I'm making (like in the scripts I've been using) rather than adding a few hundred lines to the package file itself, i mean like
package Blocker;
use strict;
use Switch;
require "data_defs.pl";
...
Would this create any problems? Would each object have it's own copy of the data, or would there still only be one like a require in a normal script? - Like I say, there is alot of data.
I would include some more code here, but you'd probably laugh at me (alot...!)
Thanks for any advice you can give!
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.