--- trunk/lib/WebPAC/Input.pm 2006/11/03 20:40:33 771 +++ trunk/lib/WebPAC/Input.pm 2007/02/04 13:28:30 797 @@ -16,11 +16,11 @@ =head1 VERSION -Version 0.15 +Version 0.17 =cut -our $VERSION = '0.15'; +our $VERSION = '0.17'; =head1 SYNOPSIS @@ -469,10 +469,12 @@ sub seek { my $self = shift; - my $pos = shift || return; + my $pos = shift; my $log = $self->_get_logger(); + $log->logconfess("called without pos") unless defined($pos); + if ($pos < 1) { $log->warn("seek before first record"); $pos = 1; @@ -535,19 +537,19 @@ return $out; } -=head2 dump +=head2 dump_ascii Display humanly readable dump of record =cut -sub dump { +sub dump_ascii { my $self = shift; return unless $self->{ll_db}; if ($self->{ll_db}->can('dump_rec')) { - return $self->{ll_db}->dump_rec( $self->{pos} ); + return $self->{ll_db}->dump_ascii( $self->{pos} ); } else { return dump( $self->{ll_db}->fetch_rec( $self->{pos} ) ); } @@ -566,12 +568,22 @@ sub _get_regex { my ($sf,$from,$to) = @_; + + # protect / + $from =~ s!/!\\/!gs; + $to =~ s!/!\\/!gs; + + if ($from =~ m/^regex:(.+)$/) { + $from = $1; + } else { + $from = '\Q' . $from . '\E'; + } if ($sf =~ /^\^/) { return - 's/\Q'. $sf .'\E([^\^]*?)\Q'. $from .'\E([^\^]*?)/'. $sf .'$1'. $to .'$2/'; + 's/\Q'. $sf .'\E([^\^]*?)'. $from .'([^\^]*?)/'. $sf .'$1'. $to .'$2/'; } else { return - 's/\Q'. $from .'\E/'. $to .'/g'; + 's/'. $from .'/'. $to .'/g'; } }