117 |
|
|
118 |
=item debug |
=item debug |
119 |
|
|
120 |
Dump a B<lot> of debugging output. |
Dump a B<lot> of debugging output even at level 1. For even more increase level. |
121 |
|
|
122 |
=back |
=back |
123 |
|
|
385 |
return $self->{'record'}; |
return $self->{'record'}; |
386 |
} |
} |
387 |
|
|
388 |
|
=head2 mfn |
389 |
|
|
390 |
|
Returns current MFN position |
391 |
|
|
392 |
|
my $mfn = $isis->mfn; |
393 |
|
|
394 |
|
=cut |
395 |
|
|
396 |
|
# This function should be simple return $self->{current_mfn}, |
397 |
|
# but if new is called with _hack_mfn it becomes setter. |
398 |
|
# It's useful in tests when setting $isis->{record} directly |
399 |
|
|
400 |
|
sub mfn { |
401 |
|
my $self = shift; |
402 |
|
return $self->{current_mfn}; |
403 |
|
}; |
404 |
|
|
405 |
|
|
406 |
=head2 to_ascii |
=head2 to_ascii |
407 |
|
|
408 |
Returns ASCII output of record with specified MFN |
Returns ASCII output of record with specified MFN |
491 |
|
|
492 |
This method will also create additional field C<000> with MFN. |
This method will also create additional field C<000> with MFN. |
493 |
|
|
494 |
|
There is also more elaborative way to call C<to_hash> like this: |
495 |
|
|
496 |
|
my $hash = $isis->to_hash({ |
497 |
|
mfn => 42, |
498 |
|
include_empty_subfields => 1, |
499 |
|
}); |
500 |
|
|
501 |
=cut |
=cut |
502 |
|
|
503 |
sub to_hash { |
sub to_hash { |
504 |
my $self = shift; |
my $self = shift; |
505 |
|
|
506 |
|
|
507 |
my $mfn = shift || confess "need mfn!"; |
my $mfn = shift || confess "need mfn!"; |
508 |
|
my $arg; |
509 |
|
|
510 |
|
if (ref($mfn) eq 'HASH') { |
511 |
|
$arg = $mfn; |
512 |
|
$mfn = $arg->{mfn} || confess "need mfn in arguments"; |
513 |
|
} |
514 |
|
|
515 |
# init record to include MFN as field 000 |
# init record to include MFN as field 000 |
516 |
my $rec = { '000' => [ $mfn ] }; |
my $rec = { '000' => [ $mfn ] }; |
536 |
foreach my $t (split(/\^/,$l)) { |
foreach my $t (split(/\^/,$l)) { |
537 |
next if (! $t); |
next if (! $t); |
538 |
my ($sf,$v) = (substr($t,0,1), substr($t,1)); |
my ($sf,$v) = (substr($t,0,1), substr($t,1)); |
539 |
warn "### $k^$sf:$v",$/ if ($self->{debug} > 1); |
# FIXME make this option ! |
540 |
|
next unless ($v); |
541 |
|
# warn "### $k^$sf:$v",$/ if ($self->{debug} > 1); |
542 |
|
|
543 |
|
# FIXME array return optional, by default unroll to ' ; ' |
544 |
if (ref( $val->{$sf} ) eq 'ARRAY') { |
if (ref( $val->{$sf} ) eq 'ARRAY') { |
545 |
|
|
546 |
push @{ $val->{$sf} }, $v; |
push @{ $val->{$sf} }, $v; |
547 |
} elsif (defined( $val->{$sf} )) { |
} elsif (defined( $val->{$sf} )) { |
548 |
# convert scalar field to array |
# convert scalar field to array |
668 |
tested this against ouput of one C<isis.dll>-based application, but I don't |
tested this against ouput of one C<isis.dll>-based application, but I don't |
669 |
know any details about it's version. |
know any details about it's version. |
670 |
|
|
671 |
|
=head1 VERSIONS |
672 |
|
|
673 |
|
You can find version dependencies documented here |
674 |
|
|
675 |
|
=over 8 |
676 |
|
|
677 |
|
=item 0.20 |
678 |
|
|
679 |
|
Added C<< $isis->mfn >>, support for repeatable subfields and |
680 |
|
C<< $isis->to_hash({ mfn => 42, ... }) >> calling convention |
681 |
|
|
682 |
|
=back |
683 |
|
|
684 |
=head1 AUTHOR |
=head1 AUTHOR |
685 |
|
|
686 |
Dobrica Pavlinusic |
Dobrica Pavlinusic |