/[webpac2]/Webpacus/lib/Webpacus/Model/WebPAC.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/lib/Webpacus/Model/WebPAC.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 222 by dpavlin, Mon Dec 5 19:15:01 2005 UTC revision 382 by dpavlin, Sun Jan 22 02:52:24 2006 UTC
# Line 6  use lib '/data/webpac2/lib'; Line 6  use lib '/data/webpac2/lib';
6  use base qw/  use base qw/
7          Catalyst::Model          Catalyst::Model
8  /;  /;
9  use Data::Dumper;  use WebPAC::Store 0.08;
10  use WebPAC::Store 0.03;  use Search::Estraier 0.04;
 use WebPAC::Output::TT 0.02;  
 use WebPAC::Search::Estraier 0.05;  
11  use File::Slurp;  use File::Slurp;
12  use Time::HiRes;  use Time::HiRes qw/time/;
13    use Encode qw/encode decode from_to/;
14    use Template;
15    use Data::Dumper;
16    
17  =head1 NAME  =head1 NAME
18    
# Line 40  Configuration for hyperestraier in C<con Line 41  Configuration for hyperestraier in C<con
41    user: 'admin'    user: 'admin'
42    passwd: 'admin'    passwd: 'admin'
43    hits_on_page: 100    hits_on_page: 100
44      hits_for_pager: 1000
45    
46   webpac:   webpac:
47    db_path: '/data/webpac2/db'    db_path: '/data/webpac2/db'
# Line 47  Configuration for hyperestraier in C<con Line 49  Configuration for hyperestraier in C<con
49    template: 'html_ffzg_results_short.tt'    template: 'html_ffzg_results_short.tt'
50    # encoding comming from webpac    # encoding comming from webpac
51    webpac_encoding: 'iso-8859-2'    webpac_encoding: 'iso-8859-2'
   # encoding expected by Catalyst  
   out_encoding: 'UTF-8'  
