All pastes #18605 Raw Edit

Mine

public text v1 · immutable
#18605 ·published 2005-07-27 12:23 UTC
rendered paste body
sub printPartt()
{
  my $top = $_[0];
  my $ent;
  my $i = 0;
  foreach $ent ($top->parts_DFS) {
  	# test if it is a valid entity for processing  
  	if ($ent->bodyhandle) {

  		# declare a mimetype variable and fill it by calling the mime_type() instance method   
  		my $mimetype = $ent->mime_type();
  
  		# declare a data variable containing the data of the message part and fill it by calling the mime_type() instance method   
  		my $data=$ent->as_string;
  
  		# declare an effective type variable containing the effective type 
  		my $effectivetype = $ent->effective_type;
  		
  		print  "\n\tnr:",$i,"\n\n",$ent->head->as_string,"\n\n\n";
  		
      #if($effectivetype !~ /image/i)
  		#{
  		#  print "\n\n==========================\ndata = \n$data\n==========================\n\n";
      #  print  "\n",$ent->head->as_string,"\n\n\n";
  		#} else {
      #  print  "\n",$ent->head->as_string,"\n\n\n";
      #  print  "\n name:",$ent->head->mime_attr("content-type.name"),"\n\n\n";
      #}
  
  		# fill in the content disposition logic here 		
  
  		# fill in the filename logic here 		
  		# this doesn't seem to work on core objects
  		#my $filename = $ent->bodyhandle->path;
  		#print "filename = $filename\n";
  	}
  $i++;
  }
}