Guillem Jover <guil...@debian.org> writes: > Hi!
Hello, [...] > I agree that the ->new interface for Dpkg::Control::Info is annoying > and inconsistent with the other classes in the library, and should be > fixed at least out of consistency. > > So I'm going to fix this in two ways. One to add support to that > constructor (and the Dpkg::Substvar one) to take either a scalar or a > hash as argument. And if the hash has a filename => undef, then it will > not load the file. Probably deprecate the sclar form in the future. > > And by changing Dpkg::Interface::Storable's load()/save() to allow > passing an IO handle to the method, so that one can do something like: > > my $ci = Dpkg::Control::Info->new($fh); > $ci->load($fh); > > Does this sound good? Yes, but to be sure, let me summarise, with your proposition I could either: - pass an IO::Handle to the new constructor: #+begin_src perl use Git::Repository; my $repo = Git::Repository->new(work_tree => '/some/where'); my $control_ref = $self->dist_branch . ':debian/control'; my $control_fh = $repo->command(show => $control_ref)->stdout; my $control = Dpkg::Control::Info->new($control_fh); #+end_src - Pass “{filename => undef}” to the new constructor and then pass the IO::Handle to “load()”: #+begin_src perl use Git::Repository; my $control = Dpkg::Control::Info->new({filename => undef}); my $repo = Git::Repository->new(work_tree => '/some/where'); my $control_ref = $self->dist_branch . ':debian/control'; my $control_fh = $repo->command(show => $control_ref)->stdout; $control->load($control_fh); #+end_src Maybe it miss the “pass a filename string” to the constructor and “load()” for compatibility, since this method automatically use Dpkg::Compression::FileHandle? Thanks. -- Daniel Dehennin Récupérer ma clef GPG: gpg --recv-keys 0xCC1E9E5B7A6FE2DF Fingerprint: 3E69 014E 5C23 50E8 9ED6 2AAD CC1E 9E5B 7A6F E2DF
signature.asc
Description: PGP signature