NAME

ePortal::Utils - useful global wide functions.

SYNOPSIS

Some functions are very useful anywhere. They are collected here.

METHODS

logline(loglevel,string,...)

Record the string in error log. There are a number of loglevels:

  • emerg

    Emergencies - system is unusable: Object creation errors.

  • alert

    Action must be taken immediately.

  • crit

    Critical Conditions.

  • error

    Error conditions.

  • warn

    Warning conditions.

  • notice

    Normal but significant condition.

  • info

    Informational: Redirects.

  • debug

    Debug-level messages: ACL checking

pick_lang(hash)

pick_lang( eng => "text in english",
           rus => "text in russian");

Chooses and returns a text for a current ePortal language.

href( uri, key => value, ...)

Constructs full URL with optional parameters.

uri is filename or URI to some file.

key-value pairs may be repeated. value may be array ref.

Returns a string like uri?key=value&key=value

plink(text, parameters, ...)

Constructs HTML code to make anchor like [link] (text in square brackets)

text is text to show as link.

Other parameters are passed directly to CGI::a() function. Most used are:

-href => 'http://server/file.htm'
-href => href('file.htm', param1 => value1)
-class => "someclass"
-target => "_top"
-title => "floating title"

img( param => value )

Contructs HTML code for image tag. Parameters passed as hash are:

src required. URI to image.

width, height if not passed then Image::Size is used for calculation at runtime. These attributes are calculated only once for each apache child. They are cached for speed.

alt alternative text for the image

id ID of the image

Some parameters are used to construct Link from the image:

href, target, title, onClick - they are self-expanatory, passed to CGI::a() function.

Returns HTML string in scalar of array context. If used in void contxet then $m->out() is used to output the string immediately .

filter_html($content)

Filters a content to cut some HTML tags like <HTML>

Accept as parameter:

any text - filters this text

/path/filename - reads this file and filters it

$m - calls fetch_next() and filters the output

AUTHOR

Sergey Rusakov, <rusakov_sa@users.sourceforge.net>