Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Text Based Perl Game

by roboticus (Chancellor)
on Dec 27, 2013 at 00:03 UTC ( [id://1068460]=note: print w/replies, xml ) Need Help??


in reply to Re: Text Based Perl Game
in thread Text Based Perl Game

VincentK:

A couple suggestions:

  1. For player.pm and gameroom.pm, you're allowing the export of the method names, but the method names don't need to be exported. If they were class and/or utility functions (i.e. functions not needing an object reference) then I can see where exporting the name can be useful. But I don't see any value to exporting these method names.
  2. In the main game script, you're using subroutine prototypes, but they're not helpful in these cases. You may want to review the prototypes section of perldoc perlsub.

Otherwise, it looks pretty good.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^3: Text Based Perl Game
by VincentK (Beadle) on Dec 27, 2013 at 01:07 UTC
    I appreciate the feedback. Thanks.

    I will keep item no. one in mind going forward. As for item no. two, I had a feeling someone was going to point that out. I am so used to having forward declarations, that it kind of looks wrong to me if I don't have them in place. I do understand your point though.

    Thanks again.

      Short version: Don't use prototypes.

      Less short version: No, Really, Don't use prototypes.

      Long version: Prototypes (almost always) don't do what you want or what you think. Most people who use prototypes frequently come from a C or C++ background and they have carried over their function declaration habits to Perl without noticing that there are almost none of the type checking benefits and several subtle traps. So, don't do that.

      True laziness is hard work

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found