source: main/tags/2.60/gsdl/perllib/mgppbuildproc.pm@ 32313

Last change on this file since 32313 was 9669, checked in by kjdon, 19 years ago

fixed up the case where you have subcollection partitions and language partitions - was doing an OR on both, but really needed an OR for partitions ANDed with an OR for langs

  • Property svn:keywords set to Author Date Id Revision
File size: 20.5 KB
Line 
1###########################################################################
2#
3# mgppbuildproc.pm --
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26# This document processor outputs a document
27# for mgpp to process
28
29
30package mgppbuildproc;
31
32eval {require bytes};
33
34use classify;
35use doc;
36use docproc;
37use util;
38
39
40BEGIN {
41 @mgppbuildproc::ISA = ('docproc');
42}
43
44#this must be the same as in mgppbuilder
45our %level_map = ('document'=>'Doc',
46 'section'=>'Sec',
47 'paragraph'=>'Para');
48
49sub new {
50 my ($class, $collection, $source_dir, $build_dir,
51 $verbosity, $outhandle) = @_;
52 my $self = new docproc ();
53
54 # outhandle is where all the debugging info goes
55 # output_handle is where the output of the plugins is piped
56 # to (i.e. mg, gdbm etc.)
57 $outhandle = STDERR unless defined $outhandle;
58
59 $self->{'collection'} = $collection;
60 $self->{'source_dir'} = $source_dir;
61 $self->{'build_dir'} = $build_dir;
62 $self->{'verbosity'} = $verbosity;
63 $self->{'classifiers'} = [];
64 $self->{'mode'} = "text";
65 $self->{'assocdir'} = $build_dir;
66 $self->{'dontgdbm'} = {};
67 $self->{'index'} = "text";
68 $self->{'indexexparr'} = [];
69 $self->{'output_handle'} = "STDOUT";
70 $self->{'num_docs'} = 0;
71 $self->{'num_sections'} = 0;
72 $self->{'num_bytes'} = 0;
73 $self->{'num_processed_bytes'} = 0;
74 $self->{'store_text'} = 1;
75 $self->{'outhandle'} = $outhandle;
76
77 #used by browse interface
78 $self->{'doclist'} = [];
79
80 $self->{'indexing_text'} = 0;
81
82 #new ones for mgpp
83 $self->{'dontindex'} = {};
84 $self->{'indexfieldmap'} = {};
85 $self->{'indexfields'} = {}; # only put in the ones that are not specified directly in the index
86 $self->{'strip_html'}=1;
87
88
89 return bless $self, $class;
90}
91
92sub reset {
93 my $self = shift (@_);
94
95 $self->{'num_docs'} = 0;
96 $self->{'num_sections'} = 0;
97 $self->{'num_processed_bytes'} = 0;
98 $self->{'num_bytes'} = 0;
99}
100
101sub get_num_docs {
102 my $self = shift (@_);
103
104 return $self->{'num_docs'};
105}
106
107sub get_num_sections {
108 my $self = shift (@_);
109
110 return $self->{'num_sections'};
111}
112
113# num_bytes is the actual number of bytes in the collection
114# this is normally the same as what's processed during text compression
115sub get_num_bytes {
116 my $self = shift (@_);
117
118 return $self->{'num_bytes'};
119}
120
121# num_processed_bytes is the number of bytes actually passed
122# to mgpp for the current index
123sub get_num_processed_bytes {
124 my $self = shift (@_);
125
126 return $self->{'num_processed_bytes'};
127}
128
129sub set_output_handle {
130 my $self = shift (@_);
131 my ($handle) = @_;
132
133 $self->{'output_handle'} = $handle;
134}
135
136sub set_mode {
137 my $self = shift (@_);
138 my ($mode) = @_;
139
140 $self->{'mode'} = $mode;
141}
142
143sub set_assocdir {
144 my $self = shift (@_);
145 my ($assocdir) = @_;
146
147 $self->{'assocdir'} = $assocdir;
148}
149
150sub set_dontgdbm {
151 my $self = shift (@_);
152 my ($dontgdbm) = @_;
153
154 $self->{'dontgdbm'} = $dontgdbm;
155}
156
157sub set_index {
158 my $self = shift (@_);
159 my ($index, $indexexparr) = @_;
160
161 $self->{'index'} = $index;
162 $self->{'indexexparr'} = $indexexparr if defined $indexexparr;
163}
164
165sub set_index_languages {
166 my $self = shift (@_);
167 my ($lang_meta, $langarr) = @_;
168 $self->{'lang_meta'} = $lang_meta;
169 $self->{'langarr'} = $langarr;
170}
171
172sub get_index {
173 my $self = shift (@_);
174
175 return $self->{'index'};
176}
177
178sub set_classifiers {
179 my $self = shift (@_);
180 my ($classifiers) = @_;
181
182 $self->{'classifiers'} = $classifiers;
183}
184
185sub set_indexing_text {
186 my $self = shift (@_);
187 my ($indexing_text) = @_;
188
189 $self->{'indexing_text'} = $indexing_text;
190}
191
192sub get_indexing_text {
193 my $self = shift (@_);
194
195 return $self->{'indexing_text'};
196}
197
198sub set_store_text {
199 my $self = shift (@_);
200 my ($store_text) = @_;
201
202 $self->{'store_text'} = $store_text;
203}
204
205sub get_doc_list {
206 my $self = shift(@_);
207
208 return @{$self->{'doclist'}};
209}
210
211sub set_indexfieldmap {
212 my $self = shift (@_);
213 my ($indexmap) = @_;
214
215 $self->{'indexfieldmap'} = $indexmap;
216}
217
218sub get_indexfieldmap {
219 my $self = shift (@_);
220
221 return $self->{'indexfieldmap'};
222}
223
224sub set_levels {
225 my $self = shift (@_);
226 my ($levels) = @_;
227
228 $self->{'levels'} = $levels;
229}
230
231sub set_strip_html {
232 my $self = shift (@_);
233 my ($strip) = @_;
234 $self->{'strip_html'}=$strip;
235}
236
237sub process {
238 my $self = shift (@_);
239 my $method = $self->{'mode'};
240
241 $self->$method(@_);
242}
243
244# use 'Paged' if document has no more than 2 levels
245# and each section at second level has a number for
246# Title metadata
247# also use Paged if gsdlthistype metadata is set to Paged
248sub get_document_type {
249 my $self = shift (@_);
250 my ($doc_obj) = @_;
251
252 my $thistype = "VList";
253 my $childtype = "VList";
254 my $title;
255 my @tmp = ();
256
257 my $section = $doc_obj->get_top_section ();
258
259 my $gsdlthistype = $doc_obj->get_metadata_element ($section, "gsdlthistype");
260 if (defined $gsdlthistype) {
261 if ($gsdlthistype eq "Paged") {
262 $childtype = "Paged";
263 if ($doc_obj->get_text_length ($doc_obj->get_top_section())) {
264 $thistype = "Paged";
265 } else {
266 $thistype = "Invisible";
267 }
268
269 return ($thistype, $childtype);
270 } elsif ($gsdlthistype eq "Hierarchy") {
271 return ($thistype, $childtype); # use VList, VList
272 }
273 }
274 my $first = 1;
275 while (defined $section) {
276 @tmp = split /\./, $section;
277 if (scalar(@tmp) > 1) {
278 return ($thistype, $childtype);
279 }
280 if (!$first) {
281 $title = $doc_obj->get_metadata_element ($section, "Title");
282 if (!defined $title || $title !~ /^\d+$/) {
283 return ($thistype, $childtype);
284 }
285 }
286 $first = 0;
287 $section = $doc_obj->get_next_section($section);
288 }
289 if ($doc_obj->get_text_length ($doc_obj->get_top_section())) {
290 $thistype = "Paged";
291 } else {
292 $thistype = "Invisible";
293 }
294 $childtype = "Paged";
295 return ($thistype, $childtype);
296}
297
298sub assoc_files {
299 my $self = shift (@_);
300 my ($doc_obj, $archivedir) = @_;
301 my ($afile);
302
303 foreach my $assoc_file (@{$doc_obj->get_assoc_files()}) {
304 # if assoc file starts with a slash, we put it relative to the assoc
305 # dir, otherwise it is relative to the HASH... directory
306 if ($assoc_file->[1] =~ m@^[/\\]@) {
307 $afile = &util::filename_cat($self->{'assocdir'},$assoc_file->[1]);
308 } else {
309 $afile = &util::filename_cat($self->{'assocdir'}, $archivedir, $assoc_file->[1]);
310 }
311 &util::hard_link ($assoc_file->[0], $afile);
312 }
313}
314
315sub infodb {
316 my $self = shift (@_);
317 my ($doc_obj, $filename) = @_;
318 my $handle = $self->{'output_handle'};
319
320 my $doctype = $doc_obj->get_doc_type();
321
322 # only output this document if it is one to be indexed
323 return if ($doctype ne "indexed_doc");
324
325 #if a Section level index is not built, the gdbm file should be at doc
326 #level not Section
327 my $docs_only = 1;
328 if ($self->{'levels'}->{'section'}) {
329 $docs_only = 0;
330 }
331
332 my ($archivedir) = $filename =~ /^(.*?)(?:\/|\\)[^\/\\]*$/;
333 $archivedir = "" unless defined $archivedir;
334 $archivedir =~ s/\\/\//g;
335 $archivedir =~ s/^\/+//;
336 $archivedir =~ s/\/+$//;
337
338 # resolve the final filenames of the files associated with this document
339 $self->assoc_files ($doc_obj, $archivedir);
340
341 #GRB: moved 1/06/2004 from GRB01062004
342 #add this document to the browse structure
343 push(@{$self->{'doclist'}},$doc_obj->get_OID())
344 unless ($doctype eq "classification");
345
346 # classify this document
347 &classify::classify_doc ($self->{'classifiers'}, $doc_obj);
348 #GRB: end of moved block
349
350 # this is another document
351 $self->{'num_docs'} += 1 unless ($doctype eq "classification");
352
353 # is this a paged or a hierarchical document
354 my ($thistype, $childtype) = $self->get_document_type ($doc_obj);
355
356 my $section = $doc_obj->get_top_section ();
357 my $doc_OID = $doc_obj->get_OID();
358 my $first = 1;
359 my $url = "";
360 while (defined $section) {
361 # update a few statistics
362 $self->{'num_bytes'} += $doc_obj->get_text_length ($section);
363 $self->{'num_sections'} += 1 unless ($doctype eq "classification");
364
365 # output the section name
366 if ($section eq "") { print $handle "[$doc_OID]\n"; }
367 else { print $handle "[$doc_OID.$section]\n"; }
368
369 # output the fact that this document is a document (unless doctype
370 # has been set to something else from within a plugin
371 my $dtype = $doc_obj->get_metadata_element ($section, "doctype");
372 if (!defined $dtype || $dtype !~ /\w/) {
373 print $handle "<doctype>doc\n";
374 }
375
376 # output whether this node contains text
377 if ($doc_obj->get_text_length($section) > 0) {
378 print $handle "<hastxt>1\n";
379 } else {
380 print $handle "<hastxt>0\n";
381 }
382
383 # output all the section metadata
384 my $metadata = $doc_obj->get_all_metadata ($section);
385 foreach my $pair (@$metadata) {
386 my ($field, $value) = (@$pair);
387
388 if ($field ne "Identifier" && $field !~ /^gsdl/ &&
389 defined $value && $value ne "") {
390
391 # escape problematic stuff
392 $value =~ s/\\/\\\\/g;
393 $value =~ s/\n/\\n/g;
394 $value =~ s/\r/\\r/g;
395
396 # special case for URL metadata
397 if ($field =~ /^URL$/i) {
398 $url .= "[$value]\n";
399 if ($section eq "") {$url .= "<section>$doc_OID\n";}
400 else {$url .= "<section>$doc_OID.$section\n";}
401 $url .= '-' x 70 . "\n";
402 }
403
404 if (!defined $self->{'dontgdbm'}->{$field}) {
405 print $handle "<$field>$value\n";
406 }
407 }
408 }
409
410 # output archivedir if at top level
411 if ($section eq $doc_obj->get_top_section()) {
412 print $handle "<archivedir>$archivedir\n";
413 }
414
415 # output document display type
416 if ($first) {
417 print $handle "<thistype>$thistype\n";
418 }
419
420 if (!$docs_only) {
421 # output a list of children
422 my $children = $doc_obj->get_children ($section);
423 if (scalar(@$children) > 0) {
424 print $handle "<childtype>$childtype\n";
425 print $handle "<contains>";
426 my $firstchild = 1;
427 foreach my $child (@$children) {
428 print $handle ";" unless $firstchild;
429 $firstchild = 0;
430 if ($child =~ /^.*?\.(\d+)$/) {
431 print $handle "\".$1";
432 } else {
433 print $handle "\".$child";
434 }
435# if ($child eq "") { print $handle "$doc_OID"; }
436# elsif ($section eq "") { print $handle "$doc_OID.$child"; }
437# else { print $handle "$doc_OID.$section.$child"; }
438 }
439 print $handle "\n";
440 }
441 #output the matching doc number
442 print $handle "<docnum>$self->{'num_sections'}\n";
443
444 } # if (!$docs_only)
445 else { #docs only, doc num is num_docs not num_sections
446 # output the matching document number
447 print $handle "<docnum>$self->{'num_docs'}\n";
448 }
449
450 print $handle '-' x 70, "\n";
451
452
453 # output a database entry for the document number
454 if ($docs_only) {
455 print $handle "[$self->{'num_docs'}]\n";
456 print $handle "<section>$doc_OID\n";
457 }
458 else {
459 print $handle "[$self->{'num_sections'}]\n";
460 if ($section eq "") { print $handle "<section>$doc_OID\n"; }
461 else { print $handle "<section>$doc_OID.$section\n"; }
462 }
463 print $handle '-' x 70, "\n";
464
465 # output entry for url
466 if ($url ne "") {
467 print $handle $url;
468 }
469
470 $first = 0;
471 $section = $doc_obj->get_next_section($section);
472 last if ($docs_only); # if no sections wanted, only gdbm the docs
473 }
474
475 #GRB01062004: see code above moved from here
476}
477
478#sub find_paragraphs {
479# $_[1] =~ s/(<p\b)/<Paragraph>$1/gi;
480#}
481
482#this function strips the html tags from the doc if ($strip_html) and
483# if ($para) replaces <p> with <Paragraph> tags.
484# if both are false, the original text is returned
485#assumes that <pre> and </pre> have no spaces, and removes all < and > inside
486#these tags
487sub preprocess_text {
488 my $self = shift (@_);
489 my ($text, $strip_html, $para) = @_;
490 my ($outtext) = "";
491 if ($strip_html) {
492 while ($text =~ /<([^>]*)>/ && $text ne "") {
493
494 my $tag = $1;
495 $outtext .= $`." "; #add everything before the matched tag
496 $text = $'; #'everything after the matched tag
497 if ($para && $tag =~ /^\s*p\s/i) {
498 $outtext .= $para;
499 }
500 elsif ($tag =~ /^pre$/) { # a pre tag
501 $text =~ /<\/pre>/; # find the closing pre tag
502 my $tmp_text = $`; #everything before the closing pre tag
503 $text = $'; #'everything after the </pre>
504 $tmp_text =~ s/[<>]//g; # remove all < and >
505 $outtext.= $tmp_text . " ";
506 }
507 }
508
509 $outtext .= $text; # add any remaining text
510 return $outtext;
511 } #if strip_html
512
513 #if ($para) {
514 #$text =~ s/(<p\b)/$para$1/gi;
515 #return $text;
516 # }
517 return $text;
518}
519
520
521
522sub filter_text {
523 # $self->filter_text ($field, $new_text);
524 # don't want to do anything for this version, however,
525 # in a particular collection you might want to override
526 # this method to post-process certain fields depending on
527 # the field, or whether we are outputting it for indexing
528}
529
530sub text {
531 my $self = shift (@_);
532 my ($doc_obj) = @_;
533 my $handle = $self->{'output_handle'};
534 my $outhandle = $self->{'outhandle'};
535 my $indexed_doc = 1;
536
537 # only output this document if it is one to be indexed
538 return if ($doc_obj->get_doc_type() ne "indexed_doc");
539
540 # see if this document belongs to this subcollection
541 foreach my $indexexp (@{$self->{'indexexparr'}}) {
542 $indexed_doc = 0;
543 my ($field, $exp, $options) = split /\//, $indexexp;
544 if (defined ($field) && defined ($exp)) {
545 my ($bool) = $field =~ /^(.)/;
546 $field =~ s/^.// if $bool eq '!';
547 if ($field =~ /^filename$/i) {
548 $field = $doc_obj->get_source_filename();
549 } else {
550 $field = $doc_obj->get_metadata_element($doc_obj->get_top_section(), $field);
551 }
552 next unless defined $field;
553 if ($bool eq '!') {
554 if ($options =~ /^i$/i) {
555 if ($field !~ /$exp/i) {$indexed_doc = 1; last;}
556 } else {
557 if ($field !~ /$exp/) {$indexed_doc = 1; last;}
558 }
559 } else {
560 if ($options =~ /^i$/i) {
561 if ($field =~ /$exp/i) {$indexed_doc = 1; last;}
562 } else {
563 if ($field =~ /$exp/) {$indexed_doc = 1; last;}
564 }
565 }
566 }
567 }
568
569 # if this doc is so far in the sub collection, and we have lang info,
570 # now we check the languages to see if it matches
571 if($indexed_doc && defined $self->{'lang_meta'}) {
572 $indexed_doc = 0;
573 my $field = $doc_obj->get_metadata_element($doc_obj->get_top_section(), $self->{'lang_meta'});
574 if (defined $field) {
575 foreach my $lang (@{$self->{'langarr'}}) {
576 my ($bool) = $lang =~ /^(.)/;
577 if ($bool eq '!') {
578 $lang =~ s/^.//;
579 if ($field !~ /$lang/) {
580 $indexed_doc = 1; last;
581 }
582 } else {
583 if ($field =~ /$lang/) {
584 $indexed_doc = 1; last;
585 }
586 }
587 }
588 }
589 }
590
591 # this is another document
592 $self->{'num_docs'} += 1;
593
594 # get the parameters for the output
595 # split on : just in case there is subcoll and lang stuff
596 my ($fields) = split (/:/, $self->{'index'});
597
598 my ($documenttag) = "";
599 my($documentendtag) = "";
600 if ($self->{'levels'}->{'document'}) {
601 $documenttag = "\n<". $level_map{'document'} . ">\n";
602 $documentendtag = "\n</". $level_map{'document'} . ">\n";
603 }
604 my ($sectiontag) = "";
605 if ($self->{'levels'}->{'section'}) {
606 $sectiontag = "\n<". $level_map{'section'} . ">\n";
607 }
608 my ($paratag) = "";
609
610 if ($self->{'levels'}->{'paragraph'}) {
611 if ($self->{'strip_html'}) {
612 $paratag = "<". $level_map{'paragraph'} . ">";
613 } else {
614 print $outhandle "Paragraph level can not be used with no_strip_html!. Not indexing Paragraphs.\n";
615 }
616 }
617
618 my $doc_section = 0; # just for this document
619
620 my $text = $documenttag;
621
622 # get the text for this document
623 my $section = $doc_obj->get_top_section();
624 while (defined $section) {
625 # update a few statistics
626 $doc_section++;
627 $self->{'num_sections'} += 1;
628 $text .= "$sectiontag";
629
630 if ($indexed_doc) {
631 if ($self->{'indexing_text'}) {
632 $text .= "$paratag"; # only add para tags for indexing
633 # note that we assume that metadata will not be asked for for the compressed text, so we add para tags without checking for indexing_text
634 }
635 $self->{'num_bytes'} += $doc_obj->get_text_length ($section);
636 foreach my $field (split (/,/, $fields)) {
637 # only deal with this field if it doesn't start with top or
638 # this is the first section
639 my $real_field = $field;
640 if (!($real_field =~ s/^top//) || ($doc_section == 1)) {
641 my $new_text = "";
642 my $tmp_text = "";
643 if ($real_field eq "text") {
644 if ($self->{'indexing_text'}) { #tag the text with <Text>...</Text>, add the <Paragraph> tags and strip out html if needed
645 $new_text .= "$paratag<TX>\n";
646 $tmp_text .= $doc_obj->get_text ($section);
647 $tmp_text = $self->preprocess_text($tmp_text, $self->{'strip_html'}, "</TX>$paratag<TX>");
648
649 $new_text .= "$tmp_text</TX>\n";
650 #if (!defined $self->{'indexfields'}->{'TextOnly'}) {
651 #$self->{'indexfields'}->{'TextOnly'} = 1;
652 #}
653 }
654 else { # leave html stuff in, and dont add Paragraph tags - never retrieve paras at the moment
655 $new_text .= $doc_obj->get_text ($section) if $self->{'store_text'};
656 }
657 } else { # metadata field
658 if ($real_field eq "allfields") { #ignore
659 }
660 elsif ($real_field eq "metadata") { # insert all metadata
661 #except gsdl stuff
662 my $shortname = "";
663 my $metadata = $doc_obj->get_all_metadata ($section);
664 foreach my $pair (@$metadata) {
665 my ($mfield, $mvalue) = (@$pair);
666 # check fields here, maybe others dont want - change to use dontindex!!
667 if ($mfield ne "Identifier"
668 && $mfield !~ /^gsdl/
669 && $mfield ne "classifytype"
670 && $mfield ne "assocfilepath"
671 && defined $mvalue && $mvalue ne "") {
672
673 if (defined $self->{'indexfieldmap'}->{$mfield}) {
674 $shortname = $self->{'indexfieldmap'}->{$mfield};
675 }
676 else {
677 $shortname = $self->create_shortname($mfield);
678 $self->{'indexfieldmap'}->{$mfield} = $shortname;
679 $self->{'indexfieldmap'}->{$shortname} = 1;
680 }
681 $new_text .= "$paratag<$shortname>$mvalue</$shortname>\n";
682 if (!defined $self->{'indexfields'}->{$mfield}) {
683 $self->{'indexfields'}->{$mfield} = 1;
684 }
685 }
686 }
687
688 }
689 else { #individual metadata specified
690 my $shortname="";
691 #if (!defined $self->{'indexfields'}->{$real_field}) {
692 #$self->{'indexfields'}->{$real_field} = 1;
693 #}
694 if (defined $self->{'indexfieldmap'}->{$real_field}) {
695 $shortname = $self->{'indexfieldmap'}->{$real_field};
696 }
697 else {
698 $shortname = $self->create_shortname($real_field);
699 $self->{'indexfieldmap'}->{$real_field} = $shortname;
700 $self->{'indexfieldmap'}->{$shortname} = 1;
701 }
702 foreach my $item (@{$doc_obj->get_metadata ($section, $real_field)}) {
703 $new_text .= "$paratag<$shortname>$item</$shortname>\n";
704 }
705 }
706
707 }
708
709 # filter the text
710 $self->filter_text ($field, $new_text);
711
712 $self->{'num_processed_bytes'} += length ($new_text);
713 $text .= "$new_text";
714 }
715 }
716 } # if (indexed_doc)
717
718 $section = $doc_obj->get_next_section($section);
719 } #while defined section
720 print $handle "$text\n$documentendtag";
721
722}
723
724#chooses the first two letters or digits for the shortname
725#now ignores non-letdig characters
726sub create_shortname {
727 my $self = shift(@_);
728
729 my ($realname) = @_;
730 #take the first two chars
731 my $shortname;
732 if ($realname =~ /^[^\w]*(\w)[^\w]*(\w)/) {
733 $shortname = "$1$2";
734 } else {
735 # there aren't two letdig's in the field - try arbitrary combinations
736 $realname = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
737 $shortname = "AB";
738 }
739 $shortname =~ tr/a-z/A-Z/;
740
741 #if already used, take the first and third letdigs and so on
742 my $count = 1;
743 while (defined $self->{'indexfieldmap'}->{$shortname}) {
744 if ($realname =~ /^[^\w]*(\w)([^\w]*\w){$count}[^\w]*(\w)/) {
745 $shortname = "$1$3";
746 $count++;
747 $shortname =~ tr/a-z/A-Z/;
748
749 }
750 else {
751 #remove up to and incl the first letdig
752 $realname =~ s/^[^\w]*\w//;
753 $count = 0;
754 }
755 }
756
757 return $shortname;
758}
759
7601;
761
Note: See TracBrowser for help on using the repository browser.