NAME

Perlbug::Formatter - Formats for all interfaces to perlbug database.

Migrating out into Object module.

DESCRIPTION

Different formats which can be applied to the data returned from the perlbug database via l<Perlbug> (l<Web>, l<Email> and l<Cmd>) interfaces: aAhHl

If html is required, -f h should be used. The first letter following the -f switch is the only one used to define which format to use for all results emanating from a single email, -f h being set by default for a web call.

Specific objects supported include: Bugs, Messages, Users, Groups, Patches, Tests and Notes.

Currently this is not relevant for the -q (sql query) switch, as there is little value in attempting to second guess what may be called for in sql statements.

SYNOPSIS

my $o_fmt = Perlbug::Formatter->new;

my %data = (
	'some'	=> 'data',
	'other'	=> 'stuff',
);

my $str = $o_fmt->fmt(\%data);

print $str; # 'some=data\nother=stuff\n'

METHODS

new

Create new Perlbug::Formatter object:

my $do = Perlbug::Formatter->new();
context

Set context ascii or html, sets pre- and post- values

line_break

Return the current line-break

pre

Return the current pre-setting

pre

Return the current post-setting

fmt

Default printout (of given hash, or anything) - very basic formatter of simple data.

    %data = (
        'this' => 'that',
        'here' => [qw(there up down turnaround)],
    );
    
	print $pb->fmt(\%data);

this=that here=there up down turnaround

_fmt_sql

Formatter sql queries

format_data

Formatters this, and writes (via a format) to results file.

If it recognises the object via: bug(id), message(id), patch(id), note(id), user(id) the appropriate formatting is applied.

my $res = $format->format_data(\%this); 
format_this

Wrapper for calls to filehandle, local data.

my $res = $obj->format_this('res', "FORMAT_$type_$format", $max);

# $res = ''
_current_target

Any call which includes format_this(), format_data etc. will automatically set the _current_target to a copy of that data. This can then be inspected from here.

print Dumper($obj->_current_target);
start

Sets start header for results.

format_patch_fields

Formatter individual patch entries for placement

my $h_pat = $o_web->format_patch_fields($h_pat);
format_test_fields

Formatter individual test entries for placement

my $h_test = $o_web->format_test_fields($h_test);
format_note_fields

Formatter individual note entries for placement

my $h_msg = $o_web->format_note_fields($h_msg);
href

Return list of perlbug.cgi?req=id&... hyperlinks to given list).

Maintains format, rng etc.

my @links = $o_web->href('bid', \@bids, 'visible element of link', [subject hint], [\@boldids]);
mailto

Return mailto: for a particular ticket

my $mailto = $o_web->mailto($h_tkt); 

Returns appropriate (cached) popup with optional default value inserted.

    my $popup = $web->popup('status', $unique_id, $default);

	$self->debug(3, "Admin ($1) of bug ($id) called.");
	$tkt{'category'}   = $self->popup('category', 	$tkt{'category'}, $id.'_category');
	$tkt{'osname'}     = $self->popup('osname', 	$id.'_osname',    $tkt{'osname'});
	$tkt{'select'}     = $cgi->checkbox(-'name'=>'bugid', -'checked' => '', -'value'=> $id);
	$tkt{'severity'}   = $self->popup('severity', 	$id.'_severity',   $tkt{'severity'});
	$tkt{'status'}     = $self->popup('status', 	$id.'_status',     $tkt{'status'});
FORMAT_B_l

Lean ascii format for tickets:

FORMAT_B_A

Default ASCII format for bugs:

...

FORMAT_B_L

Lean html format for tickets:

FORMAT_B_h

Html minimal format: ...

FORMAT_B_H

Html, tabled in block format: ...

FORMAT_M_A

Messages block ASCII format.

FORMAT_M_h

Messages in list html format.

FORMAT_M_H

Messages in block html format.

FORMAT_U_l

User list format.

FORMAT_U_a

User ascii format.

FORMAT_U_A

User ASCII format.

FORMAT_U_h

User in list html format.

FORMAT_H_l

History list format.

FORMAT_H_a

History list format.

FORMAT_H_h

History in list html format.

FORMAT_N_l

Note lean format.

FORMAT_N_a

Note list format.

FORMAT_N_A

Note block ASCII format.

FORMAT_N_h

Note in list html format.

FORMAT_N_H

Note in block html format.

FORMAT_P_l

Patch lean format.

FORMAT_P_a

Patch list format.

FORMAT_P_A

Patch block ASCII format.

FORMAT_P_h

Note in list html format.

FORMAT_P_H

Patch in block html format

FORMAT_T_l

Test lean format.

FORMAT_T_a

Test list format.

FORMAT_T_A

Test block ASCII format.

FORMAT_T_h

Test in list html format.

FORMAT_T_H

Test in block html format

FORMAT_G_l

Group list format.

FORMAT_G_a

Group ascii format.

FORMAT_G_A

Group ascii format.

FORMAT_G_h

Group in list html format.

FORMAT_G_H

Group in list html format.

AUTHOR

Richard Foley perlbug@rfi.net Oct 1999