client.html

来自「perl教程」· HTML 代码 · 共 483 行 · 第 1/2 页

HTML
483
字号
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../../displayToc.js"></script>
<script language="JavaScript" src="../../../tocParas.js"></script>
<script language="JavaScript" src="../../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../../scineplex.css">
<title>ActivePerl::PPM::Client - Client class</title>
<link rel="stylesheet" href="../../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',3);</script>
<h1><a>ActivePerl::PPM::Client - Client class</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#bugs">BUGS</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>ActivePerl::PPM::Client - Client class</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
  <span class="keyword">my</span> <span class="variable">$ppm</span> <span class="operator">=</span> <span class="variable">ActivePerl::PPM::Client</span><span class="operator">-&gt;</span><span class="variable">new</span><span class="operator">;</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <code>ActivePerl::PPM::Client</code> object ties together a set of install
areas and repositories and allow the installed packages to be managed.
The install areas are deducted from the values of <a href="../../../lib/Pod/perlvar.html#item__inc"><code>@INC</code></a> when the
object is constructed.</p>
<p>The following methods are provided:</p>
<dl>
<dt><strong><a name="item_new">$client = ActivePerl::PPM::Client-&gt;new</a></strong>

<dt><strong>$client = ActivePerl::PPM::Client-&gt;new( $home_dir )</strong>

<dd>
<p>The constructor creates a new client based on the configuration found
in $home_dir which defaults to <em>$ENV{HOME}/.ActivePerl</em> directory of the
current user.  If no such directory is found it is created.</p>
</dd>
</li>
<dt><strong><a name="item_arch">$client-&gt;arch</a></strong>

<dd>
<p>A string that identifies the architecture for the current perl.  This
must match the ARCHITECTURE/NAME attribute of PPDs for them to match.</p>
</dd>
</li>
<dt><strong><a name="item_area">$client-&gt;area( $name )</a></strong>

<dd>
<p>Returns an object representing the given named install area.  The
method will croak if no install area with the given $name is known.
The <code>perl</code> and <code>site</code> areas will always be available.  See
<a href="../../../lib/ActivePerl/PPM/InstallArea.html">the ActivePerl::PPM::InstallArea manpage</a> for methods available on the returned
object.</p>
</dd>
</li>
<dt><strong><a name="item_areas">$client-&gt;areas</a></strong>

<dd>
<p>Return list of available install area names.  The list is ordered to
match the corresponding entries in <a href="../../../lib/Pod/perlvar.html#item__inc"><code>@INC</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item_default_install_area">$client-&gt;default_install_area</a></strong>

<dd>
<p>Return the name of the area where installations should normally go.
Might return <a href="../../../lib/Pod/perlfunc.html#item_undef"><code>undef</code></a> if there is no appropriate default.</p>
</dd>
</li>
<dt><strong><a name="item_config_get">$value = $client-&gt;config_get( $key )</a></strong>

<dt><strong>($value1, $value2, ...) = $client-&gt;config_get( $key1, $key2, ...)</strong>

<dd>
<p>Read back one or more configuration values previosly saved.</p>
</dd>
</li>
<dt><strong><a name="item_config_list">($key, $value, ...) = $client-&gt;config_list</a></strong>

<dt><strong>($key, $value, ...) = $client-&gt;config_list( $glob_pattern )</strong>

<dd>
<p>Return all key/value pairs where $key match the given $glob_pattern.
If $glob_pattern is missing return all key/value pairs.</p>
</dd>
</li>
<dt><strong><a name="item_config_save">$client-&gt;config_save( $key =&gt; $value )</a></strong>

<dt><strong>$client-&gt;config_save( %pairs )</strong>

<dd>
<p>Will persistently store the given key/value pairs.  The values can be
extracted again with $client-&gt;config_get().</p>
</dd>
</li>
<dt><strong><a name="item_repo">$client-&gt;repo( $repo_id )</a></strong>

<dd>
<p>Returns a reference to a hash describing the repo with the given
identifier.  The interesting fields of this hash are:</p>
</dd>
<dl>
<dt><strong><a name="item_name">name</a></strong>

<dd>
<p>The full (user friendly) name of the repository.  Can be modified by
$repo-&gt;repo_set_name().</p>
</dd>
</li>
<dt><strong><a name="item_enabled">enabled</a></strong>

<dd>
<p>A boolean that indicated if the repo is enabled or not.  Can be
modified by $repo-&gt;repo_enable().</p>
</dd>
</li>
<dt><strong><a name="item_pkgs">pkgs</a></strong>

<dd>
<p>The number of packages provided by this repository.</p>
</dd>
</li>
<dt><strong><a name="item_packlist_uri">packlist_uri</a></strong>

<dd>
<p>The URI that the PPM client will monitor for changes to the
repository.  This URI can denote a <em>packlist.xml</em>, <em>packlist.lst</em>
file or an HTML document with links to PPD files (typically a server
generated directory listing).  The URI can use any scheme that LWP
supports and can embed a username and password for HTTP using this syntax: <code>http://user:pass@ppm.example.com/</code>.</p>
</dd>
</li>
<dt><strong><a name="item_packlist_last_status">packlist_last_status</a></strong>

<dd>
<p>The HTTP status code reported last time the PPM client tried to access
<a href="#item_packlist_uri"><code>packlist_uri</code></a> document.</p>
</dd>
</li>
<dt><strong><a name="item_packlist_last_access">packlist_last_access</a></strong>

<dd>
<p>When did we last try to to access the <a href="#item_packlist_uri"><code>packlist_uri</code></a> document.  The
value is seconds from epoch as for perl's <a href="../../../lib/Pod/perlfunc.html#item_time"><code>time()</code></a> function.</p>
</dd>
</li>
<dt><strong><a name="item_packlist_fresh_until">packlist_fresh_until</a></strong>

<dd>
<p>When do we need to refetch the <a href="#item_packlist_uri"><code>packlist_uri</code></a> document. The
value is seconds from epoch as for perl's <a href="../../../lib/Pod/perlfunc.html#item_time"><code>time()</code></a> function.</p>
</dd>
</li>
</dl>
<dt><strong><a name="item_repos">$client-&gt;repos</a></strong>

<dd>
<p>Returns list of available repo identifiers.</p>
</dd>
</li>
<dt><strong><a name="item_repo_add">$client-&gt;repo_add( name =&gt; $name, packlist_uri =&gt; $uri )</a></strong>

<dd>
<p>Will add a new repository with the given attributes.  The method will
croak if a repository with the same <a href="#item_packlist_uri"><code>packlist_uri</code></a> already exists.
The return value is the $repo_id of the new repository.</p>
</dd>
</li>
<dt><strong><a name="item_repo_delete">$client-&gt;repo_delete( $repo_id )</a></strong>

<dd>
<p>Will make the client forget about the given repository.</p>
</dd>
</li>
<dt><strong><a name="item_repo_enable">$client-&gt;repo_enable( $repo_id )</a></strong>

<dt><strong>$client-&gt;repo_enable( $repo_id, $bool )</strong>

<dd>
<p>Makes it possible to enable and disable the given reposiory.  If $bool
is provided and is FALSE, then the repository is disabled.  The return
value is TRUE if the given repository was enabled.</p>
</dd>
</li>
<dt><strong><a name="item_repo_set_name">$client-&gt;repo_set_name( $repo_id, $name )</a></strong>

<dd>
<p>Will update the name by which the given repo is known.</p>
</dd>
</li>
<dt><strong><a name="item_repo_set_packlist_uri">$client-&gt;repo_set_packlist_uri( $repo_id, $uri )</a></strong>

<dd>
<p>Will update the address of the packlist to monitor for the given
repository.  Will croak if the $uri is already used by some other
repo.</p>
</dd>
<dd>
<p>Updating the URI will loose all cached information about the repo.  A
new 'repo_sync' is needed to update this information.</p>
</dd>
</li>
<dt><strong><a name="item_repo_sync">$client-&gt;repo_sync( %args )</a></strong>

<dd>
<p>Will sync the local cache of packages from the enabled repositories.
Remote repositories are not contacted if the cache is not considered
stale yet.  The following options are recognized:</p>
</dd>
<dl>
<dt><strong><a name="item_force__3d_3e__24bool">force =&gt; $bool</a></strong>

<dd>
<p>If TRUE force state to be transfered again from remote repositories.
Make requests unconditional.</p>
</dd>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?