home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / PPMConfig.pm < prev    next >
Encoding:
Text File  |  2001-04-18  |  13.8 KB  |  426 lines

  1. #
  2. # PPM::XML::PPMConfig
  3. #
  4. # Definition of the PPMConfig file format; configuration options for the Perl
  5. # Package Manager.
  6. #
  7. ###############################################################################
  8.  
  9. $PPM::XML::PPMConfig::revision = '$Id: PPMConfig.pm,v 1.1.1.1 2000/01/26 17:39:19 graham Exp $';
  10. $PPM::XML::PPMConfig::VERSION  = '0.01';
  11.  
  12. ###############################################################################
  13. # Import everything from PPM::XML::PPD into our own namespace.
  14. ###############################################################################
  15. package PPM::XML::PPMConfig;
  16. use PPM::XML::PPD ':elements';
  17.  
  18. ###############################################################################
  19. # PPMConfig Element: Characters
  20. ###############################################################################
  21. package PPM::XML::PPMConfig::Characters;
  22. @ISA = qw( PPM::XML::Element );
  23.  
  24. ###############################################################################
  25. # PPMConfig Element: PPMCONFIG
  26. ###############################################################################
  27. package PPM::XML::PPMConfig::PPMCONFIG;
  28. @ISA = qw( PPM::XML::ValidatingElement );
  29. @okids  = qw( PPMVER PLATFORM REPOSITORY OPTIONS PPMPRECIOUS PACKAGE );
  30.  
  31. ###############################################################################
  32. # PPMConfig Element: PPMVER
  33. ###############################################################################
  34. package PPM::XML::PPMConfig::PPMVER;
  35. @ISA = qw( PPM::XML::ValidatingElement );
  36.  
  37. ###############################################################################
  38. # PPMConfig Element: PLATFORM
  39. ###############################################################################
  40. package PPM::XML::PPMConfig::PLATFORM;
  41. @ISA = qw( PPM::XML::ValidatingElement );
  42. @oattrs = qw( LANGUAGE );
  43. @rattrs = qw( OSVALUE OSVERSION CPU );
  44.  
  45. ###############################################################################
  46. # PPMConfig Element: REPOSITORY
  47. ###############################################################################
  48. package PPM::XML::PPMConfig::REPOSITORY;
  49. @ISA = qw( PPM::XML::ValidatingElement );
  50. @oattrs = qw( USERNAME PASSWORD SUMMARYFILE);
  51. @rattrs = qw( NAME LOCATION );
  52.  
  53. ###############################################################################
  54. # PPMConfig Element: OPTIONS
  55. ###############################################################################
  56. package PPM::XML::PPMConfig::OPTIONS;
  57. @ISA = qw( PPM::XML::ValidatingElement );
  58. @rattrs = qw( IGNORECASE CLEAN CONFIRM FORCEINSTALL ROOT BUILDDIR MORE );
  59. @oattrs = qw( TRACE TRACEFILE VERBOSE DOWNLOADSTATUS );
  60.  
  61. ###############################################################################
  62. # PPMConfig Element: PPMPRECIOUS
  63. ###############################################################################
  64. package PPM::XML::PPMConfig::PPMPRECIOUS;
  65. @ISA = qw( PPM::XML::ValidatingElement );
  66.  
  67. ###############################################################################
  68. # PPMConfig Element: PACKAGE
  69. ###############################################################################
  70. package PPM::XML::PPMConfig::PACKAGE;
  71. @ISA = qw( PPM::XML::ValidatingElement );
  72. @okids  = qw( LOCATION INSTDATE INSTROOT INSTPACKLIST INSTPPD );
  73. @rattrs = qw( NAME );
  74.  
  75. ###############################################################################
  76. # PPMConfig Element: LOCATION
  77. ###############################################################################
  78. package PPM::XML::PPMConfig::LOCATION;
  79. @ISA = qw( PPM::XML::ValidatingElement );
  80.  
  81. ###############################################################################
  82. # PPMConfig Element: INSTDATE
  83. ###############################################################################
  84. package PPM::XML::PPMConfig::INSTDATE;
  85. @ISA = qw( PPM::XML::ValidatingElement );
  86.  
  87. ###############################################################################
  88. # PPMConfig Element: INSTROOT
  89. ###############################################################################
  90. package PPM::XML::PPMConfig::INSTROOT;
  91. @ISA = qw( PPM::XML::ValidatingElement );
  92.  
  93. ###############################################################################
  94. # PPMConfig Element: INSTPACKLIST
  95. ###############################################################################
  96. package PPM::XML::PPMConfig::INSTPACKLIST;
  97. @ISA = qw( PPM::XML::ValidatingElement );
  98.  
  99. ###############################################################################
  100. # PPMConfig Element: INSTPPD
  101. ###############################################################################
  102. package PPM::XML::PPMConfig::INSTPPD;
  103. @ISA = qw( PPM::XML::ValidatingElement );
  104. @okids = qw( SOFTPKG );                 # Allow for an PPM::XML::PPD::SOFTPKG
  105.  
  106. __END__
  107.  
  108. ###############################################################################
  109. # POD
  110. ###############################################################################
  111.  
  112. =head1 NAME
  113.  
  114. PPM::XML::PPMConfig - PPMConfig file format and XML parsing elements
  115.  
  116. =head1 SYNOPSIS
  117.  
  118.  use XML::Parser;
  119.  use PPM::XML::PPMConfig;
  120.  
  121.  $p = new PPM::XML::Parser( Style => 'Objects', Pkg => 'PPM::XML::PPMConfig' );
  122.  ...
  123.  
  124. =head1 DESCRIPTION
  125.  
  126. This module provides a set of classes for parsing PPM configuration files 
  127. using the C<XML::Parser> module.  All of the elements unique to a PPM
  128. configuration file are derived from C<PPM::XML::ValidatingElement>. 
  129. There are also several classes rebuilt here which are derived from 
  130. elements in C<PPM::XML::PPD> as we can include a PPD file within our own 
  131. INSTPPD element.
  132.  
  133. =head1 MAJOR ELEMENTS
  134.  
  135. =head2 PPMCONFIG
  136.  
  137. Defines a PPM configuration file.  The root of a PPMConfig document is
  138. B<always> a PPMCONFIG element.
  139.  
  140. =head2 PACKAGE
  141.  
  142. Child of PPMCONFIG, used to describe a Perl Package which has already been
  143. installed.  Multiple instances are valid.  The PACKAGE element allows for the
  144. following attributes:
  145.  
  146. =over 4
  147.  
  148. =item NAME
  149.  
  150. Name of the package as given in it's PPD
  151.  
  152. =back
  153.  
  154. =head1 MINOR ELEMENTS
  155.  
  156.  
  157. =head2 PPMVER
  158.  
  159. Child of PPMCONFIG, used to state the version of PPM for which this
  160. configuration file is valid.  A single instance should be present.
  161.  
  162. =head2 PLATFORM
  163.  
  164. Child of PPMCONFIG, used to specify the platform of the target machine.  A
  165. single instance should be present.  The PLATFORM element allows for the
  166. following attributes:
  167.  
  168. =over 4
  169.  
  170. =item OSVALUE
  171.  
  172. Description of the local operating system as defined in the Config.pm file
  173. under 'osname'.
  174.  
  175. =item OSVERSION
  176.  
  177. Version of the local operating system.
  178.  
  179. =item CPU
  180.  
  181. Description of the CPU in the local system.  The following list of possible
  182. values was taken from the OSD Specification:
  183.  
  184.  x86 mips alpha ppc sparc 680x0
  185.  
  186. =item LANGUAGE
  187.  
  188. Description of the language used on the local system as specified by the
  189. language codes in ISO 639.
  190.  
  191. =back
  192.  
  193. =head2 REPOSITORY
  194.  
  195. Child of PPMCONFIG, used to specify a repository where Perl Packages can be
  196. found.  Multiple instances are valid.  The REPOSITORY element allows for the
  197. following attributes:
  198.  
  199. =over 4
  200.  
  201. =item NAME
  202.  
  203. Name by which the repository will be known (e.g.  "ActiveState").
  204.  
  205. =item LOCATION
  206.  
  207. An URL or directory where the repository can be found.
  208.  
  209. =item USERNAME
  210.  
  211. Optional username for a repository requiring authenticated connection.
  212.  
  213. =item PASSWORD
  214.  
  215. Optional password for a repository requiring authenticated connection.
  216.  
  217. =item SUMMARYFILE
  218.  
  219. Optional package summary filename.
  220.  
  221. If this file exists on the repository, its contents can be retrieved
  222. using PPM::RepositorySummary().  The contents are not strictly enforced
  223. by PPM.pm, however ppm.pl expects this to be a file with the following
  224. format (for display with the 'summary' command):
  225.  
  226. Agent [2.91]:   supplies agentspace methods for perl5.
  227. Apache-OutputChain [0.06]:      chain stacked Perl handlers
  228. [etc.]
  229.  
  230. =back
  231.  
  232. =head2 OPTIONS
  233.  
  234. Child of PPMCONFIG, used to specify the current configuration options for PPM.
  235. A single instance should be present.  The OPTIONS element allows for the
  236. following attributes:
  237.  
  238. =over 4
  239.  
  240. =item IGNORECASE
  241.  
  242. Sets case-sensitive searching.  Can be either '1' or '0'.
  243.  
  244. =item CLEAN
  245.  
  246. Sets removal of temporarily files.  Can be either '1' or '0'.
  247.  
  248. =item CONFIRM
  249.  
  250. Sets confirmation of all installs/removals/upgrades.  Can be either '1' or
  251. '0'.
  252.  
  253. =item BUILDDIR
  254.  
  255. Directory in which packages will be unpacked before their installation.
  256.  
  257. =item ROOT
  258.  
  259. Directory under which packages should be installed on the local system.
  260.  
  261. =item TRACE
  262.  
  263. Level of tracing (0 is no tracing, 4 is max tracing).
  264.  
  265. =item TRACEFILE
  266.  
  267. File to which trace information will be written.
  268.  
  269. =item VERBOSE
  270.  
  271. Controls whether query and search results are verbose (1 == verbose, 0 == no).
  272.  
  273. =back
  274.  
  275. =head2 PPMPRECIOUS
  276.  
  277. Child of PPMCONFIG, used to specify the modules which PPM itself is dependant
  278. upon.  A single instance should be present.
  279.  
  280. =head2 LOCATION
  281.  
  282. Child of PACKAGE, used to specify locations at which to search for updated
  283. versions of the PPD file for this package.  Its value can be either a
  284. directory or an Internet address.  A single instance should be present.
  285.  
  286. =head2 INSTDATE
  287.  
  288. Child of PACKAGE, used to specify the date on which the Perl Package was
  289. installed.  A single instance should be present.
  290.  
  291. =head2 INSTROOT
  292.  
  293. Child of PACKAGE, used to specify the root directory that the Perl Package was
  294. installed into.  A single instance should be present.
  295.  
  296. =head2 INSTPACKLIST
  297.  
  298. Child of PACKAGE, used to specify a reference to the packlist for this Perl
  299. Package; a file containing a list of all of the files which were installed.  A
  300. single instance should be present.
  301.  
  302. =head2 INSTPPD
  303.  
  304. Child of PACKAGE, used to hold a copy of the PPD from which Perl Packages
  305. were installed.  Multiple instances are valid.
  306.  
  307. =head1 DOCUMENT TYPE DEFINITION
  308.  
  309. The DTD for PPMConfig documents is available from the ActiveState website and
  310. the latest version can be found at:
  311.     http://www.ActiveState.com/PPM/DTD/ppmconfig.dtd
  312.  
  313. This revision of the C<PPM::XML::PPMConfig> module implements the following DTD:
  314.  
  315.  <!ELEMENT PPMCONFIG (PPMVER | PLATFORM | REPOSITORY | OPTIONS |
  316.                       PPMPRECIOUS | PACKAGE)*>
  317.  
  318.  <!ELEMENT PPMVER   (#PCDATA)>
  319.  
  320.  <!ELEMENT PLATFORM  EMPTY>
  321.  <!ATTLIST PLATFORM  OSVALUE     CDATA   #REQUIRED
  322.                      OSVERSION   CDATA   #REQUIRED
  323.                      CPU         CDATA   #REQUIRED
  324.                      LANGUAGE    CDATA   #IMPLIED>
  325.  
  326.  <!ELEMENT REPOSITORY    EMPTY>
  327.  <!ATTLIST REPOSITORY    NAME     CDATA  #REQUIRED
  328.                          LOCATION CDATA  #REQUIRED
  329.                          USERNAME CDATA  #IMPLIED
  330.                          PASSWORD CDATA  #IMPLIED
  331.                          SUMMARYFILE CDATA #IMPLIED>
  332.  
  333.  <!ELEMENT OPTIONS   EMPTY>
  334.  <!ATTLIST OPTIONS   IGNORECASE      CDATA   #REQUIRED
  335.                      CLEAN           CDATA   #REQUIRED
  336.                      CONFIRM         CDATA   #REQUIRED
  337.                      FORCEINSTALL    CDATA   #REQUIRED
  338.                      ROOT            CDATA   #REQUIRED
  339.                      BUILDDIR        CDATA   #REQUIRED
  340.                      MORE            CDATA   #REQUIRED
  341.                      DOWNLOADSTATUS  CDATA   #IMPLIED
  342.                      TRACE           CDATA   #IMPLIED
  343.                      TRACEFILE       CDATA   #IMPLIED>
  344.  
  345.  <!ELEMENT PPMPRECIOUS (#PCDATA)>
  346.  
  347.  <!ELEMENT PACKAGE   (LOCATION | INSTDATE | INSTROOT | INSTPACKLIST |
  348.                       INSTPPD)*>
  349.  <!ATTLIST PACKAGE   NAME    CDATA   #REQUIRED>
  350.  
  351.  <!ELEMENT LOCATION  (#PCDATA)>
  352.  
  353.  <!ELEMENT INSTDATE  (#PCDATA)>
  354.  
  355.  <!ELEMENT INSTROOT  (#PCDATA)>
  356.  
  357.  <!ELEMENT INSTPACKLIST (#PCDATA)>
  358.  
  359.  <!ELEMENT INSTPPD   (#PCDATA)>
  360.  
  361. =head1 SAMPLE PPMConfig FILE
  362.  
  363. The following is a sample PPMConfig file.  Note that this may B<not> be a
  364. current description of this module and is for sample purposes only.
  365.  
  366.  <PPMCONFIG>
  367.      <PPMVER>1,0,0,0</PPMVER>
  368.      <PLATFORM CPU="x86" OSVALUE="MSWin32" OSVERSION="4,0,0,0" />
  369.      <OPTIONS BUILDDIR="/tmp" CLEAN="1" CONFIRM="1" FORCEINSTALL="1"
  370.               IGNORECASE="0" MORE="0" ROOT="/usr/local" TRACE="0" TRACEFILE="" DOWNLOADSTATUS="16384" />
  371.      <REPOSITORY LOCATION="http://www.ActiveState.com/packages"
  372.                  NAME="ActiveState Package Repository" SUMMARYFILE="package.lst" />
  373.      <PPMPRECIOUS>PPM;libnet;Archive-Tar;Compress-Zlib;libwww-perl</PPMPRECIOUS>
  374.      <PACKAGE NAME="AtExit">
  375.          <LOCATION>g:/packages</LOCATION>
  376.          <INSTPACKLIST>c:/perllib/lib/site/MSWin32-x86/auto/AtExit/.packlist</INSTPACKLIST>
  377.          <INSTROOT>c:/perllib</INSTROOT>
  378.          <INSTDATE>Sun Mar  8 02:56:31 1998</INSTDATE>
  379.          <INSTPPD>
  380.              <SOFTPKG NAME="AtExit" VERSION="1,02,0,0">
  381.                  <TITLE>AtExit</TITLE>
  382.                  <ABSTRACT>Register a subroutine to be invoked at program -exit time.</ABSTRACT>
  383.                  <AUTHOR>Brad Appleton (Brad_Appleton-GBDA001@email.mot.com)</AUTHOR>
  384.                  <IMPLEMENTATION>
  385.                      <CODEBASE HREF="x86/AtExit.tar.gz" />
  386.                  </IMPLEMENTATION>
  387.              </SOFTPKG>
  388.          </INSTPPD>
  389.      </PACKAGE>
  390.  </PPMCONFIG>
  391.  
  392. =head1 KNOWN BUGS/ISSUES
  393.  
  394. Elements which are required to be empty (e.g. REPOSITORY) are not enforced as
  395. such.
  396.  
  397. Notations above about elements for which "only one instance" or "multiple
  398. instances" are valid are not enforced; this primarily a guideline for
  399. generating your own PPD files.
  400.  
  401. Currently, this module creates new classes within it's own namespace for all of
  402. the PPD elements which can be contained within the INSTPPD element.  A suitable
  403. method for importing the entire PPM::XML::PPD:: namespace should be found 
  404. in order to make this cleaner.
  405.  
  406. =head1 AUTHORS
  407.  
  408. Graham TerMarsch <grahamt@ActiveState.com>
  409.  
  410. Murray Nesbitt <murrayn@ActiveState.com>
  411.  
  412. Dick Hardt <dick_hardt@ActiveState.com>
  413.  
  414. =head1 HISTORY
  415.  
  416. v0.1 - Initial release
  417.  
  418. =head1 SEE ALSO
  419.  
  420. L<PPM::XML::ValidatingElement>,
  421. L<XML::Parser>,
  422. L<PPM::XML::PPD>
  423. .
  424.  
  425. =cut
  426.