52    
53  =cut  =cut
54    
# Line 64  sub new { Line 64  sub new {
64          my $est_cfg = $c->config->{hyperestraier};          my $est_cfg = $c->config->{hyperestraier};
65          $est_cfg->{'log'} = $log;          $est_cfg->{'log'} = $log;
66    
67          $est_cfg->{encoding} = $est_cfg->{catalyst_encoding};          $est_cfg->{encoding} = $est_cfg->{catalyst_encoding} || $c->config->{catalyst_encoding} or $c->log->fatal("can't find catalyst_encoding");
68    
69          $log->debug("using config:" . Dumper($est_cfg) );          $log->debug("using config:" . Dumper($est_cfg) );
70    
# Line 74  sub new { Line 74  sub new {
74                  $est_cfg->{database} = $defaultnode;                  $est_cfg->{database} = $defaultnode;
75          }          }
76    
77          $self->{est} = new WebPAC::Search::Estraier( %{ $est_cfg } );          my $url = $est_cfg->{masterurl} . '/node/' . $est_cfg->{database};
78    
79            $log->info("opening Hyper Estraier index $url as $est_cfg->{'user'}");
80    
81            $self->{est_node} = Search::Estraier::Node->new(
82                    url => $url,
83                    user => $est_cfg->{user},
84                    passwd => $est_cfg->{passwd},
85            );
86    
87            $log->fatal("can't create Search::Estraier::Node $url") unless ($self->{est_node});
88    
89          # save config parametars in object          # save config parametars in object
90          foreach my $f (qw/db_path template_path hits_on_page webpac_encoding out_encoding defaultdepth/) {          foreach my $f (qw/db_path template_path hits_on_page webpac_encoding defaultdepth/) {
91                  $self->{$f} = $c->config->{hyperestraier}->{$f} ||                  $self->{$f} = $c->config->{hyperestraier}->{$f} ||
92                          $c->config->{webpac}->{$f};                          $c->config->{webpac}->{$f};
93                  $log->debug("self->{$f} = " . $self->{$f});                  $log->debug("self->{$f} = " . $self->{$f});
# Line 90  sub new { Line 100  sub new {
100          $self->{db} = new WebPAC::Store(          $self->{db} = new WebPAC::Store(
101                  path => $db_path,                  path => $db_path,
102                  read_only => 1,                  read_only => 1,
103          );                  database => $est_cfg->{database},
   
         $self->{out} = new WebPAC::Output::TT(  
                 include_path => $template_path,  
                 filters => { foo => sub { shift } },  
104          );          );
105    
106          # default template from config.yaml          # default template from config.yaml
107          $self->{template} ||= $c->config->{webpac}->{template};          $self->{template} ||= $c->config->{webpac}->{template};
108    
         $self->{iconv} = new Text::Iconv(  
                 $c->config->{webpac}->{webpac_encoding},  
                 $c->config->{webpac}->{out_encoding}  
         );  
   
109          $log->debug("converting encoding from webpac_encoding '" .          $log->debug("converting encoding from webpac_encoding '" .
110                  $c->config->{webpac}->{webpac_encoding} .                  $c->config->{webpac}->{webpac_encoding} .
                 "' to '" .  
                 $c->config->{webpac}->{out_encoding} .  
111                  "'"                  "'"
112          );          );
113    
114            $self->{databases} = $c->config->{databases} || $log->fatal("can't find databases in config");
115    
116            # create Template toolkit instance
117            $self->{'tt'} = Template->new(
118                    INCLUDE_PATH => $template_path,
119                    FILTERS => {
120                            dump_html => sub {
121                                    return unless (@_);
122                                    my $out;
123                                    my $i = 1;
124                                    foreach my $v (@_) {
125                                            $out .= qq{<div id="dump_$i">} .
126                                                    Data::HTMLDumper->Dump([ $v ],[ "v$i" ]) .
127                                                    qq{</div>};
128                                            $i++;
129                                    }
130                                    $out =~ s!<table[^>/]*>!<table class="dump">!gis if ($out);
131                                    return $out;
132                            }
133                    },
134                    EVAL_PERL => 1,
135            );
136    
137          return $self;          return $self;
138    
# Line 138  selected template. Line 159  selected template.
159  sub search {  sub search {
160          my $self = shift;          my $self = shift;
161    
162            my $search_start_t = time();
163    
164          my $args = {@_};          my $args = {@_};
165    
166          my $log = $self->{log};          my $log = $self->{log};
167    
168          $log->debug("args: " . Dumper( $args ));          $log->debug("search args: " . Dumper( $args ));
169    
170          my $query = $args->{phrase} || $log->warn("no query phrase") && return;          my $query = $args->{phrase} || $log->warn("no query phrase") && return;
171    
# Line 155  sub search { Line 178  sub search {
178    
179          my $template_filename = $args->{template} || $self->{template};          my $template_filename = $args->{template} || $self->{template};
180    
181          $args->{max} ||= $self->{'hits_on_page'};          $args->{max} ||= $self->{'hits_for_pager'};
182          if (! $args->{max}) {          if (! $args->{max}) {
183                  $args->{max} = 10;                  $args->{max} = 100;
184                  $log->warn("max not set when calling model. Using default of 10");                  $log->warn("max not set when calling model. Using default of $args->{max}");
185          }          }
186    
187          my $times;      # store some times for benchmarking          my $times;      # store some times for benchmarking
# Line 172  sub search { Line 195  sub search {
195                  $log->warn("using default search depth $default");                  $log->warn("using default search depth $default");
196          }          }
197    
198          my @results = $self->{est}->search( %{ $args } );          $log->debug("searching for maximum $args->{max} results using depth $args->{depth}");
199    
200            #
201            # construct condition for Hyper Estraier
202            #
203            my $cond = Search::Estraier::Condition->new();
204            if ( ref($args->{add_attr}) eq 'ARRAY' ) {
205                    $log->debug("adding search attributes: " . join(", ", @{ $args->{add_attr} }) );
206                    map {
207                            $cond->add_attr( _convert( $_ ) );
208                            $log->debug(" + $_");
209                    } @{ $args->{add_attr} };
210            };
211    
212            $cond->set_phrase( $query ) if ($query);
213            $cond->set_options( $args->{options} ) if ($args->{options});
214            $cond->set_order( $args->{order} ) if ($args->{order});
215    
216            my $max = $args->{max} || 7;
217            my $page = $args->{page} || 1;
218            if ($page < 1) {
219                    $log->warn("page number $page < 1");
220                    $page = 1;
221            }
222    
223          $times->{est} += time() - $t;          $times->{est} += time() - $t;
224    
225          my $hits = $#results + 1;          $cond->set_max( $page * $max );
226    
227          $log->debug( sprintf("search took %.2fs and returned $hits hits.", $times->{est}) );          my $result = $self->{est_node}->search($cond, ( $args->{depth} || 0 ));
228            my $hits = $result->doc_num;
229    
230          # just return results?          $log->debug( sprintf("search took %.6fs and returned $hits hits.", $times->{est}) );
         return @results unless ($args->{'template'});  
231    
232          #          #
233          # construct HTML results          # fetch results
234          #          #
235    
236          my @html_results;          my @results;
237    
238          for my $i ( 0 .. $#results ) {          for my $i ( (($page - 1) * $max) .. ( $hits - 1 ) ) {
239    
240                  my $mfn = $1 if ( $results[$i]->{'@uri'} =~ m#/(\d+)$#);                  $t = time();
241    
242                  #$log->debug("load_ds( $mfn )");                  #$log->debug("get_doc($i)");
243                    my $doc = $result->get_doc( $i );
244                    if (! $doc) {
245                            $log->warn("can't find result $i");
246                            next;
247                    }
248    
249                  $t = time();                  my $hash;
250    
251                  my $ds = $self->{db}->load_ds( $mfn ) || $log->error("can't load_ds( $mfn )") && next;                  foreach my $attr (@{ $args->{get_attr} }) {
252                            my $val = $doc->attr( $attr );
253                            #$log->debug("attr $attr = ", $val || 'undef');
254                            $hash->{$attr} = $val if (defined($val));
255                    }
256    
257                  $times->{db} += time() - $t;                  $times->{hash} += time() - $t;
258    
259                  #$log->debug( "ds = " . Dumper( \@html_results ) );                  next unless ($hash);
260    
261                  $t = time();                  if (! $args->{'template'}) {
262                            push @results, $hash;
263                    } else {
264                            my ($database, $prefix, $id);
265    
266                  my $html = $self->{out}->apply(                          if ( $hash->{'@uri'} =~ m!/([^/]+)/([^/]+)/(\d+)$!) {
267                          template => $template_filename,                                  ($database, $prefix,$id) = ($1,$2,$3);
268                          data => $ds,                          } else {
269                  );                                  $log->warn("can't decode database/prefix/id from " .  $hash->{'@uri'});
270                                    next;
271                            }
272    
273                  $times->{out} += time() - $t;                          #$log->debug("load_ds( id => $id, prefix => '$prefix' )");
274    
275                  $t = time();                          $t = time();
276    
277                            my $ds = $self->{db}->load_ds( database => $database, prefix => $prefix, id => $id );
278                            if (! $ds) {
279                                    $log->error("can't load_ds( ${database}/${prefix}/${id} )");
280                                    next;
281                            }
282    
283                            $times->{db} += time() - $t;
284    
285                            #$log->debug( "ds = " . Dumper( \@html_results ) );
286    
287                            $t = time();
288    
289                  $html = $self->{iconv}->convert( $html ) || $log->error("can't convert: $html");                          my $html = $self->apply(
290                                    template => $template_filename,
291                                    data => $ds,
292                                    record_uri => "${database}/${prefix}/${id}",
293                                    config => $self->{databases}->{$database},
294                            );
295    
296                  $times->{iconv} += time() - $t;                          $times->{apply} += time() - $t;
297    
298                  push @html_results, $html;                          $t = time();
299    
300                            $html = decode($self->{webpac_encoding}, $html);
301    
302                            $times->{decode} += time() - $t;
303    
304                            push @results, $html;
305                    }
306    
307          }          }
308    
309          #$log->debug( '@html_results = ' . Dumper( \@html_results ) );          $log->debug( '@results = ' . Dumper( \@results ) );
310    
311          $log->debug( sprintf(          $log->debug( sprintf(
312                  "time spent: db = %.2f, out = %.2f, iconv = %.2f",                  "duration breakdown: estraier %.6fs, hash %.6fs, store %.6fs, apply %.6fs, decode %.06f, total: %.6fs",
313                  $times->{db}, $times->{out}, $times->{iconv},                  $times->{est}, $times->{hash}, $times->{db}, $times->{apply}, $times->{decode}, time() - $search_start_t,
314          ) );          ) );
315    
316          return \@html_results;          return \@results;
317  }  }
318    
319  =head2 record  =head2 record
# Line 249  sub record { Line 333  sub record {
333    
334          my $args = {@_};          my $args = {@_};
335          my $log = $self->{log};          my $log = $self->{log};
336          $log->debug("args: " . Dumper( $args ));          $log->debug("record args: " . Dumper( $args ));
337    
338          foreach my $f (qw/mfn template/) {          foreach my $f (qw/record_uri template/) {
339                  $log->die("need $f") unless ($args->{$f});                  $log->fatal("need $f") unless ($args->{$f});
340          }          }
341    
342          my $mfn = $args->{mfn};          my ($database, $prefix, $id);
343    
344          my $ds = $self->{db}->load_ds( $mfn ) || $log->error("can't load_ds( $mfn )") && next;          if ($args->{record_uri} =~ m#^([^/]+)/([^/]+)/([^/]+)$#) {
345                    ($database, $prefix, $id) = ($1,$2,$3);
346            } else {
347                    $log->error("can't parse $args->{record_uri} into prefix, database and uri");
348                    return;
349            }
350    
351          my $html = $self->{out}->apply(          my $ds = $self->{db}->load_ds( id => $id, prefix => $prefix, database => $database );
352            if (! $ds) {
353                    $log->error("can't load_ds( $database/$prefix/$id )");
354                    return;
355            }
356    
357            my $html = $self->apply(
358                  template => $args->{template},                  template => $args->{template},
359                  data => $ds,                  data => $ds,
360                    record_uri => $args->{record_uri},
361                    config => $self->{databases}->{$database},
362          );          );
363    
364          $html = $self->{iconv}->convert( $html ) || $log->error("can't convert: $html");          $html = decode($self->{webpac_encoding}, $html);
365    
366          return $html;          return $html;
367  }  }
368    
369    
370  =head2 save_html  =head2 save_html
371    
372    $m->save_html( '/full/path/to/file', $content );    $m->save_html( '/full/path/to/file', $content );
373    
374  It will use C<Text::Iconv> to convert content encoding back to  It will use C<Encode> to convert content encoding back to
375  Webpac codepage, recode JavaScript Unicode entities (%u1234),  Webpac codepage, recode JavaScript Unicode entities (%u1234),
376  strip extra newlines at beginning and end, and save to  strip extra newlines at beginning and end, and save to
377  C</full/path/to/file.new> and if that succeeds, just rename  C</full/path/to/file.new> and if that succeeds, just rename
# Line 284  it over original file which should be at Line 382  it over original file which should be at
382  sub save_html {  sub save_html {
383          my ($self, $path, $content) = @_;          my ($self, $path, $content) = @_;
384    
385            # FIXME Should this be UTF-8 or someting?
386            my $js_encoding = $self->{webpac_encoding};
387            $js_encoding = 'UTF-16';
388    
389          sub _conv_js {          sub _conv_js {
390                  my $t = shift || return;                  return '0x' . $_[1];
391                  return $self->{iconv}->convert(chr(hex($t)));                  return encode($_[0], chr(hex($_[1])));
392          }          }
393          $content =~ s/%u([a-fA-F0-9]{4})/_conv_js($1)/gex;          #$content =~ s/%u([a-fA-F0-9]{4})/_conv_js($js_encoding,$1)/gex;
394          $content =~ s/^[\n\r]+//s;          $content =~ s/^[\n\r]+//s;
395          $content =~ s/[\n\r]+$/\n/s;          $content =~ s/[\n\r]+$/\n/s;
396            $content =~ s/\n\r/\n/gs;
397    
398          my ($from, $to) = (          my $disk_encoding = $self->{webpac_encoding} || 'utf-8';
399                  $self->{out_encoding},          $self->{log}->debug("convert encoding to $disk_encoding");
400                  $self->{webpac_encoding},          from_to($content, 'utf-8', $disk_encoding) || $self->{log}->warn("encoding from utf-8 to $disk_encoding failed for: $content");
         );  
   
         $self->{log}->debug("using iconv to convert from $from to $to encoding");  
   
         my $iconv_on_save = new Text::Iconv($from, $to)  
                 || $self->{log}->fatal("can't create iconv for saving");  
   
         $content = $iconv_on_save->convert( $content ) || die "no content?";  
401    
402          write_file($path . '.new', {binmode => ':raw' }, $content) || die "can't save ${path}.new $!";          write_file($path . '.new', {binmode => ':raw' }, $content) || die "can't save ${path}.new $!";
403          rename $path . '.new', $path || die "can't rename to $path: $!";          rename $path . '.new', $path || die "can't rename to $path: $!";
# Line 324  sub load_html { Line 419  sub load_html {
419          die "no path?" unless ($path);          die "no path?" unless ($path);
420    
421          my $content = read_file($path, {binmode => ':raw' }) || die "can't read $path: $!";          my $content = read_file($path, {binmode => ':raw' }) || die "can't read $path: $!";
         #$content = $q->escapeHTML($iconv_utf8->convert($content));  
         $content = $self->{iconv}->convert($content);  
422    
423          return $content;          return decode($self->{webpac_encoding}, $content);
424  }  }
425    
426    
427    =head2 apply
428    
429    Create output from in-memory data structure using Template Toolkit template.
430    
431     my $text = $tt->apply(
432            template => 'text.tt',
433            data => $ds,
434            record_uri => 'database/prefix/mfn',
435     );
436    
437    It also has follwing template toolikit filter routies defined:
438    
439    =cut
440    
441    sub apply {
442            my $self = shift;
443    
444            my $args = {@_};
445    
446            my $log = $self->{log} || die "no log?";
447    
448            foreach my $a (qw/template data/) {
449                    $log->fatal("need $a") unless ($args->{$a});
450            }
451    
452    =head3 tt_filter_type
453    
454    filter to return values of specified from $ds, usage from TT template is in form
455    C<d('FieldName','delimiter')>, where C<delimiter> is optional, like this:
456    
457      [% d('Title') %]
458      [% d('Author',', ' %]
459    
460    =cut
461    
462            sub tt_filter_type {
463                    my ($data,$type) = @_;
464                    
465                    die "no data?" unless ($data);
466                    $type ||= 'display';
467    
468                    my $default_delimiter = {
469                            'display' => '&#182;<br/>',
470                            'index' => '\n',
471                    };
472    
473                    return sub {
474    
475                            my ($name,$join) = @_;
476    
477                            die "no data hash" unless ($data->{'data'} && ref($data->{'data'}) eq 'HASH');
478                            # Hm? Should we die here?
479                            return unless ($name);
480    
481                            my $item = $data->{'data'}->{$name} || return;
482    
483                            my $v = $item->{$type} || return;
484    
485                            if (ref($v) eq 'ARRAY') {
486                                    if ($#{$v} == 0) {
487                                            $v = $v->[0];
488                                    } else {
489                                            $join = $default_delimiter->{$type} unless defined($join);
490                                            $v = join($join, @{$v});
491                                    }
492                            } else {
493                                    warn("TT filter $type(): field $name values aren't ARRAY, ignoring");
494                            }
495    
496                            return $v;
497                    }
498            }
499    
500            $args->{'d'} = tt_filter_type($args, 'display');
501            $args->{'display'} = tt_filter_type($args, 'display');
502    
503    =head3 tt_filter_search
504    
505    filter to return links to search, usage in TT:
506    
507      [% search('FieldToDisplay','FieldToSearch','optional delimiter', 'optional_template.tt') %]
508    
509    =cut
510    
511            sub tt_filter_search {
512    
513                    my ($data) = @_;
514    
515                    die "no data?" unless ($data);
516                    
517                    return sub {
518    
519                            my ($display,$search,$delimiter,$template) = @_;
520                            
521                            # default delimiter
522                            $delimiter ||= '&#182;<br/>',
523    
524                            die "no data hash" unless ($data->{'data'} && ref($data->{'data'}) eq 'HASH');
525                            # Hm? Should we die here?
526                            return unless ($display);
527    
528                            my $item = $data->{'data'}->{$display} || return;
529    
530                            return unless($item->{'display'});
531                            if (! $item->{'search'}) {
532                                    warn "error in TT template: field $display didn't insert anything into search, use d('$display') and not search('$display'...)";
533                                    return;
534                            }
535    
536                            my @warn;
537                            foreach my $type (qw/display search/) {
538                                    push @warn, "field $display type $type values aren't ARRAY" unless (ref($item->{$type}) eq 'ARRAY');
539                            }
540    
541                            if (@warn) {
542                                    warn("TT filter search(): " . join(",", @warn) . ", skipping");
543                                    return;
544                            }
545                            my @html;
546    
547                            my $d_el = $#{ $item->{'display'} };
548                            my $s_el = $#{ $item->{'search'} };
549    
550                            # easy, both fields have same number of elements or there is just
551                            # one search and multiple display
552                            if ( $d_el == $s_el || $s_el == 0 ) {
553    
554                                    foreach my $i ( 0 .. $d_el ) {
555    
556                                            my $s;
557                                            if ($s_el > 0) {
558                                                    $s = $item->{'search'}->[$i] || die "can't find value $i for type search in field $search";
559                                            } else {
560                                                    $s = $item->{'search'}->[0];
561                                            }
562                                            #$s =~ s/([^\w.-])/sprintf("%%%02X",ord($1))/eg;
563                                            $s = __quotemeta( $s );
564    
565                                            my $d = $item->{'display'}->[$i] || die "can't find value $i for type display in field $display";
566    
567                                            my $template_arg = '';
568                                            $template_arg = qq{,'$template'} if ($template);
569    
570                                            push @html, qq{<a href="#" onclick="return search_via_link('$search','$s'${template_arg})">$d</a>};
571                                    }
572    
573                                    return join($delimiter, @html);
574                            } else {
575                                    my $html = qq{<div class="notice">WARNING: we should really support if there is $d_el display elements and $s_el search elements, but currently there is no nice way to do so, so we will just display values</div>};
576                                    my $v = $item->{'display'};
577    
578                                    if ($#{$v} == 0) {
579                                            $html .= $v->[0];
580                                    } else {
581                                            $html .= join($delimiter, @{$v});
582                                    }
583                                    return $html;
584                            }
585                    }
586            }
587    
588            $args->{'search'} = tt_filter_search($args);
589    
590    =head3 load_rec
591    
592    Used mostly for onClick events like this:
593    
594      <a href="#" onClick="[% load_rec( record_uri, 'template_name.tt') %]>foo</a>
595    
596    It will automatically do sanity checking and create correct JavaScript code.
597    
598    =cut
599    
600            $args->{'load_rec'} = sub {
601                    my @errors;
602    
603                    my $record_uri = shift or push @errors, "record_uri missing";
604                    my $template = shift or push @errors, "template missing";
605    
606                    if ($record_uri !~ m#^[^/]+/[^/]+/[^/]+$#) {
607                            push @errors, "invalid format of record_uri: $record_uri";
608                    }
609    
610                    if (@errors) {
611                            return "Logger.error('errors in load_rec: " . join(", ", @errors) . "'); return false;";
612                    } else {
613                            return "load_rec('$record_uri','$template'); return false;";
614                    }
615            };
616    
617    =head3 load_template
618    
619    Used to re-submit search request and load results in different template
620    
621      <a href="#" onClick="[% load_template( 'template_name.tt' ) %]">bar</a>
622    
623    =cut
624    
625            $args->{'load_template'} = sub {
626                    my $template = shift or return "Logger.error('load_template missing template name!'); return false;";
627                    return "load_template($template); return false;";
628            };
629    
630            my $out;
631    
632            $self->{'tt'}->process(
633                    $args->{'template'},
634                    $args,
635                    \$out
636            ) || $log->error( "apply can't process template: ", $self->{'tt'}->error() );
637    
638            return $out;
639    }
640    
641    
642    =head2 __quotemeta
643    
644    Helper to quote JavaScript-friendly characters
645    
646    =cut
647    
648    sub __quotemeta {
649            local $_ = shift;
650            $_ = decode('iso-8859-2', $_);
651    
652            s<([\x{0080}-\x{fffd}]+)>{sprintf '\u%0*v4X', '\u', $1}ge if ( Encode::is_utf8($_) );
653            {
654                    use bytes;  
655                    s<((?:[^ \x21-\x7E]|(?:\\(?!u)))+)>{sprintf '\x%0*v2X', '\x', $1}ge;
656            }
657    
658            s/\\x09/\\t/g;
659            s/\\x0A/\\n/g;
660            s/\\x0D/\\r/g;
661            s/"/\\"/g;
662            s/\\x5C/\\\\/g;
663    
664            return $_;
665    }
666    
667    
668    
669  =head1 AUTHOR  =head1 AUTHOR
670    
671  Dobrica Pavlinusic  Dobrica Pavlinusic C<< <dpavlin@rot13.org> >>
672    
673  =head1 LICENSE  =head1 LICENSE
674    

Legend:
Removed from v.222  
changed lines
  Added in v.382

  ViewVC Help
Powered by ViewVC 1.1.26