Hi Gerald,

I am starting to abstract out some code that will be common between
different websites on the same server, and I would like to make this
code into an object which can then be inherited by the individual
websites. I would like to know if you think the following method is a
good way to do it:

The document base is /www/mysite/com/htdocs. The following paths are
absolute to the file system root, not the website root:

/www/common/doc.html

        [!
                # Bunch of Perl methods
                sub execute
                {
                        my ($self, $subs) = @_;
                }
        !]

        [$ sub foo $]
                [# Also some Embperl subs #]
        [$ endsub $]

/www/common/subs.html

        [!
                # Some common subs
        !]

/www/mysite/com/htdocs/base.html

        [- $subs = Execute ({object => 'subs.html'}) -]
        [- $object = Execute ({object => 'object.html'}) -]
        [- $object->execute ($subs) -]

/www/mysite/com/htdocs/subdir/object.html

        [! Execute ({isa => '/www/common/doc.html'}) !]

        [!
                # Redefine certain methods from doc.html        
                sub execute
                {
                        my ($self, $subs) = @_;

                        $self->SUPER::execute($subs);
                }
        !]

/www/mysite/com/htdocs/subdir/subs.html

        [! Execute ({isa => '/www/common/subs.html'}) !]

Does this architecture make sense? Also, is it ok to have Execute() call
a file which is outside the document base for the website? 

Sorry if these are dumb questions, it's just that I would like to make
sure I have this right before undertaking a major overhaul of my code
(yet again...) to make it more object oriented and reusable...

Thanks in advance,

-Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to