The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

ROADS::PreferredURL - A class to extract the URL we prefer most

SYNOPSIS

  use ROADS::PreferredURL;
  # %TEMPLATE is a hash array we read in earlier...
  $like_this_best = preferredURL(%TEMPLATE);

DESCRIPTION

This class defines a mechanism for examining the URLs contained in a template (loaded into a hash array which is keyed on attribute name), and returned the most desirable one.

METHODS

$preferredURL = preferredURL(%HASH_ARRAY);

This method examines the template attributes encoded in HASH_ARRAY (keys are attribute names, values are attributes' values from template), and discards all those which aren't URIs or URLs. It sorts the values of the remaining attributes according to a simple scheme whereby :-

  http is preferred over
    gopher is preferred over
      ftp is preferred over
        telnet is preferred over
          wais is preferred over
            mailto

The preferred URL is then returned as a string.

SEE ALSO

"addsl.pl" in bin, "addwn.pl" in bin, "cullsl.pl" in bin

COPYRIGHT

Copyright (c) 1988, Martin Hamilton <martinh@gnu.org> and Jon Knight <jon@net.lut.ac.uk>. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

It was developed by the Department of Computer Studies at Loughborough University of Technology, as part of the ROADS project. ROADS is funded under the UK Electronic Libraries Programme (eLib), the European Commission Telematics for Research Programme, and the TERENA development programme.

AUTHOR

Jon Knight <jon@net.lut.ac.uk>