<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-8012505786049526776.post6340537673287148872..comments</id><updated>2008-09-15T22:58:06.484-07:00</updated><title type='text'>Comments on Christian thoughts in a tech world: Modular tar pipe tar in Perl</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.raphink.info/feeds/6340537673287148872/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default'/><link rel='alternate' type='text/html' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html'/><author><name>Raphaël</name><uri>http://www.blogger.com/profile/10521695166843919067</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8012505786049526776.post-3971616793857997100</id><published>2008-09-15T22:58:00.000-07:00</published><updated>2008-09-15T22:58:00.000-07:00</updated><title type='text'>Hi Tobi,Yes, Perl is obviously overkill for this, ...</title><content type='html'>Hi Tobi,&lt;BR/&gt;&lt;BR/&gt;Yes, Perl is obviously overkill for this, and even in Perl, it would be faster to call this same one-liner with system.&lt;BR/&gt;&lt;BR/&gt;Now the reason I came to this Perl code is because this is only a part of a bigger program (whose goal is to replicate CVS repositories synchronously), and the rest of the program justifies to write it in Perl (it uses a DB, SFTP to write on a distant file over SSH, and other stuff that would be tricky in bash).&lt;BR/&gt;&lt;BR/&gt;Also, I am trying to handle errors in this code. It is not very easy because Net::SSH uses IPC:Open2 or IPC::Open3. IPC::Open2 works fine but doesn&amp;#39;t let you handle errors, whereas IPC::Open3 let&amp;#39;s you handle the stderr of the command, but tends to leak processes. If anyone is familiar with this issue, I&amp;#39;d be happy to know how to deal with this.&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;Peck &amp;gt; this rsync command won&amp;#39;t create the parent directories on the remote side if they don&amp;#39;t exist yet. e.g. &amp;#39;rsync &amp;quot;/path/to/my/dir&amp;quot; &amp;quot;$user@$host:`dirname /path/to/my/dir`&amp;quot;&amp;#39; will fail if /path/to does not exist yet on the remove machine. It simply yields a mkdir &amp;quot;No such file or directory&amp;quot; error. tar|tar works like a charm in this case though. Another reason for not choosing rsync over tar|tar, is that I have to copy tons of little files and I really don&amp;#39;t care to override them completely. It is faster for me to just tar all the files, transfer them and untar, than to calculate the md5 or size of every file and transfer only the diff. Overall, I get pretty nice perfs with tar|tar :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/3971616793857997100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/3971616793857997100'/><link rel='alternate' type='text/html' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html?showComment=1221544680000#c3971616793857997100' title=''/><author><name>Raphaël</name><uri>http://www.blogger.com/profile/10521695166843919067</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08818188603539575845'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html' ref='tag:blogger.com,1999:blog-8012505786049526776.post-6340537673287148872' source='http://www.blogger.com/feeds/8012505786049526776/posts/default/6340537673287148872' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-8012505786049526776.post-2212603168741868594</id><published>2008-09-15T16:39:00.000-07:00</published><updated>2008-09-15T16:39:00.000-07:00</updated><title type='text'>Isn't Perl a bit overkill for this? How about a Ba...</title><content type='html'>Isn&amp;#39;t Perl a bit overkill for this? How about a Bash one-liner:&lt;BR/&gt;&lt;BR/&gt;(cd /path/to/dir &amp;amp;&amp;amp; tar -c *) | ssh myhost.example.org &amp;quot;cd / &amp;amp;&amp;amp; tar -x&amp;quot;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/2212603168741868594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/2212603168741868594'/><link rel='alternate' type='text/html' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html?showComment=1221521940000#c2212603168741868594' title=''/><author><name>Tobi</name><uri>http://www.blogger.com/profile/00514647918635246239</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html' ref='tag:blogger.com,1999:blog-8012505786049526776.post-6340537673287148872' source='http://www.blogger.com/feeds/8012505786049526776/posts/default/6340537673287148872' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-8012505786049526776.post-1154513276690981248</id><published>2008-09-15T10:15:00.000-07:00</published><updated>2008-09-15T10:15:00.000-07:00</updated><title type='text'>rsync "$dir" "$user@$host:`dirname $dir`"But be ca...</title><content type='html'>rsync "$dir" "$user@$host:`dirname $dir`"&lt;BR/&gt;&lt;BR/&gt;But be careful of the trailing / $dir must not end with it.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/1154513276690981248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/1154513276690981248'/><link rel='alternate' type='text/html' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html?showComment=1221498900000#c1154513276690981248' title=''/><author><name>peck</name><uri>http://www.blogger.com/profile/02951712738189365681</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html' ref='tag:blogger.com,1999:blog-8012505786049526776.post-6340537673287148872' source='http://www.blogger.com/feeds/8012505786049526776/posts/default/6340537673287148872' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-8012505786049526776.post-2964561514645932393</id><published>2008-09-15T08:38:00.000-07:00</published><updated>2008-09-15T08:38:00.000-07:00</updated><title type='text'>You're entirely right about the dot files... This ...</title><content type='html'>You&amp;#39;re entirely right about the dot files... This is why I eventually wrote it as &lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;my $tar   = Archive::Tar-&amp;gt;new;&lt;BR/&gt;my @files = File::Find::Rule-&amp;gt;maxdepth(1)&lt;BR/&gt;                            -&amp;gt;in( $dir );&lt;BR/&gt;$tar-&amp;gt;add_files(@files);&lt;BR/&gt;...&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;As for the rsync command... no, it&amp;#39;s not the same, unless you can tell me how to tell rsync to create the parent directories on the remote side. I spent quite some time searching, and nobody could tell me. Rsync is able to recurse into children directories, but not to create parent ones, whereas tar does it perfectly.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/2964561514645932393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/2964561514645932393'/><link rel='alternate' type='text/html' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html?showComment=1221493080000#c2964561514645932393' title=''/><author><name>Raphaël</name><uri>http://www.blogger.com/profile/10521695166843919067</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='08818188603539575845'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html' ref='tag:blogger.com,1999:blog-8012505786049526776.post-6340537673287148872' source='http://www.blogger.com/feeds/8012505786049526776/posts/default/6340537673287148872' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-8012505786049526776.post-732164048731339501</id><published>2008-09-15T08:23:00.000-07:00</published><updated>2008-09-15T08:23:00.000-07:00</updated><title type='text'>With "$dir/*" you miss the dot files.Anyway, isn't...</title><content type='html'>With "$dir/*" you miss the dot files.&lt;BR/&gt;&lt;BR/&gt;Anyway, isn't this calles the rsync command ?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/732164048731339501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8012505786049526776/6340537673287148872/comments/default/732164048731339501'/><link rel='alternate' type='text/html' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html?showComment=1221492180000#c732164048731339501' title=''/><author><name>peck</name><uri>http://www.blogger.com/profile/02951712738189365681</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.raphink.info/2008/09/modular-tar-pipe-tar-in-perl.html' ref='tag:blogger.com,1999:blog-8012505786049526776.post-6340537673287148872' source='http://www.blogger.com/feeds/8012505786049526776/posts/default/6340537673287148872' type='text/html'/></entry></feed>