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

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.202 by root, Sun Jan 11 22:11:23 2009 UTC vs.
Revision 1.213 by root, Sat Jan 7 15:24:41 2012 UTC

17use Carp (); 17use Carp ();
18 18
19our $VERSION; 19our $VERSION;
20 20
21BEGIN { 21BEGIN {
22 $VERSION = '2.02'; 22 $VERSION = '3.0';
23 23
24 use XSLoader; 24 use XSLoader;
25 XSLoader::load "Deliantra::Client", $VERSION; 25 XSLoader::load "Deliantra::Client", $VERSION;
26} 26}
27 27
35use File::Path (); 35use File::Path ();
36use Storable (); # finally 36use Storable (); # finally
37use Fcntl (); 37use Fcntl ();
38use JSON::XS qw(encode_json decode_json); 38use JSON::XS qw(encode_json decode_json);
39use Guard qw(guard); 39use Guard qw(guard);
40
41# modules to support other DC::* packages
42use List::Util ();
43use IO::AIO ();
44use Coro::AIO ();
45use AnyEvent::AIO ();
40 46
41=item shorten $string[, $maxlength] 47=item shorten $string[, $maxlength]
42 48
43=cut 49=cut
44 50
141sub find_rcfile($) { 147sub find_rcfile($) {
142 my $path; 148 my $path;
143 149
144 for (@RC_PATH, "") { 150 for (@RC_PATH, "") {
145 $path = "$RC_BASE/$_/$_[0]"; 151 $path = "$RC_BASE/$_/$_[0]";
146 return $path if -r $path; 152 return $path if -e $path;
147 } 153 }
148 154
149 die "FATAL: can't find required file \"$_[0]\" in \"$RC_BASE\"\n"; 155 die "FATAL: can't find required file \"$_[0]\" in \"$RC_BASE\"\n";
150} 156}
151 157
154 160
155 open my $fh, $file 161 open my $fh, $file
156 or return; 162 or return;
157 163
158 local $/; 164 local $/;
159 JSON::XS->new->utf8->relaxed->decode (<$fh>) 165 eval { JSON::XS->new->utf8->relaxed->decode (<$fh>) }
160} 166}
161 167
162sub set_theme($) { 168sub set_theme($) {
163 return if $RC_THEME eq $_[0]; 169 return if $RC_THEME eq $_[0];
164 $RC_THEME = $_[0]; 170 $RC_THEME = $_[0];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines