Skip to content

pod简单介绍 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 186 additions & 0 deletions articles/draft/POD简单介绍.pod
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@

=head1 POD�ļ򵥽���

POD �ô����ĵ������ף���������������ӵ�����Ҳ��������

=head2 ע������

=over 4

=item 1

�����ж������¶�Ҫ��һ������

=item 2

�ص����룬��=cut����podģʽ

=item 3

ע��д�����棬��дfun1 ��ע�ͣ�Ȼ��дfun1�Ĵ��룬��fun2ע�ͣ�fun2����

=back

=head2 pm�е�˵���ĵ�

pm����Ҫ�����⼸������

=over 4

=item 1 NAME ��������

=item 2 SYNOPSIS ��Ҫ��ģ��ʹ�÷���

=item 3 DESCRIPTION ��ϸ������

=item 4 AUTHOR ���ߵ���Ϣ

=back

=head2 POD in PM example���ӽ���

package Win32::Registry; #code

=head1 NAME #pod

Win32::Registry - accessing the Windows registry [obsolete, use Win32::TieRegistry]

=head1 SYNOPSIS

use Win32::Registry;
my $tips;
$::HKEY_LOCAL_MACHINE->Open("SOFTWARE\\Microsoft\\Windows"
."\\CurrentVersion\\Explorer\\Tips", $tips)
or die "Can't open tips: $^E";
my ($type, $value);
$tips->QueryValueEx("18", $type, $value) or die "No tip #18: $^E";
print "Here's a tip: $value\n";

=head1 DESCRIPTION

NOTE: This module provides a very klunky interface to access the
Windows registry, and is not currently being developed actively. It
only exists for backward compatibility with old code that uses it.
For more powerful and flexible ways to access the registry, use
Win32::TieRegistry.

Win32::Registry provides an object oriented interface to the Windows
Registry.

The following "root" registry objects are exported to the main:: name
space. Additional keys must be opened by calling the provided methods
on one of these.

$HKEY_CLASSES_ROOT
$HKEY_CURRENT_USER
$HKEY_LOCAL_MACHINE
$HKEY_USERS
$HKEY_PERFORMANCE_DATA
$HKEY_CURRENT_CONFIG
$HKEY_DYN_DATA

=cut #pod������׼���������

use strict;
require Exporter;
require DynaLoader;
use Win32::WinError;

require Win32 unless defined &Win32::GetLastError;

use vars qw($VERSION $AUTOLOAD @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

sub _new {
my $self;
if ($_[0]) {
$self->{'handle'} = $_[0];
bless $self;
}
$self;
}

=head2 Methods #����POD

The following methods are supported. Note that subkeys can be
specified as a path name, separated by backslashes (which may
need to be doubled if you put them in double quotes).

=over 8

=item Open #�����һ�������������÷�

$reg_obj->Open($sub_key_name, $sub_reg_obj);

Opens a subkey of a registry object, returning the new registry object
in $sub_reg_obj.

=cut #����pod�� �������

sub Open { #��һ�����������Ķ���
my $self = shift;
die 'usage: $obj->Open($sub_key_name, $sub_reg_obj)' if @_ != 2;

my ($subkey) = @_;
my ($result,$subhandle);

$result = RegOpenKey($self->{'handle'},$subkey,$subhandle);
$_[1] = _new($subhandle);

return 0 unless $_[1];
$! = Win32::GetLastError() unless $result;
return $result;
}

=item Close #����POD����ڶ�����������Close

$reg_obj->Close();

Closes an open registry key.

=cut #����POD���������

sub Close { #�ڶ������������Ķ���
my $self = shift;
die 'usage: $obj->Close()' if @_ != 0;

return unless exists $self->{'handle'};
my $result = RegCloseKey($self->{'handle'});
if ($result) {
delete $self->{'handle'};
}
else {
$! = Win32::GetLastError();
}
return $result;
}

=item Connect #����POD�����������������Close

$reg_obj->Connect($node_name, $new_reg_obj);

Connects to a remote Registry on the node specified by $node_name,
returning it in $new_reg_obj. Returns false if it fails.

=cut #�뿪pod�������

sub Connect { #�����3����������
my $self = shift;
die 'usage: $obj->Connect($node_name, $new_reg_obj)' if @_ != 2;

my ($node) = @_;
my ($result,$subhandle);

$result = RegConnectRegistry ($node, $self->{'handle'}, $subhandle);
$_[1] = _new($subhandle);

return 0 unless $_[1];
$! = Win32::GetLastError() unless $result;
return $result;
}

1;

__END__