⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constants.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
字号:
package Package::Constants;use strict;use vars qw[$VERSION $DEBUG];$VERSION    = '0.01';$DEBUG      = 0;=head1 NAME Package::Constants - List all constants declared in a package=head1 SYNOPSIS    use Package::Constants;        ### list the names of all constants in a given package;    @const = Package::Constants->list( __PACKAGE__ );    @const = Package::Constants->list( 'main' );    ### enable debugging output    $Package::Constants::DEBUG = 1;=head1 DESCRIPTIONC<Package::Constants> lists all the constants defined in a certain package. This can be useful for, among others, setting up an autogenerated C<@EXPORT/@EXPORT_OK> for a Constants.pm file.=head1 CLASS METHODS=head2 @const = Package::Constants->list( PACKAGE_NAME );Lists the names of all the constants defined in the provided package.=cutsub list {    my $class = shift;    my $pkg   = shift;    return unless defined $pkg; # some joker might use '0' as a pkg...        _debug("Inspecting package '$pkg'");        my @rv;    {   no strict 'refs';        my $stash = $pkg . '::';        for my $name (sort keys %$stash ) {                    _debug( "   Checking stash entry '$name'" );                        ### is it a subentry?            my $sub = $pkg->can( $name );            next unless defined $sub;                            _debug( "       '$name' is a coderef" );                        next unless defined prototype($sub) and                      not length prototype($sub);            _debug( "       '$name' is a constant" );            push @rv, $name;        }    }        return sort @rv;}=head1 GLOBAL VARIABLES=head2 $Package::Constants::DEBUGWhen set to true, prints out debug information to STDERR about thepackage it is inspecting. Helps to identify issues when the resultsare not as you expect.Defaults to false.=cutsub _debug { warn "@_\n" if $DEBUG; }1;=head1 AUTHORThis module byJos Boumans E<lt>kane@cpan.orgE<gt>.=head1 COPYRIGHTThis module iscopyright (c) 2004-2005 Jos Boumans E<lt>kane@cpan.orgE<gt>.All rights reserved.This library is free software;you may redistribute and/or modify it under the sameterms as Perl itself.=cut# Local variables:# c-indentation-style: bsd# c-basic-offset: 4# indent-tabs-mode: nil# End:# vim: expandtab shiftwidth=4:

⌨️ 快捷键说明

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