Subject: perl and h2ph
To: None <>
From: Andrew Brown <>
List: tech-pkg
Date: 06/15/2001 11:39:48
in perlfaq8, the question "How do I get the screen size?" is answered
along with a small piece of code that demonstrates how to do it.

           require 'sys/';
           die "no TIOCGWINSZ " unless defined &TIOCGWINSZ;
           open(TTY, "+</dev/tty")                     or die "No tty: $!";
           unless (ioctl(TTY, &TIOCGWINSZ, $winsize='')) {
               die sprintf "$0: ioctl TIOCGWINSZ (%08x: $!)\n", &TIOCGWINSZ;
           ($row, $col, $xpixel, $ypixel) = unpack('S4', $winsize);
           print "(row,col) = ($row,$col)";
           print "  (xpixel,ypixel) = ($xpixel,$ypixel)" if $xpixel || $ypixel;
           print "\n";

of course, this bombs out with the message

Can't locate sys/ in @INC (did you run h2ph?) (@INC contains: /usr/pkg/lib/perl5/5.6.0/i386-netbsd /usr/pkg/lib/perl5/5.6.0 /usr/pkg/lib/perl5/site_perl/5.6.0/i386-netbsd /usr/pkg/lib/perl5/site_perl/5.6.0 /usr/pkg/lib/perl5/site_perl .) at line 1.

which i've seem many times before.  what i usually do in situations
like this is

           # cd /usr/include
           # h2ph `find . -type f`

and then all is well.  except now, with pkgsrc involved, i've got a
bazillion files installed that aren't tracked properly.  is this why
h2ph isn't run automagically for me?  how hard would it be to have a
post-install target (or something like that) that ran h2ph, took the
output, and merged it into the PLIST?

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."