NAME
    FML::Process::Utils - convenient utilities for FML::Process:: classes.

SYNOPSIS
    See FML::Process::Kernel.

DESCRIPTION
    See FML:: classes, which uses these function everywhere.

access METHODS to handle configuration space
  config()
    return FML::Config object.

  pcb()
    return FML::PCB object.

  schduler()
    return FML::Process::Scheduler object.

access METHODS to handle incoming_message
    available all processes which eats message via STDIN.

    The following functions return the whole or a part of the incoming
    message corresponding to the current process.

    The message is a chain of "Mail::Message" objects such as

       header -> body

       header -> multipart-preamble -> multipart-separator -> part1 -> ...

    See Mail::Message for more details.

  incoming_message_header()
    return the header part for the incoming message. It is the head of a
    chain of Mail::Message objects.

  incoming_message_body()
    return the body part for the incoming message. It is the 2nd part of a
    chain of Mail::Message objects and after. For example,

       body

       multipart-preamble -> multipart-separator -> part1 -> ...

  incoming_message()
    return the whole message for the incoming message. It is the whole parts
    of a chain.

  incoming_message_set_current_queue($queue)
    save object of incoming queue.

  incoming_message_get_current_queue()
    get object of incoming queue.

  incoming_message_print_body_as_file()
    dupliate the body part into a temporary file. return a newly created
    temporary file path.

  incoming_message_dup_content($new_class)
    dupliate the incoming queue at $new_class.

  incoming_message_isolate_content()
    dupliate the incoming queue at isolated queue.

access METHODS to handle article
    available only in "libexec/distribute" process.

    The usage of these functions is same as that of incoming_message_*()
    methods but article_*() hanldes the article object to distribute now.
    So, incoming_message_*() handles input but article_message_*() handles
    output.

  article_message_header()
  article_message_body()
  article_message()
OUR POLICY UTILITY
  policy_ignore_this_message($reason)
    ignore this message by our policy.

  policy_reject_this_message($reason)
    reject this message by our policy. It returns error message to the
    sender.

misc METHODS
  mkdir($dir, $mode)
    create directory $dir if needed.

  unique( $array )
    make components in $array unique.

ml_home_dir handling
  ml_home_dir_deleted_path($ml_home_prefix, $ml_name)
    return ml_home_dir to be removed. If mupltiple directories are matched,
    return the latest removed one by using
    ml_home_dir_find_latest_deleted_path().

  ml_home_dir_find_latest_deleted_path($ml_home_prefix, $ml_name)
    find the latest removed ml_home_dir and return it.

METHODS for convenience
  fml_version()
    return fml version.

  fml_owner()
    return fml owner.

  fml_group()
    return fml group.

  myname()
    return the current process name.

  command_line_raw_argv()
    return @ARGV before getopts() analyze.

  command_line_argv()
    return @ARGV after getopts() analyze.

  command_line_argv_find(pat)
    return the matched pattern in @ARGV and return it if found.

  command_line_options()
    return options, result of getopts() analyze.

  config_cf_files_set_list($cf_file_path_array)
    set configuration file (.cf) to internal list.

  config_cf_files_append($cf_file_path)
    append configuration file (.cf) to internal list.

  config_cf_files_get_list()
    get configuration files (*.cf) list as ARRAY_REF.

  ml_name()
    not yet implemenetd properly. (?)

  ml_domain()
    return the domain handled in the current process. If not defined
    properly, return the default domain defined in /etc/fml/main.cf.

  default_domain()
    return the default domain defined in /etc/fml/main.cf.

  executable_prefix()
    return executable prefix such as "/usr/local".

  newml_command_template_files_dir()
    return the path where template files used in "newml" method exist.

  ml_home_prefix([domain])
    return $ml_home_prefix in main.cf.

  config_cf_filepath($ml, $domain)
    return config.cf path for this $ml ($ml@$domain).

  is_config_cf_exist($ml, $domain)
    return 1 if config.cf exists. 0 if not.

  menu_get_cui_config_file_path()
    return menu configuration path for CUI.

  menu_get_gui_config_file_path()
    return menu configuration path for GUI.

  is_cui_process()
    inform whether this process runs as CUI (fml/makefml) ?

  is_cgi_process()
    inform whether this process runs as cgi ?

  is_under_mta_process()
    inform whether this process runs under MTA ?

  is_allow_reply_message()
    return 1 if we can send messages to the sender or specified address.
    return 0 if not.

    For example, processes running under MTA e.g. libexec/distribute,
    libexec/command receives a mail and reply it if needed. But makefml
    command do not.

  is_fml8_managed_address($address)
    check if $address is one of valid ml address fml8 on this host manages.

  map_to_term($map)
    which this $map belongs to ?

  map_to_term_nl($map)
    return which member of maps is this $map as natural language.

  address_resolve($list)
    address_resolve() converts $list to mail addresses. For example

        maitainer   =>      $maintainer
        sender      =>      sender of the current message (From: in header)

  article_get_max_id()
    return the current article number (sequence number).

  output_set_print_style(mode)
  output_get_print_style()
  langinfo_get_accept_language_list($list)
    set preferred language candidates requested by sender. $list is
    ARRAY_REF.

  langinfo_get_accept_language_list()
    return preferred language candidates requested by sender. The type of
    return value is ARRAY_REF.

  article_thread_init()
    prepare and return information (HASH_REF) needed to manipulate thread
    database.

  hints()
    return hints as HASH_REF. It is useful to switch process behabiour based
    on this hints. This function is used in CGI processes typically to
    verify whether the current process runs in admin mode or user mode ?
    et.al.

  shared_hash_get($category, $key)
    return HASH_REF allocated on global memory area.

    This memory area is shared by plural "fml processes" running on this one
    (operatiing system's) process. In other words plural $curproc are
    possible on one process. For example, both parent and child $curproc can
    access this memory area.

CUI specific
CURPROC UTILITY
  dup_curproc_args()
    duplicate $args corresponding to $curproc.

  context_switch_get_context()
    return saved context information.

  context_switch_set_context($context)
    replace context information with the specified one.

FAULT
LOG ROTATION
  log_rorate()
    rotate log files.

CODING STYLE
    See "http://www.fml.org/software/FNF/" on fml coding style guide.

AUTHOR
    Ken'ichi Fukamachi

COPYRIGHT
    Copyright (C) 2001,2002,2003,2004,2005,2006,2008 Ken'ichi Fukamachi

    All rights reserved. This program is free software; you can redistribute
    it and/or modify it under the same terms as Perl itself.

HISTORY
    FML::Process::Utils first appeared in fml8 mailing list driver package.
    See "http://www.fml.org/" for more details.