On Wed, 27 Dec 2006 13:36:23 -0500
zentara <[EMAIL PROTECTED]> wrote:

>In my learning phase, I find it very useful to dump out
>piddles. However, if they are big, I get the 
>'TOO LONG TO PRINT' message.

Well to partially answer my own question, I did do this
redefine of a sub which works.

Here is an example, you can reset $max_elem

#!/usr/bin/perl
use strict;
use warnings;
use PDL::LiteF;
no warnings "redefine";    #see perldoc perllexwarn

my $max_elem = 100000;     # built-in default is 10000

sub PDL::Core::string {
   my ( $self, $format ) = @_;
   if ( $PDL::_STRINGIZING ) {
      return "ALREADY_STRINGIZING_NO_LOOPS";
   }
   local $PDL::_STRINGIZING = 1;
   my $ndims = $self->getndims;
   if ( $self->nelem > $max_elem ) {
      return "TOO LONG TO PRINT";
   }
   if ( $ndims == 0 ) {
      if ( $self->badflag() and $self->isbad() ) {
         return "BAD";
      }
      else {
         my @x = $self->at();
         return ( $format ? sprintf( $format, $x[ 0 ] ) : "$x[0]" );
      }
   }
   return "Null"  if $self->isnull;
   return "Empty" if $self->isempty;    # Empty piddle

   local $PDL::Core::sep  = $PDL::use_commas ? "," : " ";
   local $PDL::Core::sep2 = $PDL::use_commas ? "," : "";
   if ( $ndims == 1 ) {
      return PDL::Core::str1D( $self, $format );
   }
   else {
      return PDL::Core::strND( $self, $format, 0 );
   }
}

my $pdl = sequence( 100, 100, 3 );
print $pdl;
print "\n";
__END__




-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

_______________________________________________
Perldl mailing list
Perldl@jach.hawaii.edu
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to