Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1751263
  • 博文数量: 100
  • 博客积分: 10122
  • 博客等级: 上将
  • 技术积分: 4092
  • 用 户 组: 普通用户
  • 注册时间: 2005-07-04 20:28
文章分类

全部博文(100)

文章存档

2010年(2)

2009年(28)

2008年(70)

我的朋友

分类:

2008-08-15 22:48:27

package HWTAG::Config;
# default configurations
my %config_default = (
category => {},
);

# config file should operate on this variable
our %config;

sub load($$) {
my ($config_file, $config) = @_;
%config = %config_default;
unless (my $return = do $config_file) {
die "couldn't parse config file: $@" if $@;
die "couldn't do config file: $!" unless defined $return;
die "couldn't run config file" unless $return;
}

# copy instead of reference for multiple instances of objects having
# different configurations.
%$config = %config;
}

    $config_file ||= $ENV{HWTAG_CONFIG};
$config_file ||= catfile($ENV{HOME}, '.hwtag.pl');

HWTAG::Config::load($config_file, $self->{config});
将里面的 HWTAG 换成其他就可以了,配置文件为 perl 代码,以修改 %config 变量来对程序进行配置,比如:

$config{category} = {
    read => {
        lib => '/data/share/read/.lib',
        export => '/data/share/read',
        post_sync_sub => sub {
            my ($self, $basemeta, $entry, @files) = @_;
        },
    },
};

阅读(2204) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~