The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::HL7::Segment

SYNOPSIS

my $seg = new Net::HL7::Segment("PID");

$seg->setField(3, "12345678"); print $seg->getField(1);

DESCRIPTION

The Net::HL7::Segment class represents segments of the HL7 message.

METHODS

new($name)

Create an instance of this segment. The field separator defaults to '|'. If the name is not given, no segment is created. The segment name should be three characters long, and upper case. If it isn't, no segment is created.

setField($index, @value)

Set the field specified by index to value. Indices start at 1, to stay with the HL7 standard. Trying to set the value at index 0 has no effect. If you provide more than one value, or an array of values, the field will effectively be set to the join of these fields with the Net::HL7::Segments::MSH::COMPONENT_SEPARATOR. To set a field to the HL7 null value, instead of omitting a field, can be achieved with the Net::HL7::Segment::NULL variable, like:

  $segment->setField(8, $Net::HL7::Segment::NULL);

This will render the field as the double quote ("").

getField($index)

Get the field at index. If the field is a composed field, you will need to do something like:

@values = split($Net::HL7::Segments::MSH::REPETITION_SEPARATOR, $segment->getField(9));

size()

Get the number of fields for this segment, not including the name

getFields($from, $to)

Get the fields in the specified range.

getName()

Get the name of the segment. This is basically the value at index 0

setFieldSeparator($sep)

Set the field separator for the segment

getFieldSeparator()

Get the field separator for the segment

toString()

Return a string representation of this segment, based on the Net::HL7::Segment::FIELD_SEPARATOR variable. This method renders a syntactically correct segment representation.

AUTHOR

D.A.Dokter <dokter@wyldebeast-wunderliebe.com>

LICENSE

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