Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Lady_TM

by Steeeeeve (Initiate)
on Feb 02, 2001 at 03:48 UTC ( [id://55908]=note: print w/replies, xml ) Need Help??


in reply to Re: Lady_TM
in thread Lady_TM

I am in the habit od using the line:

my $self = shift;

in each method that is to be accessed externally. Keeping a method private is sometimes desireable, those methods do not include the line. I took this from the good book "Perl from the Ground UP."

In experience, if I forget to insert this line, the method IS unavailable. I do it now out of habit.

Looking in the Perl Cookbook I see that this first shift is used to associate the method as a member of the "class object."

This is not something that has anything to do with the method's prototype. The prototype will never take into account that the class association is the first shifted item in object-oriented Perl class method.

Its something I don't understand fully, but I do it.

-Steeeeeve

Replies are listed 'Best First'.
Re (tilly) 3: Lady_TM
by tilly (Archbishop) on Feb 04, 2001 at 11:58 UTC
    I have never heard of "Perl from the Ground UP" so I cannot tell you whether or not it is bad. But be warned that there are lots of bad books out there, and I have probably heard of most of the worthwhile ones...

    Anyways using features when you don't understand what they are supposed to be doing is generally a bad idea. That leads to cargo-cult programming, a subject which leads to rants around here from time to time.

    In particular the only way you are getting away with your prototypes is that Perl is completely and absolutely ignoring them. Which means that if you ever try to write regular procedural code you will be hopelessly confused. For a full explanation try this rant.

    Beyond that, try putting:

    use strict;
    at the top of your module and seeing how much it complains. While you are at it do not write to globals in packages outside of yours without permission. (Yes, I am talking about $::Lady_TM.) It looks like you have not yet learned about pod. The (commented out) locking code makes a number of mistakes. Starting with trying to lock the filehandle before trying to open the file. That simply cannot work (though you don't test for the error so you wouldn't notice).

    Also for hashing you might want to look at existing modules. In particular the widely-used DB_File.

      I have Perl 5.6 ruining my server. (heh!) When I make an error with an unmatched prtotype, Perl complains about it.
      There is some error checking to add to the methods that actually get the file data. I will look into it.
      I remembered why I started using type globs, it didn't make any difference at the time what name was used on the other end.
      I am getting into some more work that involves the Lady TM module for my site wrapper,, so I'll be testing the revisions.
      Thanks for the input.
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://55908]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-25 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found