TEXT 4
HTML.pm Guest on 21st November 2020 12:24:46 AM
  1. #
  2. # $Id: HTML.pm 617 2005-03-16 18:50:20Z barrickw $
  3. #
  4. #Library of functions to assist with common HTML tasks
  5. #
  6. #VTLS::Install::HTML
  7. package HTML;
  8.  
  9. use strict;
  10.  
  11. #Diacritic support
  12. use bytes;
  13.  
  14. use lib '../..';
  15.  
  16. use VTLS::Install::InstallUtil;
  17.  
  18.  
  19. BEGIN {
  20.   use Exporter ();
  21.   our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
  22.  
  23.   # set the version for version checking (product / package version, not the
  24.   #    CVS version)
  25.   $VERSION= 1.00;
  26.  
  27.   @ISA = qw(Exporter);
  28.   @EXPORT = qw(getSubmitButton getOption);
  29.   %EXPORT_TAGS = ( );
  30.  
  31.   #exported package globals and optionally exported function are here
  32.   @EXPORT_OK = (  );
  33.   }
  34. our @EXPORT_OK;
  35.  
  36.  
  37. #define exported package globals here
  38.  
  39.  
  40. #define non-exported package globals here
  41.  
  42.  
  43.  
  44. #initialize package variables here
  45.  
  46.  
  47. #prototype methods here
  48.  
  49.  
  50. #Create HTML for a submit button using the first paramter as the text
  51. #
  52. #Usage: print getSubmitButton($label);
  53. #
  54. sub getSubmitButton ($) ;
  55.  
  56.  
  57. #Creates a single HTML drop-down selection value displaying the first parameter
  58. #  and using the second parameter as the value, if the third parameter is
  59. #  present and true, the option will be set as selected.
  60. #Note: Only One option per drop-down should be set as selected!
  61. #
  62. #Usage: print getOption($value, $label);
  63. #
  64. sub getOption ($$;$) ;
  65.  
  66.  
  67.  
  68. #------------------------------------------------------------------------------
  69. #  Private subroutines
  70.  
  71.  
  72. END { }
  73.  
  74. #------------------------------------------------------------------------------
  75. #  Public subroutines
  76. #------------------------------------------------------------------------------
  77. sub getSubmitButton ($)
  78.   {
  79.   my $label = shift;
  80.  
  81.   my $html = '<input type="submit" value="' . $label . '" ></input>';
  82.  
  83.   return $html;
  84.   }
  85.  
  86.  
  87. sub getOption ($$;$)
  88.   {
  89.   my ($value, $label, $selected) = @_;
  90.  
  91.   my $html = '  <option value="' . $value . '"';
  92.   if(defined $selected and $selected)
  93.     {
  94.     $html .= ' selected';
  95.     }
  96.   $html .= ' >' . $label . '</option>';
  97.   return $html;
  98.   }
  99.  
  100.  
  101.  
  102. #
  103. #leave this at the end, since we are using this file as a subroutine library
  104. #
  105. 1;

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Recent Pastes

Raw Paste

Login or Register to edit or fork this paste. It's free.