Kal87 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use warnings; use strict; use Text::CSV_XS; use XML::Twig; my $csv = 'Text::CSV_XS'->new({ sep_char => '|', }); sub process_EDI_DC40 { my ($twig, $thingy) = @_; my @values = map { my $ch = $thingy->first_child( $_ ); $ch ? $ch->text : "" } qw( DOCNUM MESTYP SNDPRN RCVPOR RCVPRN ); unshift @values,'XML'; $csv->say (*STDOUT, \@values); } my $listfile = shift; open my $list, '<', $listfile or die $!; my $twig = 'XML::Twig'->new( twig_handlers => { EDI_DC40 => \&process_EDI_DC40, }, ); while (my $xmlfile = <$list>) { chomp $xmlfile; $twig->parsefile($xmlfile); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Segmentation coredump issue
by hippo (Archbishop) on May 04, 2018 at 11:22 UTC | |
by Anonymous Monk on May 04, 2018 at 13:02 UTC | |
|
Re: Segmentation coredump issue
by choroba (Cardinal) on May 04, 2018 at 14:51 UTC | |
by Kal87 (Novice) on May 08, 2018 at 13:31 UTC | |
by Kal87 (Novice) on May 08, 2018 at 15:59 UTC | |
|
Re: Segmentation coredump issue
by marto (Cardinal) on May 04, 2018 at 11:17 UTC | |
by Kal87 (Novice) on May 04, 2018 at 11:42 UTC | |
by marto (Cardinal) on May 04, 2018 at 12:36 UTC | |
|
Re: Segmentation coredump issue
by bliako (Abbot) on May 04, 2018 at 20:25 UTC |