Re: perl question
Scott Hannahs via Fink-devel <[email protected]> Thu, 13 May 2021 14:56:37 -0400
| Newsgroups | gmane.os.apple.fink.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============1272959450171294193==
Content-Type: multipart/alternative;
boundary="Apple-Mail=_43DECD39-5946-4C2C-8B43-40BCDDAE9D64"
--Apple-Mail=_43DECD39-5946-4C2C-8B43-40BCDDAE9D64
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
Dan,
Thanks for pointer. IIR my perl, the loose typing means that the array =
is defined by being used. The code seems to be then asking if there are =
any elements in an array.
sub installed_add_on_packages_list {
# Caches value for future use...
if(! defined(@$installed_add_on_pkgs)) {
my $oldir =3D cwd(); =20
chdir($lib_dir . "/packages/install/") or die "couldn't chdir";
@$installed_add_on_pkgs =3D glob("*");
chdir($oldir);
}
return $installed_add_on_pkgs;
}
If there are elements then it just returns the array of add-on packages. =
If not it then looks in the packages/install directory for a list. So
if(! defined(@$installed_add_on_pkgs)) {
could be rewritten as=20
if(@$installed_add_on_pkgs <=3D0) {
I will see if this works.
-Scott
> On May 13, 2021, at 14:43, Daniel Macks <[email protected]> wrote:
>=20
> The idea "is an array defined" doesn't make sense due to how perl =
handles variables. One could ask "are there any elements in the array" =
or "is a variable a pointer to an array". IIRC this has been an =
ignoreable warning up until recent perl, so nobody's bothered figuring =
out which meaning is intended here to write a patch for emacsen-common =
(or see if there's a newer upstream version that solves it for us).
>=20
> dan
>=20
> =EF=BB=BFOn 5/13/21, 2:17 PM, "Scott Hannahs via Fink-devel" =
<[email protected]> wrote:
>=20
> Hopefully quick question to those more perl savvy!
> I am trying to get emacs to build under Mac OS 11.X Big Sur. And =
it is being surly=E2=80=A6..
> When building emacsen now with Perl 5.30.2 the error is thrown at =
this point:
>=20
> perl -wc generate-install-list
> Can't use 'defined(@array)' (Maybe you should just omit the =
defined()?) at generate-install-list line 24.
>=20
>=20
>=20
>=20
> That line is:
>=20
> if(! defined(@$installed_add_on_pkgs)) {
>=20
>=20
>=20
> I have tried removing =E2=80=9Cdefined", but it doesn=E2=80=99t =
like that operating on an array reference. I tried substituting the =
=E2=80=9Cexists=E2=80=9D function but that isn=E2=80=99t well received =
either. How does one detect that the installed_add_on_pkgs is not =
defined as an array?
>=20
> -Scott
>=20
> _______________________________________________
> Fink-devel mailing list
> [email protected]
> List archive:
> https://sourceforge.net/p/fink/mailman/fink-devel
> Subscription management:
> https://lists.sourceforge.net/lists/listinfo/fink-devel
>=20
>=20
>=20
>=20
> _______________________________________________
> Fink-devel mailing list
> [email protected]
> List archive:
> https://sourceforge.net/p/fink/mailman/fink-devel
> Subscription management:
> https://lists.sourceforge.net/lists/listinfo/fink-devel
--Apple-Mail=_43DECD39-5946-4C2C-8B43-40BCDDAE9D64
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=utf-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" =
class=3D"">Dan,<div class=3D""><br class=3D""></div><div class=3D"">Thanks=
for pointer. IIR my perl, the loose typing means that the array =
is defined by being used. The code seems to be then asking if =
there are any elements in an array.<div class=3D""><br =
class=3D""></div><blockquote style=3D"margin: 0 0 0 40px; border: none; =
padding: 0px;" class=3D""><div class=3D"">sub =
installed_add_on_packages_list {<br class=3D""> # Caches =
value for future use...<br class=3D""><br class=3D""> if(! =
defined(@$installed_add_on_pkgs)) {<br class=3D""> my =
$oldir =3D cwd(); <br class=3D""> =
chdir($lib_dir . "/packages/install/") or die "couldn't =
chdir";<br class=3D""> @$installed_add_on_pkgs =3D =
glob("*");<br class=3D""> chdir($oldir);<br =
class=3D""> }<br class=3D""> return =
$installed_add_on_pkgs;<br class=3D"">}<br =
class=3D""></div></blockquote><div class=3D""><div><br =
class=3D""></div><div>If there are elements then it just returns the =
array of add-on packages. If not it then looks in the =
packages/install directory for a list. So</div></div><blockquote =
style=3D"margin: 0 0 0 40px; border: none; padding: 0px;" class=3D""><div =
class=3D""><div>if(! defined(@$installed_add_on_pkgs)) =
{</div></div></blockquote><div class=3D""><div>could be rewritten =
as </div></div><blockquote style=3D"margin: 0 0 0 40px; border: =
none; padding: 0px;" class=3D""><div =
class=3D""><div>if(@$installed_add_on_pkgs <=3D0) =
{</div></div></blockquote><div class=3D""><div><br class=3D""></div><div>I=
will see if this works.</div><div>-Scott</div><div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On May =
13, 2021, at 14:43, Daniel Macks <<a =
href=3D"mailto:[email protected]" class=3D"">[email protected]</a>>=
wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><div =
class=3D"">The idea "is an array defined" doesn't make sense due to how =
perl handles variables. One could ask "are there any elements in the =
array" or "is a variable a pointer to an array". IIRC this has been an =
ignoreable warning up until recent perl, so nobody's bothered figuring =
out which meaning is intended here to write a patch for emacsen-common =
(or see if there's a newer upstream version that solves it for us).<br =
class=3D""><br class=3D"">dan<br class=3D""><br class=3D"">=EF=BB=BFOn =
5/13/21, 2:17 PM, "Scott Hannahs via Fink-devel" <<a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>> wrote:<br =
class=3D""><br class=3D""> Hopefully quick question to =
those more perl savvy!<br class=3D""> I am trying to =
get emacs to build under Mac OS 11.X Big Sur. And it is being =
surly=E2=80=A6..<br class=3D""> When building emacsen =
now with Perl 5.30.2 the error is thrown at this point:<br class=3D""><br =
class=3D""> perl -wc generate-install-list<br =
class=3D""> Can't use 'defined(@array)' (Maybe you =
should just omit the defined()?) at generate-install-list line 24.<br =
class=3D""><br class=3D""><br class=3D""><br class=3D""><br class=3D""> =
That line is:<br class=3D""><br class=3D""> =
if(! defined(@$installed_add_on_pkgs)) {<br =
class=3D""><br class=3D""><br class=3D""><br class=3D""> =
I have tried removing =E2=80=9Cdefined", but it =
doesn=E2=80=99t like that operating on an array reference. I tried =
substituting the =E2=80=9Cexists=E2=80=9D function but that isn=E2=80=99t =
well received either. How does one detect that the =
installed_add_on_pkgs is not defined as an array?<br class=3D""><br =
class=3D""> -Scott<br class=3D""><br class=3D""> =
_______________________________________________<br =
class=3D""> Fink-devel mailing list<br class=3D""> =
<a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a><br class=3D""> =
List archive:<br class=3D""> <a =
href=3D"https://sourceforge.net/p/fink/mailman/fink-devel" =
class=3D"">https://sourceforge.net/p/fink/mailman/fink-devel</a><br =
class=3D""> Subscription management:<br class=3D""> =
<a =
href=3D"https://lists.sourceforge.net/lists/listinfo/fink-devel" =
class=3D"">https://lists.sourceforge.net/lists/listinfo/fink-devel</a><br =
class=3D""><br class=3D""><br class=3D""><br class=3D""><br =
class=3D"">_______________________________________________<br =
class=3D"">Fink-devel mailing list<br class=3D""><a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a><br class=3D"">List =
archive:<br =
class=3D"">https://sourceforge.net/p/fink/mailman/fink-devel<br =
class=3D"">Subscription management:<br =
class=3D"">https://lists.sourceforge.net/lists/listinfo/fink-devel</div></=
div></blockquote></div><br class=3D""></div></div></body></html>=
--Apple-Mail=_43DECD39-5946-4C2C-8B43-40BCDDAE9D64--
--===============1272959450171294193==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============1272959450171294193==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Fink-devel mailing list
[email protected]
List archive:
https://sourceforge.net/p/fink/mailman/fink-devel
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-devel
--===============1272959450171294193==--