Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Dec 1998 21:42:40 -0600 (CST)
From:      Steve Price <sprice@hiwaay.net>
To:        John Baldwin <jobaldwi@vt.edu>
Cc:        freebsd-ports@FreeBSD.ORG
Subject:   Re: make index breaks at top level
Message-ID:  <Pine.OSF.4.02.9812142120340.4529-100000@fly.HiWAAY.net>
In-Reply-To: <XFMail.981214221708.jobaldwi@vt.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 14 Dec 1998, John Baldwin wrote:

# Actually, it didn't like the "my $name"  lines so I just replaced
# 
#      my $name = shift;
# 
# with
# 
#      $name = shift;

Ick.  I didn't know 'my' was a version 5 only thing. :(

# I still ended up with two errors afterwards, though:
# 
# # perl -c make_index
# syntax error in file make_index at line 33, next 2 tokens "->"
# syntax error in file make_index at line 38, next 2 tokens "@$pkg"
# make_index had compilation errors.

You will definitely have to use version 5 to fix these.
 
# - From the offending code lines, it would seem that they are
# trying to treat pkg as an array of structs instead of a struct
# as it is treated elsewhere.  I'm not Perl literate, though, so

Actually it is a hash of hashes and they are all being treated
the same. :)

# that is just a guess.  I suppose Perl5 let's you get away with
# stuff 4 didn't?

Yep, version 5 let's you do a lot more obfuscated tricks that
version 4 didn't.

# Another fix might be to have ports/makefile use
# perl5 to run the script instead of perl, but then you are requiring
# users prior to 3.x to install a port so they can use the ports.
# Thanks for responding though.

Actually this (index) is not intended as a target for general
consumption.  It is there so that we can easily create a new INDEX.
You can use it if you like, but if you do I'd suggest you install
the lasted version of perl from the ports tree.

# BTW, can somebody please tell me what the "my $<varname>" does
# anyway? (i.e. will it break if it is taken out or is it simply
# an optimization).

You can usually safely replace 'my' with 'local'.  And yes it is
an optimization of sorts.  Without going into great detail, 'my'
variables are lexically scoped and 'local' are dynamically scoped.
For example, if I have two routines foo and bar like this:

sub foo {
    my $foo1;    # only defined within foo
    local $foo2; # defined within foo and any routines it calls
    bar();
}
sub bar {
    # $foo1 is not visible here
    # but $foo2 is
}

So it is a little faster and a little safer to use 'my'.

-steve

# - ---
# 
# John Baldwin <jobaldwi@vt.edu> -- http://members.freedomnet.com/~jbaldwin/
# PGP Key: http://members.freedomnet.com/~jbaldwin/pgpkey.asc
# 
# ICna tpyr 100w rods pdr munuiet~!!1
# 
# 
# -----BEGIN PGP SIGNATURE-----
# Version: 2.6.2
# 
# iQB1AwUBNnXUPIjYza302vYpAQGIIgL+MXBGDJkyfG/VTGHr/DEamlF7nL/jKaR1
# qxK3qeCx446iPEFVQBqnpFmXm5q8cyGXaIsuE/WUdlLIhuy6R/3kDEwqUa6eG7l/
# Ql1wsghM3xfecEhcx2JNg0TmECMOslwg
# =/vk2
# -----END PGP SIGNATURE-----
# 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.4.02.9812142120340.4529-100000>