对于基于流程的文件编程有哪些好的 Perl 模块?

发布于 2024-07-29 11:44:59 字数 1026 浏览 5 评论 0原文

有哪些好的 Perl 模块可以根据配置处理文件?

基本上我正在努力获取数据文件,将它们分成列,根据某些列删除一些行,删除不必要的列,将它们与基线进行比较(写入发生更改的位置)并将数据和注释的 csv 保存为元数据。

示例文件是:

001SMSL22009032020090321024936
002XXXXX20090320102436               010000337 00051     
002XXXXX20090320103525               010000333 00090     
002XXXXX20090320103525               010000333 00090     
002XXXXX20090320103525               010000333 00090     
002XXXXX20090320103525               010000333 00090     
002XXXXX20090320103525               020000333 00090     
009000000009000000000271422122

它将与另一个文件(基线)逐行进行比较 并且一些不同的行将突出显示(我使用 Tk::DiffText)。

这是管道,其中 [is a pipeline]

file -> [分割]-> [删除生产]-> [排序]-> [比较]-> {用户跳入并写入评论,根据需要编辑文件} -> [保存csv]-> [保存评论]

真正的问题是什么 perl 模块有助于建模和制作这样的管道流? 经过更多研究,我发现了这个 http://en.wikipedia.org/wiki/Flow-based_programming

What are some good Perl modules to process files based on configurations?

Basically I am working on taking data files, split them into columns, remove some rows based on some columns, remove unnecessary columns, compare them to baseline (writes where changes have occured) and save a csv of the data and the comments as metadata.

Sample file is:

001SMSL22009032020090321024936
002XXXXX20090320102436               010000337 00051     
002XXXXX20090320103525               010000333 00090     
002XXXXX20090320103525               010000333 00090     
002XXXXX20090320103525               010000333 00090     
002XXXXX20090320103525               010000333 00090     
002XXXXX20090320103525               020000333 00090     
009000000009000000000271422122

it will compare row by row with another file (baseline)
and some differing rows will be highlighted ( I am use Tk::DiffText).

Here is the pipeline where [is a pipe]

file -> [split] -> [remove production] -> [sort] -> [compare] -> {user jumps in and writes comments, edits file as needed} -> [save csv] -> [save comments]

The real question is what perl module helps to model and make a pipeline flow like this?
After more research I have found this http://en.wikipedia.org/wiki/Flow-based_programming.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

行至春深 2024-08-05 11:45:16

这就是我正在寻找的内容:

文本::管道

Text::Pipe ::Stackable

感谢您帮助我阐明我的想法!

This is what I was looking for:

Text::Pipe

Text::Pipe::Stackable

Thank you for helping me clarify my ideas!

白衬杉格子梦 2024-08-05 11:45:13

我不知道基于流的编程有任何 Perl 实现,但我相信 Perl 5.8 已经为 Perl 编码人员提供了解释器线程(如果我错了,请纠正我!),因此构建 FBP 实现应该相对简单关于 Perl。 请参阅http://perldoc.perl.org/threads.html

I am not aware of any Perl implementations of Flow-Based Programming, but I believe Perl 5.8 has made interpreter threads available to Perl coders (someone correct me if I'm wrong!), so it should be relatively straightforward to build an FBP implementation on Perl. See http://perldoc.perl.org/threads.html

左秋 2024-08-05 11:45:09

看看 Sprog。 它是一个用Perl(使用Gtk2)编写的可视化编程引擎。 您可以通过拖放“齿轮”来创建 Perl 程序。 您还可以添加自己的齿轮(当然是用 Perl 编写的)。

Take a look at Sprog. It is a visual programming engine written in Perl (using Gtk2). You can create Perl programs by dragging and dropping "gears". You can also add your own gears (written in Perl, of course).

screen shot of Sprog

眼泪淡了忧伤 2024-08-05 11:45:07

嗯,似乎 Perl 几乎无法自行处理任何事情:

将数据文件

while (<>) 

分成列,

my @row = split(/,/);

根据某些列删除一些行,

next if @row[5] =~ m/black_list_data/;

删除不必要的列

@row = ($row[1], $row[4]);

删除不必要的列将

@row = ($row[1], $row[4]);

它们与基线进行比较(写入发生更改的位置)

好吧,在这里你可以使用 Algorithm::Diff

并将数据和注释保存为 csv元数据。

Class::CSVDBD::CSV

Hmmm, seems that it's nothing Perl cannot handle almost by itself :

taking data files

while (<>) 

split them into columns,

my @row = split(/,/);

remove some rows based on some columns,

next if @row[5] =~ m/black_list_data/;

remove unnecessary columns

@row = ($row[1], $row[4]);

remove unnecessary columns

@row = ($row[1], $row[4]);

compare them to baseline (writes where changes have occured)

Ok, here you might use Algorithm::Diff

and save a csv of the data and the comments as metadata.

Class::CSV or DBD::CSV ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文