The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

NPRG - generate reports to graphic output devices

SYNOPSYS

 use Wingraph;
 use NPRG;

 $dc=new Wingraph(device=>'PS', desc=>'Desc' [, metafile=>'metafilename');
 $rp=new NPRG(dc=>$dc);

 $rp->{'atbreak'}=sub {...}
 $rp->{'beforebeak'}=sub {...}
 $rp->pushq({...},{...}...{...});
 $rp->flushq();

DESCRIPTION

This module allow you generate reports to graphic outpus deviceses using objects like Wingraph. The $dc object must have methods, described in Wingraph documentation.

NPRG methods

new

Create new NPRG object. Parameter passed by hash, allowed: dc and footerh. The dc is object like Wingrpah. Description of footerh see below.

$rp->{'atbreak'}

Allows you set up callback to proceed page breaking, after page eject. To function passed only one parameter - the report object itself.

$rp->{'beforebreak'}

Like 'atbreak', but only before page eject. You can reserve page space for footer by creating report object with footerh parameter - the footerh virtual points will be reserved and every page for footer.

$rp->pushq({}...{})>, $rp->flushq()

The pushq functions is core of NPRG. At every call of pushq the report data pushed into report queue, and at every call of flushq() data flushed. If no enough space in page then page ejected, calling the NextPage method of $dc object. Data, pushed together between flushq calls cannot be splitted between pages. Data passed as array of references to hashes, where every hash described a column, and this columns will be equal high and placed from the left to the right in order when they appear in pushq call. For example, call

give the something like

and so on. You can use following hash pairs in column hashes:

begin text

font

optional. Specifies font for data in format, understanding by $dc object, <code>'Courier, 12, 0'</code> for example.

width

required. Width of column in vitrual points.

value

optional. Value to display. If value is scalar then corresponding string is displayed. If value is reference to sub, then this sub will be called. In addition to decribed here params new params $dc, xpos, ypos, 'height', width, compute will be passed. xpos, ypos defines the coordinates of top left corner of bounding rectangle, width and height defines width and height. If parameter compute is defined then sub must return minimal requred height of rectangle, if not - display the data. See drawmatrix sub for detail and as example.

border

optional. Define a border around displayed data. Must be string with T, B, L, R chars for border on top, bottom, left and right side of bounding rectangle. Default is empty string.

pen

optional. Define width of pen of border. Default =1.

brush

optional. Define the brush to fill background. If not defined then background is not filled.

opt

optional. Define the style used to display data. Must be string of chars. Horizontal alignment:

C

Text is centered

L

Text is left-ajusted

R

Text is right-ajusted

J

Text is justified

Vertical alignment:

-

Text is vertical cenetered

V

Text is bottom alignment

empty

Text is top alignment

height

Minimail height of displayed data

end text

drawmatrix subroutine

drawmatrix sub allow to display structured data into one cell of report. drawmatrix use matrix hash key, which is a reference to array of references to array of references to hashes:

Size of each cell in displayed matrix is 1/n of total width, where n is a number of columns in matrix row.

Putting all together

It's all, folks!

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 538:

You forgot a '=back' before '=head2'

Around line 585:

Non-ASCII character seen before =encoding in 'value=>'Îò÷åò'. Assuming CP1252