Changeset 35

Show
Ignore:
Timestamp:
01/21/01 22:02:37
Author:
miyagawa
Message:

improved document.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Mac-Macbinary/trunk/Changes

    r34 r35  
    22 
    33$Id$ 
     4 
     50.04    - Documented the "validate" attribute. 
    46 
    570.03    - Implemented _validate_header() method to check and see if a file 
  • Mac-Macbinary/trunk/MANIFEST.SKIP

    r15 r35  
    88^pm_to_blib 
    99^MakeMaker-\d 
     10\.gz$ 
  • Mac-Macbinary/trunk/Macbinary.pm

    r32 r35  
    33use strict; 
    44use vars qw($VERSION $AUTOLOAD); 
    5 $VERSION = '0.03'; 
     5$VERSION = '0.04'; 
    66 
    77use Carp (); 
     
    151151  $mb = Mac::Macbinary->new("/path/to/file"); 
    152152 
     153  # do validation 
     154  eval { 
     155      $mb = Mac::Macbinary->new("/path/to/file", { validate => 1 }); 
     156  }; 
     157 
    153158  $header = $mb->header;                # Mac::Macbinary::Header instance 
    154159  $name = $header->name; 
     
    168173=over 4 
    169174 
    170 =item new( THINGY
     175=item new( THINGY, [ \%attr ]
    171176 
    172177Constructor of Mac::Macbinary. Accepts filhandle GLOB reference, 
     
    192197existing file. 
    193198 
     199The optional "\%attr" parameter can be used for validation of file 
     200format.  You can check and see if a file is really a Macbinary or not 
     201by setting "validate" attribute to 1. 
     202 
     203  $fh = FileHandle->new("path/to/file"); 
     204  eval { 
     205      $mb = Mac::Macbinary->new(FileHandle->new($fh), {  
     206           validate => 1, 
     207      }); 
     208  }; 
     209  if ($@) { 
     210      warn "file is not a Macbinary."; 
     211  } 
    194212 
    195213=back 
  • Mac-Macbinary/trunk/README

    r33 r35  
    88      $mb = Mac::Macbinary->new($fh);       # IO::* instance 
    99      $mb = Mac::Macbinary->new("/path/to/file"); 
     10 
     11      # do validation 
     12      eval { 
     13          $mb = Mac::Macbinary->new("/path/to/file", { validate => 1 }); 
     14      }; 
    1015 
    1116      $header = $mb->header;                # Mac::Macbinary::Header instance 
     
    2126  Class method 
    2227 
    23     new( THINGY
     28    new( THINGY, [ \%attr ]
    2429        Constructor of Mac::Macbinary. Accepts filhandle GLOB reference, 
    2530        FileHandle instance, IO::* instance, or whatever objects that can do 
     
    4348        argument to the constructor is neither a valid filehandle nor an 
    4449        existing file. 
     50 
     51        The optional "\%attr" parameter can be used for validation of file 
     52        format. You can check and see if a file is really a Macbinary or not 
     53        by setting "validate" attribute to 1. 
     54 
     55          $fh = FileHandle->new("path/to/file"); 
     56          eval { 
     57              $mb = Mac::Macbinary->new(FileHandle->new($fh), {  
     58                   validate => 1, 
     59              }); 
     60          }; 
     61          if ($@) { 
     62              warn "file is not a Macbinary."; 
     63          } 
    4564 
    4665  Instance Method