我有一个纯 perl 服务类 PlainData,它从远程文件系统中检索一些纯数据。生成一些文本和状态标志(错误、警告)的包 PlainData。我如何(放置、链接)它到 perl mason web 上下文中。我会做这样的事情:
<%init>
use PlainData;
my $stn = $ARGS{"STN"};
my $yr = $ARGS{"YR"};
my $mo = $ARGS{"MO"};
my $dy = $ARGS{"DY"};
...do something with $stn,$yr,$mo,$dy,
my $plainDataHandler = new PlainData();
my ($status, $text) = $plainDtaHandler->listStationsByDay( $stn, $yr, $mo, $dy);
if ($status>10) {
print "<h1>ERROR REQUEST DATA STATIONS</h1>\n";
print $text;
} else {
print $text;
}
</%init>
我也试过
my $plainDataHandler = $m->comp('/var/perl/PlainData.pm');