Frank Dupont > SWIFT-Factory-Tag-Tag15-0.02 > SWIFT::Factory::Tag::Tag15

Download:
SWIFT-Factory-Tag-Tag15-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

SWIFT::Factory::Tag::Tag15 - Provide a generic TAG15 for a SWIFT message.

SYNOPSIS ^

  use SWIFT::Factory::Tag::Tag15;
  my $tag15 = SWIFT::Factory::Tag::Tag15->new( DO_CLEANUP=>1, SEQUENCE_ID=>'A' );

DESCRIPTION ^

Tag 15 is used to start different sub-sequences in many SWIFT messages.

This class is generic in the sence that it can be used to provide TAG15A, TAG15B .. TAG15Z, all depending upon the SEQUENCE_ID given in either the constructor or in the sequence_id() method.

If the SWIFT message that is going to be built contains more than one TAG15, it is probably wise to instantiate more than one object of the SWIFT::Factory::Tag::Tag15 class.

Like this:

  use SWIFT::Factory::Tag::Tag15;
  my $tag15A = SWIFT::Factory::Tag::Tag15->new( SEQUENCE_ID=>'A' );
  my $tag15B = SWIFT::Factory::Tag::Tag15->new( SEQUENCE_ID=>'B' );

Or like this:

  use SWIFT::Factory::Tag::Tag15;
  my $tag15A = SWIFT::Factory::Tag::Tag15->new();
  my $tag15B = SWIFT::Factory::Tag::Tag15->new();

  $tag15A->secuence_id('A');
  $tag15B->secuence_id('B');

CONSTRUCTOR ^

SWIFT::Factory::Tag::Tag15->new( DO_CLEANUP=>0, SEQUENCE_ID=>'A' );

Instantiates a new Tag15 object.

The parameters may be given in arbitrary order. Both parameters have built-in default values. If the calling application doesn't provide a specific parameter at all, the object will apply the default value to that parameter.

DO_CLEANUP=>

Optional. Default value: false

If given with any true value, the object will try to cleanup some of the parameters given. For instance, if SEQUENCE_ID=> is given in lower-case, the Tag15 object will convert it to upper-case.

If not given, or if given with a false value, it is fully up to the calling application to assure that the given parameters contain reasonable values.

SEQUENCE_ID=>

Optional.

A one character value that will be appended to the TAG. If SEQUENCE_ID=> contains the letter 'A', then a TAG15A will be provided. If SEQUENCE_ID=> contains the letter 'B', then a TAG15B will be provided. Etc.

If DO_CLEANUP=> was given a true value, then the character given in SEQUENCE_ID=> will always be converted to upper-case, as well as the object will only honor the first character in SEQUENCE_ID=>.

If DO_CLEANUP=> holds a false value (the default), then whatever value given in SEQUENCE_ID=> will be used without any questions asked.

PUBLIC METHODS ^

borken()

A really broken alias for invalid(). Will execute exactly the same code as the invalid() method.

invalid()

Will return the number of errors detected in the objects instance data.

The class can never be charged to guarrantee that the provided string() will be fully compliant with the SWIFT standards or SWIFT verification rules. It can only point out known problems in the object as it is curently loaded.

BETA

Please beware that the current implementation of invalid() doesn't check anything at all. Consider it a placeholder for now. When time permits, the method will be filled with validation code.

Return value:

As it stands, the method will always return zero since it wasn't able to discover any error at all.

provide()

An alias for string(). Will execute exactly the same code as the string() method.

sequence_id()

Get and/or set the Sequence ID that will be used when providing the TAG15x string.

Takes one optional scalar parameter, a one character Sequence ID that will be used in all subsequent method calls for this object.

If a Sequence ID is provided, it will be stored for future use.

Return value:

 If called in a scalar context, the method will return the Sequence ID stored.
 If called in an array context, the method will return an array containing one single value, the Sequence ID stored.
 If called in void context, the method will return undef.
string()

Will return a fully formatted string containing a TAG15x for a SWIFT message.

VERSION()

Will return the version of this Perl module. (This method is inherited from the UNIVERSAL class.)

EXAMPLE ^

 my $tag15C = SWIFT::Factory::Tag::Tag15->new(DO_CLEANUP=>1);

 $tag15C->sequence_id('A');               # Note, we're giving an 'A' to the TAG15C.

 print('TAG15 has Sequence ID: '.
       $tag15C->sequence_id().
       "\n");

 # Prints: TAG15 has Sequence ID: A

 print('TAG15 has Sequence ID: '.
       $tag15C->sequence_id('ceasar').    # Aiming for 'C'. DO_CLEANUP will come into play.
       "\n");

 # Prints: TAG15 has Sequence ID: C

 if( $tag15C->invalid() ) {
    die("Invalid data in TAG15C");
 }
 else {
    print($tag15C->provide());
 }

 # Prints: :15C:  (Plus a trailing CR-LF, which is the only payload data in a TAG15x tag.

AUTHOR ^

BIKER, <biker_cpan@hotmail.com>

COPYRIGHT ^

Copyright (c) 2003, BIKER. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

Other Perl modules implementing SWIFT tags in the SWIFT::Factory::Tag::Tagnn family.

Appropriate SWIFT documentation.

syntax highlighting: