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.201 by root, Sun Jan 11 03:19:47 2009 UTC vs.
Revision 1.202 by root, Sun Jan 11 22:11:23 2009 UTC

34use Pod::POM (); 34use Pod::POM ();
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);
39 39use Guard qw(guard);
40=item guard { BLOCK }
41
42Returns an object that executes the given block as soon as it is destroyed.
43
44=cut
45
46sub guard(&) {
47 bless \(my $cb = $_[0]), "DC::Guard"
48}
49
50sub DC::Guard::DESTROY {
51 ${$_[0]}->()
52}
53 40
54=item shorten $string[, $maxlength] 41=item shorten $string[, $maxlength]
55 42
56=cut 43=cut
57 44

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines