将perl脚本/dbm移到新服务器,然后移出dbm? [英] moving a perl script/dbm to a new server, and shifting out of dbm?

查看:72
本文介绍了将perl脚本/dbm移到新服务器,然后移出dbm?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是将站点镜像到新服务器上.据我所知,旧站点上有一些Perl脚本(我对Perl一无所知,尽管我对编码普遍了解得很好,尤其是PHP/js/etc)并不依赖于旧的服务器.就是说,当我尝试运行此脚本(该脚本通过数据库文件进行查找以找到适当的文章文件)时,它不会检索任何内容.

I've been tasked with mirroring a site onto a new server. The old site has a few Perl scripts that, as far as I can see internally (i know nothing about Perl, though I have a pretty good understanding of coding generally, and specifically PHP/js/etc) aren't reliant on the old server. That said, when I try to run this script, which looks through a database file to find the appropriate article file, it doesnt retrieve anything.

基本上,这是一个基本的旧CMS,正如我所解释的那样,它在PAG文件中搜索文件名并显示它.我在这里迷路了.是否有原因无法在新站点上进行镜像?我已经检查了权限,已经检查了Perl是否安装在相同的/usr/etc 目录中.我认为它使用dbm,因为根据另一篇文章,如果我看到类似这样的命令:

Basically, this is a rudimentary old CMS, as I explain it, where it searched the PAG file for the filename and displayed it. I am a little bit lost here. Is there a reason why the mirroring doesn't work on the new site? I've checked the permissions, I've checked that Perl is installed in the same /usr/etc directories. I think it uses dbm because, according to another article, if I see commands like these:

 dbmopen( %ARTS, $art_dbm, 0644 );
 $entry = $ARTS{$article_id};
 dbmclose( %ARTS );

它必须是dbm,对吧?

it must be dbm, right?

在相关说明中,没有任何方法可以将PAG文件的信息与原始文件合并,而无需使用非常复杂的Perl脚本;也就是说,用文件本身中的该信息重新创建100个文本文件,而不是单独存储?

On a related note, is there any way to merge that PAG file's info with the original files without an incredibly sophisticated Perl script; i.e., recreate the 100 text files with that info in the file itself, rather than stored separately?

感谢下面的第一个答案.您能解释一下HASH可能是什么,以及面具吗?我已经仔细检查过.pag文件(数据库名称)确实位于.pl文件中先前定义的位置,并且已将其以二进制格式传输.但是不知何故我无法正确打开它!

thanks for the 1st answer below. can you explain what that HASH may be, and the mask? I've doublechecked that the .pag file (the database name) is indeed in the place where its defined earlier in the .pl file, and that it was transferred in binary. yet somehow I cant get it to open it correctly!

好的,对不起,在这里进行最终我使用下面的代码(Shwern),发现它在那里并没有找到那个DB文件(两篇文章.pag和articles.dir,但该变量仅在正确的目录中并具有正确的权限引用没有扩展名的" articles" ...因此,这里的问题是,现在到底是怎么回事?这些是Perl的不同版本吗?还是我只是在做一些基本而愚蠢的事情?为了记录(是的,它很糟糕),尽管我正在研究它,但我还没有shell访问权限.由于我的新网络"技能,我被要求这样做,而我当然不合适像perl和dbm这样的人,尽管我可以阅读文件并理解它们.作为最后的建议,是否有人知道(脚本等)我如何要求原始服务器人员(不是编码员)对此进行ASCII转储,还是会出现问题?我需要将其转换为CSV并返回到文件中,以便可以在另一个数据库中重用它……呃,这是一场噩梦!

EDIT 3: Ok, sorry, final editing here: I used the die code below (Shwern) and found that it is not finding that DB file, despite it being there (two files articles.pag and articles.dir, but the variable only references "articles" without extensions) in the right directory and with the right permissions... So, the question here is now what the hell is going on? are these different versions of perl? or am i just doing something basic and stupid? for the record (yes, its terrible) i dont have shell access just yet, though i'm working on it... I was asked to do this because of my "new web" skills, and I'm certainly not the appropriate person for things like perl and dbm, though i can read the files and understand them. As a final suggestion, does anyone know how (a script or the like) I could ask the original server people (who are NOT the coders) to do an ASCII dump of this, or would that be out of line? I need to get this into CSV and back into the file so I can reuse it in another db... ugh what a nightmare!

推荐答案

您仍然可以访问原始计算机吗?

Do you still have access to the original machines?

尽管您正在使用DBM文件,但实际功能可能来自几种实现之一,其中一些不兼容.我将使用与创建该文件的Perl相同的Perl转储该文件,然后使用新的Perl重新创建它.

Although you are using a DBM files, that actual functionality can come from one of several implementations, some of which are not compatible. I'd dump the file with the same perl that created it, then recreate it with the new perl.

这篇关于将perl脚本/dbm移到新服务器,然后移出dbm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