Sergey Rusakov > ePortal-4.5 > ePortal::Utils



Annotate this POD

View/Report Bugs
Module Version: 4.5   Source  


ePortal::Utils - useful global wide functions.


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



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


 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 .


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


Sergey Rusakov, <>

syntax highlighting: