ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/Deliantra.pm
(Generate patch)

Comparing deliantra/Deliantra/Deliantra.pm (file contents):
Revision 1.23 by root, Thu Feb 23 02:52:51 2006 UTC vs.
Revision 1.24 by root, Thu Feb 23 03:13:33 2006 UTC

113sub read_pak($;$) { 113sub read_pak($;$) {
114 my ($path, $cache) = @_; 114 my ($path, $cache) = @_;
115 115
116 eval { 116 eval {
117 defined $cache 117 defined $cache
118 && -e $cache
118 && -M $cache < -M $path 119 && -M $cache < -M $path
119 && Storable::retrieve ($cache) 120 && Storable::retrieve ($cache)
120 } or do { 121 } or do {
121 my %pak; 122 my %pak;
122 123
138sub read_arch($;$) { 139sub read_arch($;$) {
139 my ($path, $cache) = @_; 140 my ($path, $cache) = @_;
140 141
141 eval { 142 eval {
142 defined $cache 143 defined $cache
144 && -e $cache
143 && -M $cache < -M $path 145 && -M $cache < -M $path
144 && Storable::retrieve ($cache) 146 && Storable::retrieve ($cache)
145 } or do { 147 } or do {
146 my %arc; 148 my %arc;
147 my ($more, $prev); 149 my ($more, $prev);
265 # single face 267 # single face
266 return (0, 0, 0, 0); 268 return (0, 0, 0, 0);
267 } 269 }
268} 270}
269 271
270sub init($) {
271 my ($cachedir) = @_;
272
273 return if %ARCH;
274
275 mkdir $cachedir, 0777;
276 *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst";
277}
278
279=item $type = arch_attr $arch 272=item $type = arch_attr $arch
280 273
281Returns a hashref describing the object and its attributes. It can contain 274Returns a hashref describing the object and its attributes. It can contain
282the following keys: 275the following keys:
283 276
379# return(edit_type); 372# return(edit_type);
380# 373#
381# 374#
382} 375}
383 376
377sub init($) {
378 my ($cachedir) = @_;
379
380 return if %ARCH;
381
382 mkdir $cachedir, 0777;
383 *ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst";
384}
385
384$CACHEDIR ||= $ENV{HOME} ? "$ENV{HOME}/.crossfire" : File::Spec->tmpdir; 386$CACHEDIR ||= $ENV{HOME} ? "$ENV{HOME}/crossfire" : File::Spec->tmpdir;
385 387
386init $CACHEDIR; 388init $CACHEDIR;
387 389
388=head1 AUTHOR 390=head1 AUTHOR
389 391

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines