Newbie question on require and semaphores

G

Gerald Meazell

I'm trying to do some semaphore programming but when I put in the line
'require "ipc.ph"', perl whines that ipc.ph cannot be found in @INC. It
then goes on to list out the @INC directories. Sure enough, ipc.ph
isn't in any of them, but it is in some subdirectories of the ones in
@INC.

I tried copying the files up one level but that did not work due to a
compilation error.

What do I need to do to get this working? I'm using RedHat.

Thanks!
 
M

Matt Garrish

Gerald Meazell said:
I'm trying to do some semaphore programming but when I put in the line
'require "ipc.ph"', perl whines that ipc.ph cannot be found in @INC. It
then goes on to list out the @INC directories. Sure enough, ipc.ph isn't
in any of them, but it is in some subdirectories of the ones in @INC.

I tried copying the files up one level but that did not work due to a
compilation error.

What do I need to do to get this working?

I would imagine specify the path to the file:

use lib '/path/to/header/file';
require 'ipc.ph';

or

require '/path/to/header/file/ipc.ph';

Whatever compilation problems you're having likely have nothing to do with
requiring the ph file, though, and everything to do with the code in that
file. Without a specific error message and code, however, it's hard to say
anything more useful than that.

Matt
 
G

Gerald Meazell

Matt said:
require '/path/to/header/file/ipc.ph';

Whatever compilation problems you're having likely have nothing to do with
requiring the ph file, though, and everything to do with the code in that
file. Without a specific error message and code, however, it's hard to say
anything more useful than that.

Thanks for your help. Since /path/to/header was already in my @INC, I
just specified require "file/ipc.ph" and that did the trick - sort of.
Now it whines that it cannot find "features.ph," mentioned on line 5 of
ipc.ph. This file does not exist on my system leading me to believe
that I must compile or install something in order to create it. Any
ideas what that may be?

Thanks,
 
M

Matt Garrish

Gerald Meazell said:
Thanks for your help. Since /path/to/header was already in my @INC, I
just specified require "file/ipc.ph" and that did the trick - sort of. Now
it whines that it cannot find "features.ph," mentioned on line 5 of
ipc.ph. This file does not exist on my system leading me to believe that
I must compile or install something in order to create it. Any ideas what
that may be?

Sorry, I have no idea what ipc.ph is or where you found it. If this is a
script you downloaded off the web, you should probably start wherever you
found it.

All I can tell you is that the ph extension is normally only used when
converting C header files to perl. If you're trying to port a C program you
probably have to convert features.h as well (see h2ph). If you're using a
program someone else converted then you'll need to find those missing header
files wherever you found this one.

Matt
 
G

Gerald Meazell

Matt said:
Sorry, I have no idea what ipc.ph is or where you found it. If this is a
script you downloaded off the web, you should probably start wherever you
found it.

All I can tell you is that the ph extension is normally only used when
converting C header files to perl. If you're trying to port a C program you
probably have to convert features.h as well (see h2ph). If you're using a
program someone else converted then you'll need to find those missing header
files wherever you found this one.

Remember, I'm a newbie. I didn't download squat. The files where
installed on my computer when I installed RedHat.However, you helped me
by forcing me to realize that h2ph is used to convert C header files to
perl header files so I just converted whatever files it said it was
missing. Thanks!

However, although they now run, the little sample programs I downloaded
off the internet do not run properly so I am still in the dark as to how
to implement semaphores in Perl. Googling "Perl And Semaphore" returns
reams of information but nothing really useful to someone like me.

I'm not doing fancy thread synchronization. I just want one process to
create a semaphore, do its business, and release the semaphore and for a
second process to wait for that semaphore's release before doing it's
business. Is that so difficult?

I guess there's less elegant ways of doing this. For example, I could
have the first process create a file when it's done and the second
process wait around for that file. I suppose that's what I'll end up
doing but I'll hang my head in shame every time I think about it. :)
 
T

Thomas Kratz

Gerald said:
Remember, I'm a newbie. I didn't download squat. The files where
installed on my computer when I installed RedHat.However, you helped me
by forcing me to realize that h2ph is used to convert C header files to
perl header files so I just converted whatever files it said it was
missing. Thanks!

However, although they now run, the little sample programs I downloaded
off the internet do not run properly so I am still in the dark as to how
to implement semaphores in Perl. Googling "Perl And Semaphore" returns
reams of information but nothing really useful to someone like me.

Did you do the obvious and look at:

http://search.cpan.org/search?query=semaphore&mode=all ?

Thomas


--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top