Perlbug::Utility - Object handler for Utility methods


Perlbug documentation Contained in the Perlbug distribution.

Index


Code Index:

NAME

Top

Perlbug::Utility - Object handler for Utility methods

DESCRIPTION

Top

Utility wrapper for Perlbug modules usage

SYNOPSIS

Top

	use Perlbug::Utility;

	print Perlbug::Utility->new()->dump;

METHODS

Top

new

Create new Perlbug::Utility object.

	my $o_ute = Perlbug::Utility->new;

dump

Wraps Dumper() and dumps given args

	print $o_ute->dump($h_data);

html_dump

Encodes and dumps given args

	print $o_ute->html_dump($h_data);

AUTHOR

Top

Richard Foley perlbug@rfi.net 2001


Perlbug documentation Contained in the Perlbug distribution.
# Perlbug javascript routines
# (C) 2000 Richard Foley RFI perlbug@rfi.net
# $Id: Utility.pm,v 1.2 2002/01/25 16:12:58 richardf Exp $
#   

package Perlbug::Utility;
use Data::Dumper;
use HTML::Entities;
use strict;
use vars qw(@ISA $VERSION);
$VERSION  = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; 
$| = 1; 

use CGI;


sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto; 

	bless({}, $class);
}


sub dump {
	my $self = shift;
	my @args = @_;
	my $res  = "rjsf dump: \n";

	my $i_cnt = 0;
	foreach my $arg (@args) {
		$res .= "\t$i_cnt($arg): ".Dumper(\$arg);
		$i_cnt++;
	}
	$res .= "\n";

	return $res;
}

sub html_dump {
	my $self = shift;
	my @args = @_;
	my $res  = "<table>\n<tr><td>rjsf html_dump: </td></tr>\n";

	my $i_cnt = 0;
	foreach my $arg (@args) {
		$res .= qq|<tr><td>$i_cnt($arg): <pre>|.Dumper($arg).qq|&nbsp;</pre></td></tr>\n|;	
		$i_cnt++;
	}
	$res .= "</table>\n";

	return $res;
}

1