http://www.perlmonks.org?node_id=408381

sanju_631 has asked for the wisdom of the Perl Monks concerning the following question:

Hi ! I have problems using ioctl in perl on linux platform. i have written a perl script
.........test.pl....... #!/usr/bin/perl require 'sys/ioctl.ph' .......... this itself on running is giving error # ./test.pl Scalar found where operator expected at (eval 273) line 1, near "'int' + $__val" (Missing operator before $__val?) #
the sys/ioctl.ph file is located in
/usr/lib/perl5/vendor_perl/5.8.3/ppc-linux-thread-multi on my system .
@INC contains: /usr/lib/perl5/5.8.3/ppc-linux-thread-multi /usr/lib/perl5/5.8.3 /usr/lib/perl5/site_perl/5.8.3/ppc-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.3/ppc-linux-thread-multi ********** /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl

stars in abouve shows that sys/ioctl.ph is in proper path to be included by require command. But even then why i m getting error shown above???
Please reply soon..
Thanks..
Sanju

Replies are listed 'Best First'.
Re: How to use ioctl in perl
by osunderdog (Deacon) on Nov 17, 2004 at 14:26 UTC

    Uh, perhaps a little background would be helpful Before you post...


    "Look, Shiny Things!" is not a better business strategy than compatibility and reuse.


    OSUnderdog
      Hi osunderdog!
      I does not have any knowledge about ioctl calls in perl . So please help me out by giving solution to this .
      thanks.....
Re: How to use ioctl in perl
by osunderdog (Deacon) on Nov 17, 2004 at 20:16 UTC

    Ah. The light bulb went off. I haven't seen the .ph extension before. It's an output from the command h2ph

    Here is a snipped from the man on h2ph.

    h2ph converts any C header files specified to the corresponding Perl header file format. It is most easily run while in /usr/includ +e: cd /usr/include; h2ph * sys/* or cd /usr/include; h2ph * sys/* arpa/* netinet/* or cd /usr/include; h2ph -r -l . The output files are placed in the hierarchy rooted at Perl's a +rchitec- ture dependent library directory. You can specify a different +hierar- chy with a -d switch. If run with no arguments, filters standard input to standard ou +tput.

    I haven't used h2ph before. This probably hasn't been run on your perl install so that's why file you are trying to require is missing. So you'll need to run this command on the headers that you're interested in using. Pretty low level stuff.

    Again, a description of what you are trying to do would probably net you more feedback on Perlmonks.


    "Look, Shiny Things!" is not a better business strategy than compatibility and reuse.


    OSUnderdog
Re: How to use ioctl in perl
by PodMaster (Abbot) on Nov 17, 2004 at 20:06 UTC
    If ioctl.ph is generating that error, you're going to have to provide a copy of it. ".ph" files are generated either by "c2ph" or "h2ph". If c2ph or h2ph made a mistake when converting your ioctl.h (I'm guessing its ioctl.h), and your ioctl.h is not broken, then you should also provide a copy of it.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: How to use ioctl in perl
by sanju_631 (Initiate) on Nov 17, 2004 at 16:54 UTC
    Please ignore mising semicolon after require . it is just a mistake in copying code.
    error is coming in code with proper semicolons .
Re: How to use ioctl in perl
by Zaxo (Archbishop) on Nov 19, 2004 at 07:49 UTC

    I posted a handmade substitute for ioctl.ph at Linux ioctl command module. It is a close transcription of Linux 2.4 ioctl.h in perl.

    After Compline,
    Zaxo