Cappadonna3030 has asked for the wisdom of the Perl Monks concerning the following question:
I get the following error:package CathRecord; require XML::DOM; use strict; use Class::Struct; struct CathRecord => { PatDemo => '@', CathEvents => '%', Procedures => '%', CathStaff => '%', CathBlood => '%', CathEvent => '%', CathSat => '%', CathAldrete => '%', }; 1; sub CamPatDemo { my $file = $_[0]; my $obj = CathRecord->new(); my $parser = XML::DOM::Parser->new(); my $doc = $parser->parsefile($file); my @patdemo; my ($ln, $fn, $sex, $dob, $htu, $htn, $wtu, $wtn, $patnum, $patien +t); #Get Patient Data foreach $patient($doc->getElementsByTagName('SA_PATIENT')) { $ln = $patient->getElementsByTagName('MY_LAST_NAME')->item(0)- +>getFirstChild->getNodeValue; $fn = $patient->getElementsByTagName('MY_FIRST_NAME')->item(0) +->getFirstChild->getNodeValue; $dob = $patient->getElementsByTagName('MY_BIRTH_DATE')->item(0 +)->getFirstChild->getNodeValue; $sex = $patient->getElementsByTagName('MY_GENDER')->item(0)->g +etFirstChild->getNodeValue; $dob = $patient->getElementsByTagName('MY_BIRTH_DATE')->item(0 +)->getFirstChild->getNodeValue; } foreach $patient($doc->getElementsByTagName('CathStudy')) { $htn = $patient->getElementsByTagName('PatHeight')->item(0)->g +etFirstChild->getNodeValue; $wtn = $patient->getElementsByTagName('PatWeight')->item(0)->g +etFirstChild->getNodeValue; $htu = $patient->getElementsByTagName('PatHeight')->item(0)->g +etAttribute('Units'); $wtu = $patient->getElementsByTagName('PatWeight')->item(0)->g +etAttribute('Units'); $patnum = $patient->getElementsByTagName('StudyID')->item(0)-> +getFirstChild->getNodeValue; } @patdemo = [$ln, $fn, $dob, $sex, $dob, $htn, $htn, $wtu, $wtn, $p +atnum]; $obj->{'PatDemo'} = @patdemo; return $obj-{'PatDemo'}; }
For some reason, my module is unable to accept a string. It keeps referring to my entry as a hash. Here is my input code:H:\My Documents\HemoKit>perl m6.pl Couldn't open CathRecord=HASH(0x234ee0): No such file or directory at CathRecord.pm line 25
Is it the module or the way I am accessing its attributes. Regards - Cappadonna#!/usr/bin/perl -w use XML::DOM; use CathRecord; ### Create New Object my $file = "H:/My Documents/files/mfrTESTa.XML"; my $obj = CathRecord->new(); my @sa = $obj->CamPatDemo($file);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Attempting to read file name into my XML Parsing Object
by Fletch (Bishop) on Apr 26, 2006 at 18:06 UTC | |
by Cappadonna3030 (Sexton) on Apr 26, 2006 at 19:39 UTC |