in reply to Re^3: manipulating cpio archive
in thread manipulating cpio archive

It looks the same to me. The entry I want to skip is there.

Replies are listed 'Best First'.
Re^5: manipulating cpio archive
by Corion (Patriarch) on Jan 17, 2011 at 19:34 UTC

    Well, Perl doesn't think so. Maybe it has whitespace at the end of the archive name? Maybe post the actual output of Data::Dumper?

    Interestingly enough, Archive::Cpio contains no call to binmode. I'm not sure whether it will work on Windows at all.

      OK, you asked for it (no sarcasm intended):
      $VAR1 = bless( { 'list' => [ bless( { 'mode' => 16877, 'nlink' => 2, 'ino' => 63796, 'rdev' => 0, 'dev' => 2056, 'uid' => 1000, 'mtime' => 1295288664, 'name' => '.', 'data' => undef, 'gid' => 1000 }, 'Archive::Cpio::File' ), bless( { 'mode' => 33188, 'nlink' => 1, 'ino' => 63800, 'rdev' => 0, 'dev' => 2056, 'uid' => 1000, 'mtime' => 1295288664, 'name' => 't2', 'data' => undef, 'gid' => 1000 }, 'Archive::Cpio::File' ), bless( { 'mode' => 33188, 'nlink' => 1, 'ino' => 63799, 'rdev' => 0, 'dev' => 2056, 'uid' => 1000, 'mtime' => 1295288664, 'name' => 't1', 'data' => undef, 'gid' => 1000 }, 'Archive::Cpio::File' ), bless( { 'mode' => 33188, 'nlink' => 1, 'ino' => 63801, 'rdev' => 0, 'dev' => 2056, 'uid' => 1000, 'mtime' => 1295288664, 'name' => 't3', 'data' => undef, 'gid' => 1000 }, 'Archive::Cpio::File' ) ], 'archive_format' => bless( { 'magic' => 29127 }, 'Archive::Cpio::OldBina +ry' ) }, 'Archive::Cpio' );

        I would asume that this is a bug in Archive::Cpio. The ->remove subroutine treats $archive->{list} as an array of strings (as do the examples), but it contains Archive::Cpio::File objects that don't seem to have stringification overload.

        You'll likely need to rewrite the ->remove method to actually remove elements by their ->name (and raise a bug against the module, please).

        The test suite only tests that the (main) module can be loaded and tests no functionality at all, so adding a test for ->remove wouldn't hurt either.