Re: Missing @INC path for pkg-perl-autopkgtest
Alex Muntada <[email protected]> Sat, 25 Oct 2025 22:29:48 +0200
| Newsgroups | gmane.linux.debian.devel.perl |
|---|---|
| Message-ID | <aP0zPN-Hoew6XMoj@ix> |
--w9xf4OFRb+DdGA9n
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi Roland,
I can't really comment on the autopkgtest issue, but I'd like to
explain how to avoid collisions on filehandle E:
> +sub readandsetenv {
> + my $file =3D "debian/tests/pkg-perl/syntax-env";
> + -r $file or return ();
Either you add this before calling open:
```
local *E;
```
> + open (E, '<', $file)
> + or BAIL_OUT("$file exists but can't be read");
> + while (<E>) {
> + chomp;
> + if (/^(.+)=3D(.*)$/) {
> + $ENV{$1} =3D $2;
> + } else {
> + BAIL_OUT("syntax error in $file: $_");
> + }
> + }
> + close E;
> +}
Or replace E with a scalar filehandle (e.g. $env_fd) previously
declared with my or straight into the open call:
```
open (my $env_fd, '<', $file)
# ...
while (<$env_fd>) {
# ...
close $env_fd;
```
You could even avoid calling close because both *E and $env_fd
will be bound to the scope of readandsetenv sub, and the
filehandle will be closed when leaving that scope.
Cheers and sorry for nitpicking,
Alex
--
=E2=A2=80=E2=A3=B4=E2=A0=BE=E2=A0=BB=E2=A2=B6=E2=A3=A6=E2=A0=80
=E2=A3=BE=E2=A0=81=E2=A2=A0=E2=A0=92=E2=A0=80=E2=A3=BF=E2=A1=81 Alex Mu=
ntada <[email protected]>
=E2=A2=BF=E2=A1=84=E2=A0=98=E2=A0=B7=E2=A0=9A=E2=A0=8B Debian Developer=
=F0=9F=8D=A5 log.alexm.org
=E2=A0=88=E2=A0=B3=E2=A3=84=E2=A0=80=E2=A0=80=E2=A0=80=E2=A0=80
--w9xf4OFRb+DdGA9n
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEaUBwKsbetWW2SKTt466XjoNOXn4FAmj9MzQACgkQ466XjoNO
Xn7YSBAAqRC+FLLWSwuZQnD7uCRISYDGb4L04q98UpzT8U0RTNQCW38taSbWEGib
jN8SGBGz6tQFy/VHkwzm6SFTtnMoVB8817wy2LmcX/+Lw6jeMe8cxZWIPgZPIhur
60qtKql3UYeiAFIMSx/wEA7+X6ZseJZD22/gW257A/c1wX4gVyvctqCTc/VheRZd
v2r5Y6vBbG1MEfecCUxvdAYiV0fMXYgHyeB++xtjEEFRA2708sF+hVQQJRCZG5Ts
jJE6lTVY9ym3o9ibMZUbNkQ7f2peNU4hbWlLuMYX0vXgwlGSI4PXpp80EeipETxO
CcVXiq7s1ZiWyW99mj7ryucjrwsL6nMvjHbTUrJY2hzlJMI5N7FxVclufh/wBVZh
IVZuRGO4MEbgUglmFlct+78V/Jkm3Hn5bdUf4YIvzW5MJqcQn06/Dc3mmqe61la+
71d02ahVHki9NaF9jZ0ictYLAJ+oKx2ga0hEr5zQrbZO4NOPPdaqPxdX3ry/S0jz
DWmg74l7YHKqgdYmDA1pstZtutUUaNJI69IOV0cunxsvPmzqd4IHDhIja46ofILD
Er6X8DVXF4BhWQ4YDT71c3SaqgelQXdRHKMcuF3g7WsXnOYGjebBXgFoW4n9RVIb
ems9zX6k89eX3PfnxOZi28NgMta7RyI5PdVj4r/YiDGzRwvcYZo=
=ybiS
-----END PGP SIGNATURE-----
--w9xf4OFRb+DdGA9n--