http://qs321.pair.com?node_id=99001


in reply to Re: Extracting System Info
in thread Extracting System Info

The machine is a standard Intel Pentium PC. The section of /proc/pci I am interested in, looks like this:-
Bus 0, device 15, function 0 Unknown class: Unknown vendor Unknown device (rev 1). Vendor id=135a. Device id=61. Medium devsel. Fast back-to-back capable. IRQ 9 Non-prefetchable 32 bit memory at 0x412000000 I/O at 0x2080 I/O at 0x2400 I/O at 0x2410 Blah.. Blah..
I am interested in seeking out devices with this vendor and device id and then getting just the I/O entires (just 2nd and 3rd though, not interested in the first. I tried the posted example but got:
Name "main::DATA" used only once: possible type at line 6 readline() on closed filehandle main::DATA at line 6..
Ahhh...

Replies are listed 'Best First'.
Re:(3) Extracting System Info
by Cirollo (Friar) on Jul 23, 2001 at 17:30 UTC
    The stuff that he put after the __END__ line gets read into the filehandle called DATA. So, what you want to do is open up /proc/pci yourself (since you won't have the data embedded in your script.)

    Try putting this line before the while loop:
    open(DATA, '/proc/pci') or die "Can't open /proc/pci: $!";