如何编写Perl脚本来自动截取屏幕截图?

>我想要一个独立于平台的实用程序来截取屏幕截图(
not just within the browser).

>该实用程序可以在固定的时间间隔后截取屏幕截图,并且可以由用户轻松配置

>连续拍摄之间的时间,
>存储镜头的格式,
>直到脚本运行时(时间,事件)等

>由于我需要平台独立性,我认为Perl是一个不错的选择.

a. Before I start out, I want to know whether a similar thing already exists, so I can start from there?

> Searching CPAN给出了这两个相关结果:

> Imager-Screenshot-0.009
> Imager-Search-1.00

从这些页面看,第一页看起来更容易.

b. Which one of these Perl modules should I use?

最佳答案 看看两者的来源,Imager :: Search不仅仅是Imager :: Screenshot的包装器.

这是构造函数:

sub new {
    my $class  = shift;
    my @params = ();
    @params = @{shift()} if _ARRAY0($_[0]);
    my $image = Imager::Screenshot::screenshot( @params );
    unless ( _INSTANCE($image, 'Imager') ) {
        Carp::croak('Failed to capture screenshot');
    }

    # Hand off to the parent class
    return $class->SUPER::new( image => $image, @_ );
}

鉴于Imager :: Search并没有真正扩展Imager :: Screenshot,我会说你正在看两个基本相同的模块.

点赞