I do know what a singleton is, but thanx for that pointer. I got the idea to use the local copy of I had originally just copied the data used in the users junk to the module. but even when i used this constructor:
sub new { my $class = shift; my $self = {}; return bless $self, $class; }
It actually did not work at all. Besides, the second simplest constructor in the perl cookbook was sub new{ bless({},shift);} I saw that in the reference they had shifted off of $self for every function, but as I said earlier I was just copying the code to local vars and only now realize that I can only have one instance of the class if I do that. Yes I realize how to shift of $self, but even when I had all the things that were just descibed, I still could not call the functions like this:$foo->name("straywalrus");. Instead I had to call every function with the class name preceding the function name with the C++ scope operators betwixt the two ( I have no idea what the scope "::" operator is called in Perl). Every call was made like it was shown in the test program. Surely there is a way to correct this, even though I shift off $self and do as was above described. Thanx straywalrus

In reply to Re: Re: Classes Are Killing Me by straywalrus
in thread Classes Are Killing Me by straywalrus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.