marshall.pm

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PM 代码 · 共 78 行

PM
78
字号
package YAML::Marshall;use strict; use warnings;use YAML::Node();sub import {    my $class = shift;    no strict 'refs';    my $package = caller;    unless (grep { $_ eq $class} @{$package . '::ISA'}) {        push @{$package . '::ISA'}, $class;    }    my $tag = shift;    if ($tag) {        no warnings 'once';        $YAML::TagClass->{$tag} = $package;        ${$package . "::YamlTag"} = $tag;    }}sub yaml_dump {    my $self = shift;    no strict 'refs';    my $tag = ${ref($self) . "::YamlTag"} || 'perl/' . ref($self);    $self->yaml_node($self, $tag);}sub yaml_load {    my ($class, $node) = @_;    if (my $ynode = $class->yaml_ynode($node)) {        $node = $ynode->{NODE};    }    bless $node, $class;}sub yaml_node {    shift;    YAML::Node->new(@_);}sub yaml_ynode {    shift;    YAML::Node::ynode(@_);}1;__END__=head1 NAMEYAML::Marshall - YAML marshalling class you can mixin to your classes=head1 SYNOPSIS    package Bar;    use Foo -base;    use YAML::Marshall -mixin;=head1 DESCRIPTIONFor classes that want to handle their own YAML serialization.=head1 AUTHORIngy d枚t Net <ingy@cpan.org>=head1 COPYRIGHTCopyright (c) 2006. Ingy d枚t Net. All rights reserved.This program is free software; you can redistribute it and/or modify itunder the same terms as Perl itself.See L<http://www.perl.com/perl/misc/Artistic.html>=cut

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?