I am trying to create a module that will print the Stats of the player of my
on line game.
all it should do is take the vars, do some calulations and print the HTML

since the Stats is used in every time i don't want to duplicate it in each
program.

The main program has all your players vars loaded...
the Stats subroutine (which I want to make into a mod)
puts the HTML code in the <BODY> of the web page...
from what I have read this should not be a hard things to do.

Module= a piece of code that is repeated in several programs.
Each location in the town is a separate program....
If I can't get this to work I'll just leave the sub Stats()  in each program
and not worry about it.

Thanks
Lou



----- Original Message ----- 
From: "Charles K. Clarkson" <[EMAIL PROTECTED]>
To: <beginners-cgi@perl.org>
Sent: Sunday, November 27, 2005 12:46 AM
Subject: RE: Need help with making a Modules


> Lou Hernsen <mailto:[EMAIL PROTECTED]> wrote:
>
> : I am studying modules.. I am seeking a mentor to help.
>
>     What do you mean by "module"? I ask because many people have very
> different ideas about what one is.
>
>     For example, some people think about a library.
>
> require 'my_perl_module.pl";
>
>
>     When I say "module", I am usually thinking of an object.
>
> use TemplateVariables;
>
> my $vars = TemplateVariables
>             -> new()
>             -> select_categories();
>
>
>     Others think of a library of subroutines and variables.
>
> use CGI qw(:standard center);
>
> print
>     header(),
>         start_html('foo'),
>             center(h1('foo')),
>         end_html();
>
>     In your own words, define "module."
>
>
> : I have very simple questions like ...
> : Do I need to pass vars into the mod?
>
>     That depends on what you are attempting to do. It also depends
> on what you want the module to do. The CGI example above passed
> variables into the module to tell it which subroutines should be
> exported. An object may require variables to be added when it is
> constructed.
>
>
> : Do i need to declare vars in the mod?
>
>     It is often very difficult to write an entire module without
> declaring a variable, but it is not impossible.
>
>
> : What is "our"? something like "my" and "local"?
>
>      Yes. Have you read perlfunc?
>
>
> : Do I need to return vars?
>
>     Not usually. Most modules return values.
>
>
> : The code I am writing creates part of a web page,
> : so I can print it in the mod or in the main.
> : (I wold prefer to print it in the mod.. if possible)
> :
> : I have been reading for 2 weeks now and can't find a simple working
> : model to disect that I can understand all the parts of.
>
>     Give us  a more detailed idea of what you are attempting and
> perhaps we could write an example for you.
>
>
> HTH,
>
> Charles K. Clarkson
> -- 
> Mobile Homes Specialist
> 254 968-8328
>
>  . . . With Liberty and Justice for all (heterosexuals).
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to