3
package name::subname ( �������� File::Find )
10
* ��� ������ ������ ������ ���-������ � "name/subname.pm"
12
������� ������� & etc:
13
----------------------
14
* ������ @EXPORT ������ ��������� ���, ��� ����� �������������� �� ���������
15
* ������ @EXPORT_OK �������� ���, ��� ����� ���� ������������� � �������
16
����������� "use name::subname $varname"
20
name::subname::varname - ���������� ������ name::subname (������� �����)
21
MAIN::varname - ���������� ���������� (��� $::varname)
25
require name::subname; �� ���� #include
26
use name::subname; ���������� �� ����������� ��� ��� ������������
27
�� ������ ���������� � ����� �������������
28
����������(����� ���� ����� MAIN scope). ���
29
����� ���� ������� ��� ���������� � ���� package
30
��� ����������� ��������� �����������:
31
use name::subname qw(var1 var2 func1 func2...)
34
��������������� ����������� �������:
35
------------------------------------
36
* ����� �������� �������������� �������, ���������� ������ ������� ������� �
37
��������������� ������.
38
* ��� �� �������������� ������� �� ���� ���������:
41
*import=\&Exporter::import;
46
use MyName 'GLOBAL_glob';
47
* �� �������� ������� ��� ���� ����� ������� � ������� CORE::fname
52
* ����� � Perl �� ����� ����������, ��� �� ���� ��������� ������(���������
53
� ����). ����� ����������/������/���(��������������� ���) c ������� �������
54
bless ����������� �������.
57
bless {"Var1" => value1,"Var2" =>Value2"};
59
���, ��� � Perl �� ������� ������������ "last expression evaluated",
60
�� ����� ���������, ��� ��� ��� ���������� ���.
62
������ ���������� � ����������� ���������� ��� ������. ������ ��� �������
63
������, ���� ����������� ������, ���
64
$object=name::subname->TipaConstructor($a,$b),
65
�� ������������� ������ ���������� ���������� ��� ������(������������ �
67
$object=name::subname::TipaConstructor("class_name",$a,$b);
68
�� ��� ��� � ��� ���� ���������� �������(��� ������� ����) ��� ���-�� ���
69
��� ����������� ����� � ������������...
71
* ��� ���� ������� ����������:
72
object->func(p1,p2) <=> func object p1,p2
73
� ��������� �����������: $object=TipaConstructor name::subname $a $b
74
�������� � ������������� �������� $obj=TC name::subname($a,$b)
76
* ��������� ������� bless ���������:
77
bless $objref [$classname];
78
objref - ��������� �� ���, ������ ��� ��� ���-�� ��� ����� ��������
79
classname - ��� ������, ���� ������� perl ��� ���-���� ��������� ;)
81
* ��� ������� ������, ��� ��������� �����������(������ _��������_ ��� ����
82
��������� ������� bless) ��������� �������� ������. ��� �� �������
83
����������� ������ '@ISA', � ������� ��������� ����� ������ �������,
84
������� �������� ������ ������. ��-���� ��� ������� ����������� ������
85
������� ������������� � @ISA �������� �������� ��������. (The classes
86
accessible through @ISA are known as base classes of the current class)
88
������� ���� ���� ��� ���������� ������� �������������, �� � Perl�
89
����������� ������ ������. � ������ ������������ ����������� workarround,
90
�� � ��� ���� ��������� �� ����.
92
* ������ ����� ���������� ����� ���������
93
1. ���������: $object->method($a,$b)
94
� ���� ������ ������ ���������� ���������� ������ �� ������� ������ (��
95
������� ���� ����� $object � ����������), � ����� ��� ������ $a � $b.
96
2. �����������: name::subname::method($a,$b)
97
����� ������ �� ������ �� ����������, � ���������� ������ $a � $b
99
���������� ������ ������ � ���� Perl� ������� �� ������ ������ �������,
100
� ����� ������� ��������� ����� $object->name2::subname2::method2($a,$b),
101
��� ����� ������������: name2::subname2::method2($object,$a,$b) -
102
! �� ���� ���� $obj-><something>($a,$b) <=> <something>($obj,$a,$b) � ���!!!
103
�� ��� ���� ��� ��� �������� ��� � ��� � �� ����� ;)))
105
* $method_name="method"; $object->$method_name(...) - ���� ��������
107
* ������� � ������ DESTROY ����� ��������� ���� �����������. ������ ����������
108
���� ���������� ������
110
* ���� ����� UNIVERSAL package (����������� ����� ��������, � ��������� Perl�
111
����������) ������� �������� ��������� ������:
112
isa(CLASS) 1, ���� ������ blessed � �������� CLASS.
113
can(METHOD) ��������� ����� �� ������ �����, ��������� METHOD, ����
114
��, �� ��������� �� ���� ���������, ����� ����������
116
VERSION([NEED]) ���������� ������ ������. ���� NEED ����� �� ���������,
117
����� ������ ���� �� ������ ���������, ����� ���������
120
* ���������� ��� ����� ��� ������, � ����������� ���������. ��� ��� ������:
121
$b=$a;bless \$a; ������ � ��
123
����������� �������(package constructors/destructors):
124
------------------------------------------------------
125
BEGIN: ����������� � ����� ������ �������, ����� ��������� ����� ����������
127
���� ��������� ������ ������ ��� ����������� � ������� �������.
128
END: �������������� ����������� � ����� �����, ����� ��� ��� ���������
130
����������� ���� � ��� ������, ���� ���������� ������ ���������� �
131
������� ������� die(). �� �����������, ���� ����� �������� ���
132
�������������� �� ���-������ ������ � ������� exec().
133
���� ��������� ������ ������ ����������� � �������� �������
134
INIT: ����������� ����� ����� �������� ����� �����.
135
CHECK: ����������� ����� ����� ������ ��������������, ����� �����������
137
* ����� ������������������ ���������: BEGIN,INIT,CHECK,..execution..,END
138
* ���������� "sub" � ���� ������ ����� ��������
142
strict - ����� ����������� ����� ����� ������� ���������
143
File::Find - ����� ������