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::Message

SYNOPSIS

my $request = new Net::HL7::Request(); my $conn = new Net::HL7::Connection('localhost', 8089);

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

$seg1->setField(1, "foo");

$request->addSegment($seg1);

my $response = $conn->send($request);

DESCRIPTION

In general one needn't create an instance of the Net::HL7::Message class directly, but use the Net::HL7::Request class. The Message will be created with a MSH segment as it's first segment.

METHODS

$m = new Net::HL7::Message([$msg])

The constructor takes an optional string argument that is a string representation of a HL7 message. If the string representation is not a valid HL7 message. according to the specifications, undef is returned instead of a new instance.

addSegment($segment)

Add the segment. to the end of the message. The segment should be an instance of Net::HL7::Segment.

insertSegment($segment, $idx)

Insert the segment. The segment should be an instance of Net::HL7::Segment. If the index is not given, the segment is added to the of the message.

getSegmentByIndex($index)

Return the segment specified by $index.

getSegmentsByName

Return an array of all segments with the given name

removeSegmentByIndex($index)

Remove the segment indexed by $index. If it doesn't exist, nothing happens, if it does, all segments after this one will be moved one index up.

setSegment($seg, $index)

Set the segment on index. If index is out of range, or not provided, do nothing.

getSegments()

Return an array containing all segments in the right order.

toString($pretty)

Return a string representation of this message. This can be used to send over a Net::HL7::Connection. To print to other output, use provide the $pretty argument as some true value. This will skip the HL7 control characters, and use '\n' instead.

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.