Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pdl::dbg(3) [redhat man page]

Dbg(3)							User Contributed Perl Documentation						    Dbg(3)

NAME
PDL::Dbg - functions to support debugging of PDL scripts SYNOPSIS
use PDL; use PDL::Dbg; $c = $a->slice("5:10,2:30")->px->diagonal(3,4); PDL->px; DESCRIPTION
This packages implements a couple of functions that should come in handy when debugging your PDL scripts. They make a lot of sense while you're doing rapid prototyping of new PDL code, let's say inside the perldl shell. FUNCTIONS
px Print info about a piddle (or all known piddles) perldl> PDL->px perldl> $b += $a->clump(2)->px('clumptest')->sumover perldl> $a->px('%C (%A) Type: %T') This function prints some information about piddles. It can be invoked as a class method (e.g. "PDL->px" ) or as an instance method (e.g. "$pdl->px($arg)"). If invoked as a class method it prints info about all piddles found in the current package (excluding "my" variables). This comes in quite handy when you are not quite sure which pdls you have already defined, what data they hold , etc. "px" is supposed to support inheritance and prints info about all symbols for which an "isa($class)" is true. An optional string argument is interpreted as the package name for which to print sym- bols: perldl> PDL->px('PDL::Mypack') The default package is that of the caller. invoked as an instance method it prints info about that particular piddle if $PDL::debug is true and returns the pdl object upon completion. It accepts an optional string argument that is simply prepended to the default info if it doesn't contain a "%" character. If, however, the argument contains a "%" then the string is passed to the "info" method to control the format of the printed information. This can be used to achieve custom- ized output from "px". See the documentation of "PDL::info" for further details. The output of px will be determined by the default formatting string that is passed to the "info" method (unless you pass a string contain- ing "%" to px when invoking as an instance method, see above). This default string is stored in $PDL::Dbg::Infostr and the default output format can be accordingly changed by setting this variable. If you do this you should also change the default title string that the class method branch prints at the top of the listing to match your new format string. The default title is stored in the variable $PDL::Dbg::Title. For historical reasons "vars" is an alias for "px". vars Alias for "px" BUGS
There are probably some. Please report if you find any. Bug reports should be sent to the PDL mailing list perldl@jachw.hawaii.edu. AUTHOR
Copyright(C) 1997 Christian Soeller (c.soeller@auckland.ac.nz). All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is sepa- rated from the PDL distribution, the copyright notice should be included in the file. perl v5.8.0 2000-04-17 Dbg(3)

Check Out this Related Man Page

OBJECTS(1)						User Contributed Perl Documentation						OBJECTS(1)

NAME
PDL::Objects -- Object-Orientation, what is it and how to exploit it DESCRIPTION
This still needs to be written properly. Inheritance There are basically two reasons for subclassing piddles. The first is simply that you want to be able to use your own routines like $piddle->something() but don't want to mess up the PDL namespace (a worthy goal, indeed!). The other is that you wish to provide special handling of some func- tions or more information about the data the piddle contains. In the first case, you can do with package BAR; @ISA=qw/PDL/; sub foo {my($this) = @_; fiddle;} package main; $a = PDL::pdl(BAR,5); $a->foo(); However, because a PDL object is an opaque reference to a C struct, it is not possible to extend the PDL class by e.g. extra data via sub- classing. To circumvent this problem PerlDL has built-in support to extent the PDL class via the has-a relation for blessed hashes. You can get the HAS-A behave like IS-A simply in that you assign the "PDL" object to the attribute named PDL and redefine the method initial- ize(). package FOO; @FOO::ISA = qw(PDL); sub initialize { my $class = shift; my $self = { creation_time => time(), # necessary extension :-) PDL => null, # used to store PDL object }; bless $self, $class; } All PDL constructors will call initialize() to make sure that your extentions are added by all PDL constructors automaticly. The "PDL" attribute is used by perlDL to store the PDL object and all PDL methods use this attribute automaticly if they are called with a blessed hash reference instead of a PDL object (a blessed scalar). Do remember that if you subclass a class that is subclassed from a piddle, you need to call SUPER::initialize. NEED STUFF ABOUT CODE REFs!! Examples You can find some simple examples of PDL subclassing in the PDL distribution test-case files. Look in "t/subclass2.t", "t/subclass3.t", etc. Output Auto-Creation and Subclassed Objects For PDL Functions where the output is created and returned, PDL will either call the subclassed object's "initialize" or "copy" method to create the output object. (See PDL::Indexing for a discussion on Output Auto-Creation.) This behavior is summarized as follows: o For Simple functions, defined as having a signature of func( a(), [o]b() ) PDL will call $a->copy to create the output object. In the spirit of the perl philosophy of making Easy Things Easy, This behavior enables PDL-subclassed objects to be written without having to overload the many simple PDL functions in this category. The file t/subclass4.t in the PDL Distribution tests for this behavior. See that file for an example. o For other functions, PDL will call $class->initialize to create the output object. Where $class is the class name of the first argument supplied to the function. For these more complex cases, it is difficult to second-guess the subclassed-object's designer to know if a "copy" or a "initialize" is appropriate. So for these cases, $class->initialize is called by default. If this is not appropriate for you, overload the function in your subclass and do whatever is appropriate is the overloaded function's code. AUTHOR
Copyright (C) Karl Glazebrook (kgb@aaoepp.aao.gov.au), Tuomas J. Lukka, (lukka@husc.harvard.edu) and Christian Soeller (c.soeller@auck- land.ac.nz) 2000. Commercial reproduction of this documentation in a different format is forbidden. perl v5.8.0 2000-05-25 OBJECTS(1)
Man Page