Hi Martin,

first, it is common practice to begin functions that are meant to
be private with an underscore. A caller could, of course, call such
a function, but it is widely known among Perl hackers that this
is Not Good.

I already do this.

package foo;

sub new {
  my $proto = shift;
  my $class = ref($proto) || $proto;

  my $self = {};
  bless $self, $class;

  # Private methods
  $self->{PRIVATE}->{bar} =
    sub {
       ...
    };

}

This looks really ugly. Usually I use functions to give the code a better structure. If we use this way to define functions then we can forget about the function and simply write one big function "new".


I also think about the API class to isolate the original server class in the meanings of the variables. The API class includes a reference to the server. Every access to the API uses functions and no variables (e.g. get_access_control and set_session). If you call get_config then you get the config instance. I use the API class to verify the interface usage and some logic from the user interface.

The major problem for me is actually the size of the classes. I want to get a class which beginners can really easily use to create a new interface. So a big a server class with the API inside is perhaps a problem for the coding. Nevertheless I'm faraway from commiting. So perhaps I can unify the two parts if I'm finished.

Actually the server is running and I try to avoid the usage of global variables. If I connect to the server then the server usually crashes ;) The next issue is the access control. What controls the access (OpenCA::UI or OpenCA::Server) and what is controlled (API access or UI usage). Questions over questions. Perhaps I have in mid january a running server for evaluation.

Michael
--
_______________________________________________________________

Michael Bell                    Humboldt-Universitaet zu Berlin

Tel.: +49 (0)30-2093 2482       ZE Computer- und Medienservice
Fax:  +49 (0)30-2093 2704       Unter den Linden 6
[EMAIL PROTECTED]   D-10099 Berlin
_______________________________________________________________


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
OpenCA-Devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/openca-devel

Reply via email to