Re: Edifact anyone?
by kcott (Archbishop) on Dec 16, 2013 at 15:53 UTC
|
G'day Skeeve,
The warnings are explained in "perl5180delta: The smartmatch family of features are now experimental".
As you indicated "it's real customer data", I'll assume production code.
I'd caution against using experimental features in production code.
I see you've raised a bug report (#91446).
This would have been useful information in your OP as an update.
It also appears the module author has provided a fix.
Again, useful information for an update to your OP.
When you upgrade and test the fix, please also indicate the outcome.
| [reply] [Watch: Dir/Any] |
|
Sorry for not updating the OP, but it was a bit busy yesterday. Thanks for linking it. I also did not see the fix yet.
It might become production data and so I did not want to "reinvent the wheel" but stick to existing modules. The "experimental" warnings scared me a bit, but looking at the code, I think It could be rewritten as:
given(something) -> SWITCH: for(something)
when(/test/) -> /test/ && do {
s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
I'd caution against using experimental features in production code. You're not alone, but you don't say why?
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
|
|
Re: Edifact anyone?
by Anonymous Monk on Dec 16, 2013 at 11:31 UTC
|
The warnings I t hink I can live with, but what about the error message? ;) ... self contained program (with data) to reproduce ... then fix it :)
| [reply] [Watch: Dir/Any] |
|
As it's real customer data, I couldn't provide. Will see...
(later) Update my post with requested information
s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
| [reply] [Watch: Dir/Any] [d/l] [select] |
Re: Edifact anyone?
by GotToBTru (Prior) on Dec 16, 2013 at 16:16 UTC
|
EDI Translators are expensive, but worth it if you have more than just a very few trading partners. I would suggest that approach before writing your own.
Secondly, if I was going to expend the effort to write my own translator, I would be run, not walk, away from any module that generated warnings saying something in it is 'experimental'. Is it something that is going to change functionality or just go away in a future release? Is all my hard work going to be wasted?
Is your test data well formed? I work with X12, not EDIFACT, so I can't tell just by looking. That might be the source of the error. If not, I think you need to open up the module and go to the line indicated and see what it was trying to do.
| [reply] [Watch: Dir/Any] |
|
I would be run, not walk, away from any module that generated warnings saying something in it is 'experimental'. Is it something that is going to change functionality or just go away in a future release? Is all my hard work going to be wasted? Reason before panic friend :)
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
Hi Skeeve.
Until you mentioned it, I had never heard of EDIFact.
I am not sure why something that is supposed to be an ANSI ISO standard doesn't have a free API. It sounds like it is
the equivalent to charging for the IP protocol. Maybe I am wrong here. Maybe the charges are for variations
that orginzations add to EDI.
I did some poking around and it looks like there are many translators for sale on the net.
See references on this page for 'TrueCommerce' and 'B2B Gateway'
http://www.sleeter.com/blog/2012/04/quickbooks-edi/
I also came across some viewers. I am not sure if they will help you or not. Hopefully they will.
As with the library you found, as it was mentioned earlier, I would shy away from something that was potentially cobbled together. Espcially when
working with production data.
Copy and paste EDI code into the page. This one does translate the code you posted, but I am not sure if it is useful.
http://www.edifactviewer.com/
EDIFACT Viewer
http://sourceforge.net/projects/edifactviewer/
| [reply] [Watch: Dir/Any] |
|
I only mention X12 to say that I know EDI. It's what I do at my job, all day, every day.
You have no trading partner? Okay, but somebody you know does! Nobody messes around with EDIFACT unless they have to. So, you aren't writing a translator, just trying to understand the structure, and maybe learn some new perl skills along with it. I understand that. For my own work, I have not explored any of the EDI perl modules. We use a translator. I do have half a dozen awk scripts I use to make quick reports from EDI and application data files.
| [reply] [Watch: Dir/Any] |
Re: Edifact anyone?
by Anonymous Monk on Dec 16, 2013 at 23:15 UTC
|
Well, I've made progress, naturally , not knowing anything about the format, I made guesses (copy/paste) ... but most of the methods that do stuff like parse don't return values ... so here you go
#!/usr/bin/perl --
use strict;
use warnings;
use Data::Dump qw/ dd pp /;
use Business::Edifact::Interchange;
sub Business::Edifact::Message::handle_ftx {
package Business::Edifact::Message;
my ( $self, $data_arr ) = @_;
#~ ::dd( data_arr => $data_arr , lines => $self->{lines} );
my $lines = $self->{lines};
if( not @$lines ){
my $line = {
line_number => $data_arr->[0]->[0],
action_req => $data_arr->[1]->[0],
item_number => $data_arr->[2]->[0],
item_number_type => $data_arr->[2]->[1],
additional_product_ids => [],
item_description => [],
monetary_amount => [],
};
if ( $data_arr->[3]->[0] ) {
$line->{sub_line_info} = $data_arr->[3];
}
push @$lines, Business::Edifact::Message::LineItem->new($line)
+;
}
$self->{lines}->[-1]->{free_text} = {
qualifier => $data_arr->[0]->[0], # LIN/LNO
reference => $data_arr->[2],
};
if ( $data_arr->[3] ) {
$self->{lines}->[-1]->{free_text}->{text} = join q{ },
@{ $data_arr->[3] };
}
return;
}
my $edifact_message = q{UNA:+.? 'UNB+UNOC:3+1234567890123:14+321098765
+4321:14+131021:1523+391'UNH+1+INVOIC:D:96A:UN:EAN008'BGM+380+10776420
+90+9'DTM+137:20111020:102'DTM+35:20111020:102'FTX+AAK+1+ST2++DE'FTX+S
+UR+1++DAS LEISTUNGSDATUM ENTSPRICHT DEM RECHNUNGSDATUM+DE'RFF+ON:2330
+-35573'RFF+DQ:283506034'DTM+171:20111018:102'RFF+ABO:1087211625'DTM+1
+71:20111020:102'NAD+BY+3210987654321::9'RFF+VA:230/5740/0622'RFF+API:
+3508566'NAD+DP+4050964023306::9'NAD+SU+1234567890123::9'RFF+VA:DE2205
+64280'TAX+7+VAT+++:::7+S'CUX+2:EUR:4'LIN+1++1234567654321:EN'PIA+1+03
+460262:SA::91'IMD+A++:::NESLR Focaccia (24x400g) DE'IMD+C++IN'QTY+47:
+1:PCE'MOA+203:32.65'MOA+131:-12.95'PRI+AAB:45.6:::1:PCE'ALC+A+1++1+DI
+'MOA+8:12.95'RTE+1:12.95'LIN+2++1234567654321:EN+1:1'IMD+C++CU'QTY+59
+:1:PCE'UNS+S'MOA+77:34.94'MOA+79:32.65'MOA+125:32.65'MOA+124:2.29'TAX
++7+VAT+++:::7+S'MOA+79:32.65'MOA+124:2.29'TAX+7+VAT+++:::7+S'MOA+125:
+32.65'UNT+44+1'UNH+2+INVOIC:D:96A:UN:EAN008'BGM+393+1087211625+9'DTM+
+137:20111020:102'NAD+CPE+3210987654321::9'RFF+FC:230/5740/0622'NAD+SU
++1234567890123::9'RFF+VA:DE220564280'NAD+PR+3210987654321::9'NAD+PE+1
+234567890123::9'TAX+7+VAT+++:::7+S'CUX+2:EUR:4'PAT+3'DTM+13:20111025:
+102'UNS+S'MOA+86:34.94'MOA+9:34.94'MOA+124:2.29'MOA+125:32.65'UNT+19+
+2'UNZ+2+391'};
my $edi = Business::Edifact::Interchange->new();
$edi->parse($edifact_message);
dd( $edi );
__END__
| [reply] [Watch: Dir/Any] [d/l] |