Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

/var/sites/help-site.com/auto/tmp/CPAN/17543/Benchmark-Harness-1.12/Harness/Values.pm

/var/sites/help-site.com/auto/tmp/CPAN/17543/Benchmark-Harness-1.12/Harness/Values.pm



Benchmark::Harness::Values

SYNOPSIS

A harness that records the input parameters and return values of each function in the target program.

See Benchmark::Harness, ``Parameters'', for instruction on how to configure a test harness, and use 'Values' as your harness name.

REPORT

The report is an XML file with schema you can find in xsd/Values.xsd, or at http://schemas.benchmark-harness.org/Values.xsd

This schema adds a list of <V> sub-elements to each <T> element you would find in the basic Trace.xsd. An illustration of that <V> element:


  <T some-trace-attributes-see-Trace.xsd>

    <V n="1" v="15"/>

    <V n="2" v="3"/>

    <V n="3" v="4"/>

    <V n="0" v="22"/>

  </T>

The @n attribute is the index into the function's input parameter list. If @n=``0'', this is the return value of the function. The @v attribute is the value you would get by the expression ``$_[@n]'', i.e., the stringified value of the @n-th parameter.

GETTING MORE

The reporting mechanism uses the Stringify method to generate the @v attribute. You can control what gets printed here when rendering objects (i.e., bless refs) with this simple but powerful gimmick.

Add the following to the module that defines your parameter(s)' object(s):


  package MyClass;

  use overload '""' => \&stringify;

  sub stringify {

      my $self = shift;

      return 'MyClass::'.$self->{some_meaningful_value};

  }

Put your own specialized code in stringify() to render your MyClass objects in whatever form you would rather see them. Otherwise you will see something like ``MyClass::HASH{0x1bf2cd8}'';

SEE ALSO

Benchmark::Harness, Benchmark::Harness::Trace


AUTHOR

Glenn Wood, <glennwood@cpan.org>


COPYRIGHT

Copyright (C) 2004 Glenn Wood. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy