#!/usr/bin/perl # This program will take a particular kind of review file listing # from an Innopac and generate an HTML file # This file uses a User Defined Output for the records which are exported. # It is important to use ^ as the divider and ~ for use between multiple fields. # The fields that this script will recognize and output to HTML are: # Record # (this provides the link to the record in teh catalog) # c -- call number # a -- author # t -- title # p -- imprint # d -- subject # !856 -- url # You will need to configure the script to create links for # your catalog. This is pretty easy--all you need to do is # edit the line in the section which looks like: # "$cnum
"; # just change the url to your catalog, http://lis.wwu.edu/ would # change to the main url for your Innopac. Be sure to leave # the record=$rnum\ the same. # If you wish you can adjust what appears at the top and bottom of the # HTML file that is generated by adding HTML code to the # INSERT HEADER and INSERT FOOTER # THIS PART OF THE PROGRAM OPENS THE FILE AND STRIPS OUT DIACRITICS # Get name of file to convert and name of output file print "Enter the name of the file you wish to convert: "; chop ($file = ); print "\n"; print "Enter the name of the html file you wish to output: "; chop ($htmlfile = ); print "\n"; $outfile = 'TeMp'; # Name the temporary output file $i = 0; open(IN, $file) || die "Sorry, can't open $file. Check the name and try this again."; open(OUT, ">$outfile") || die "Sorry, can't write $outfile"; # REMOVE HEADER while ($line = ) { $_ = $line; if (/RECORD*/) { last } } # STRIP DIACRITICS while ($line = ) # Read it into an array { $_ = $line; $line =~ s/{...}//g; print OUT $line } close(IN); # Close the input file close (OUT); # Close the output file # Do this and you should be ready to go. # OPEN THE REVIEW FILE FOR READING open (IN, $outfile) || die "sorry i couldn't open it."; # OPEN THE OUTPUT HTML FILE # You can adjust this filename so that it outputs the file # to a particular directory for publishing to your web site open (OUT,">$htmlfile") || die "I am not able to write to $htmlfile"; # GET MONTH INFORMATION FROM USER print "Enter the month and year you would like to use for the html file: "; chop ($month = ); print "\n"; print "Enter the title of the page you want to create: "; chop ($title = ); #INSERT HEADER #YOU CAN CHANGE ANY OF THE HTML CODE TO SUIT YOUR LIBRARY #Any HTML code that you type in between < $title

$title at


$month

Back to New Materials page
Back to Library Catalog



EOM #INSERT BIBLIOGRAPHIC INFORMATION # LOOK AT EACH LINE OF THE REVIEW FILE while ($line = ) { $_ = $line ; @line=split(/\^/,$line); $rnum = @line[0];chop ($rnum); $cnum = @line[1]; $title = "@line[2]"; $author = @line[3]; $pubinfo = @line[4]; $url = @line[6]; $subj = @line[5]; # PRINT OUT CALL NUMBER AND LINK TO RECORD IN THE OPAC. # CHANGE "http://lis.wwu.edu" TO THE URL OF YOUR OWN OPAC. print OUT "$cnum
"; foreach $item ($title, $author, $pubinfo, $subj) { if ($item ne undef) { if ($item =~ /~/) { &division($item) } else { print OUT "$item
"; } } } if ($url ne undef) { print OUT "$url
" } print OUT "

"; } sub division { { @item = split(/~/,$item); foreach $i (@item) { print OUT "$i
"; } } } # INSERT FOOTER # anything that you add between the EOM; and EOM will appear # at the bottom of the HTML file that is created print OUT <



Back to New Materials page
Back to Library Catalog

| WWU Home | Western Libraries |

EOM # FINISHED