in reply to Re^5: Perl Modules -- abstraction and interfaces: exporter and @ISA
in thread Perl Modules
the next question on my mind....i'll use code to describe the question, cuz it gets my point across far easier than trying to use words to describe the question
is this "good practice" - i mean the bit before the first sub?package Blah::Blah::BlackSheep; use strict; use warnings; # etc, etc...etc... my $loggedin = cookie_get("loggedin"); # does exactly what you think i +t does... my $page = get_param(get_constant($db, "QUERY_PAGE")); # the page the +user wants to visit # cookie_get, get_param, get_constant are all subs I created to ease m +y coding a little, despite it being a tad...convoluted. it works. t +hat's what matters if (not allowed($page, $loggedin)) { print cookie_set("error", "Access Denied!"); print "location: /\n\n"; exit 1; } sub something { return "blah"; } sub something2 { return "bleet"; } # etc, etc, etc... 1;
why do i ask? I don't want to have to code the above into EVERY script i write....that's prone to errors, and can be a real B when a change is needed....
if this isn't good practice, how can i accomplish this task? I know PERL allows the above code - compiles without complaint, and it does work....just wanted to know if this is the right way to go about it...?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Perl Modules -- abstraction and interfaces: exporter and @ISA
by haukex (Archbishop) on Jul 11, 2017 at 19:25 UTC |