对于基于流程的文件编程有哪些好的 Perl 模块?
有哪些好的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这就是我正在寻找的内容:
文本::管道
Text::Pipe ::Stackable
感谢您帮助我阐明我的想法!
This is what I was looking for:
Text::Pipe
Text::Pipe::Stackable
Thank you for helping me clarify my ideas!
我不知道基于流的编程有任何 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
看看 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).
嗯,似乎 Perl 几乎无法自行处理任何事情:
将数据文件
分成列,
根据某些列删除一些行,
删除不必要的列
删除不必要的列将
它们与基线进行比较(写入发生更改的位置)
好吧,在这里你可以使用 Algorithm::Diff
并将数据和注释保存为 csv元数据。
Class::CSV 或 DBD::CSV ?
Hmmm, seems that it's nothing Perl cannot handle almost by itself :
taking data files
split them into columns,
remove some rows based on some columns,
remove unnecessary columns
remove unnecessary columns
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 ?