NAME

Taco::Dispatcher.pm - Dispatches functionality in templates to modules

SYNOPSIS

This module forms the connection between services and modules. It keeps track of which modules each service uses, and when any [[tag]] needs to be evaluated, Taco::Dispatcher decides which module to hand it off to.

This module also contains "chunker" functions that Taco::Template uses to parse the syntax of templates.

DESCRIPTION

  • &chunk_function( char, $text )

    Parses $text and returns a data structure in the following form.

    {
     type=>char, 
     name=>function_name,
     args=>[arg1=>val1, arg2=>val2, ...],
    }
  • &chunk_variable( char, $text )

    Parses $text and returns a data structure of the form {type=>char, name=>variable_name}. This is a simple process, since most of the time $text will not need any parsing, and will just be inserted into the variable_name slot.

  • &dispatch( chunk )

    Takes one argument, which is a template chunk like one created by &chunk_whatever. Searches the various modules for the current service, looking for a module that claims to handle this chunk. If it finds one, it lets that module handle it.

  • &set_modules( service, mod1, mod2, ... )

    Each service has a list of modules that it uses. You use the set_modules function to set this list. It will use Perl's @INC to look for the modules, so if you want to keep some modules in a non-standard location, do "use lib '/whatever/modules';".

  • &init_modules()

    When Taco is fired up, it will read the Taco::ServiceRegistry.pm file that contains definitions of the various Taco services. After this file is read and all the services' modules have been created, Taco will call each module's init($service) method for each service that uses that module.

  • &get_modules( service )

    Returns a list of references to modules that this service uses. If service is omitted, it defaults to the currently active service.

    See also get_module_names.

  • &get_module_names( service )

    Returns a list of the names of the modules that this service uses. If service is omitted, it defaults to the currently active service.

    See also get_modules.

  • &name2module( mod_name )

    Given a module name, returns a reference to the module object of that name. If no module with the given name is currently loaded, the undefined value will be returned and a warning will be printed to STDERR.

  • &current_service( service_name )

    Get or set the currently active service. With no arguments, this function just returns the name of the active service. Given the name of a service, that service will be made the currently active service.

  • &services()

    Returns a list of all the names of services in Taco::ServiceRegistry.pm.

  • &service_info( attribute, service )

    Looks up an attribute in Taco::ServiceRegistry.pm. If omitted, the service will default to the currently active service.

AUTHOR

Ken Williams (ken@forum.swarthmore.edu)

Copyright (c) 1998 Swarthmore College. All rights reserved.