| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ################################################################################ | 
| 2 |  |  |  |  |  |  | # | 
| 3 |  |  |  |  |  |  | # File      : HL7.pm | 
| 4 |  |  |  |  |  |  | # Author    : D.A.Dokter | 
| 5 |  |  |  |  |  |  | # Created   : 30 Jan 2004 | 
| 6 |  |  |  |  |  |  | # Version   : $Id: HL7.pm,v 1.11 2015/01/29 15:30:10 wyldebeast Exp $ | 
| 7 |  |  |  |  |  |  | # Copyright : Wyldebeast & Wunderliebe | 
| 8 |  |  |  |  |  |  | # | 
| 9 |  |  |  |  |  |  | ################################################################################ | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | package Net::HL7; | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 4 |  |  | 4 |  | 16 | use strict; | 
|  | 4 |  |  |  |  | 5 |  | 
|  | 4 |  |  |  |  | 560 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | our $VERSION = "0.81"; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =pod | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =head1 NAME | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | Net::HL7 | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | The Net-HL7 package is a simple Perl API for creating, parsing sending | 
| 26 |  |  |  |  |  |  | and receiving HL7 messages. To create an empty HL7 message object, do: | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | =begin text | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | use Net::HL7::Message; | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | my $msg = new Net::HL7::Message(); | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | =end text | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | and add segments like: | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =begin text | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | my $msh = new Net::HL7::Segments::MSH(); | 
| 41 |  |  |  |  |  |  | my $pid = new Net::HL7::Segment("PID"); | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | $pid->setField(3, "1231313"); | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | $msg->addSegment($msh); | 
| 46 |  |  |  |  |  |  | $msg->addSegment($pid); | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =end text | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | For details, please consult the man pages of each specific class, or | 
| 51 |  |  |  |  |  |  | consult the generated API docs on | 
| 52 |  |  |  |  |  |  | I. You might also check the test files | 
| 53 |  |  |  |  |  |  | in the 't' directory for examples. | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | The Net::HL7 class is only used for documentation purposes (the stuff | 
| 56 |  |  |  |  |  |  | you're reading right now), to set HL7 configuration properties such as | 
| 57 |  |  |  |  |  |  | control characters on a global level and to provide a version number | 
| 58 |  |  |  |  |  |  | of the package to the Perl installation process. This can be used in a | 
| 59 |  |  |  |  |  |  | 'require' statement, or to create a dependency from another Perl | 
| 60 |  |  |  |  |  |  | package. | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | =head1 PROPERTIES | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | Some HL7 properties may be altered on a global level. Altering the | 
| 65 |  |  |  |  |  |  | variable makes it changed for this remainder of the lifetime of this | 
| 66 |  |  |  |  |  |  | Perl process. All HL7 messages will use the values provided here, | 
| 67 |  |  |  |  |  |  | unless something is changed in the MSH segment concerning these | 
| 68 |  |  |  |  |  |  | properties. | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | =over 4 | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | =item B | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | Separator for segments within a message. Usually this is \015. | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | =cut | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | our $SEGMENT_SEPARATOR = "\015"; | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | =pod | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =item B | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | Field separator for this message. In general '|' is used. | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =cut | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | our $FIELD_SEPARATOR = "|"; | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =pod | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | =item B | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | HL7 NULL field, defaults to "". This is therefore different from not | 
| 95 |  |  |  |  |  |  | setting the fields at all. | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | =cut | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | our $NULL = "\"\""; | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =pod | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =item B | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | Separator used in fields supporting components. Usually this is the | 
| 106 |  |  |  |  |  |  | '^' character. | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | =cut | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | our $COMPONENT_SEPARATOR    = "^"; | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | =pod | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =item B | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | Separator for fields that may be repeated. Defaults to '~'. | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | =cut | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | our $REPETITION_SEPARATOR   = "~"; | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =pod | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | =item B | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | Escape character for escaping special characters. Defaults to '\'. | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | =cut | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | our $ESCAPE_CHARACTER       = "\\"; | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =pod | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | =item B | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | Separator used in fields supporting subcomponents. Usually this is | 
| 137 |  |  |  |  |  |  | the '&' character. | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | =cut | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | our $SUBCOMPONENT_SEPARATOR = "&"; | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =pod | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | =item B | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | This is the version used in the MSH(12) field. Defaults to 2.2. | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | =back | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | =cut | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | our $HL7_VERSION            = "2.2"; | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | 1; |