Adoptable Modules > Text-MacroScript-1.40 > macroutil.pl

Download:
Text-MacroScript-1.40.tar.gz

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

macroutil.pl - utility functions for use with Text::MacroScript

SYNOPSIS ^

    %REQUIRE[macroutil.pl]

Having required this file you can use any of its functions (described below). You can also of course %REQUIRE any of your own libraries.

Functions provided:

    abspath
    copyright
    image
    imageif
    relpath
    today

DESCRIPTION ^

abspath()

This function returns a path which begins with `/' treating the script's working directory as root.

copyright()

Usage:

    copyright( 'MyCompany Inc' )

See html.macro for examples.

image()

This function returns an <IMG SRC..> tag.

    image( image, alt )

imageif()

This function returns either <IMG SRC...> if the date given is in the future or an empty string if the date given is in the past. See html.macro for examples of use. Usage:

    imageif( image, date, alt )

image is the path of the image, e.g. "/images/new.gif" date is a date that matches /^\d\d\d\d\D\d\d?\D\d\d?$/ i.e. year/month/day alt is the alt text which is optional, e.g. 'New'

relpath()

This function returns the path relative to where the calling script's working directory was in terms of "../"s. See the html.macro file for examples.

today()

This function returns an array of ( year, month, day ) in a list context and the scalar year in a a scalar context. The year is always four digits, the month and day always two digits (i.e. leading zero if < 10); the month is in the range 01..12. The date returned is today unless you pass in an integer time value in which case the date that that value represents is returned. See the html.macro file for examples.

AUTHOR ^

Mark Summerfield. I can be contacted as <summer@perlpress.com> - please include the word 'macroscript' in the subject line.

COPYRIGHT ^

Copyright (c) Mark Summerfield 2000. All Rights Reserved.

This module may be used/distributed/modified under the LGPL.

syntax highlighting: