Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Running a C Program within Perl.

by Sniper (Scribe)
on Dec 27, 2001 at 20:56 UTC ( #134638=note: print w/replies, xml ) Need Help??


in reply to Running a C Program within Perl.

You could use Inline.pm by Brian "Ingy" Ingerson

examples : http://www.perl.com/pub/a/2001/02/inline.html
module : http://www.cpan.org/modules/by-module/Inline/

use Inline C => <<'END_C'; void greet() { printf("Hello, world\n"); } END_C greet;

Simply run this script from the command line and it will print (you guessed it):

Hello, world

David "Sniper" Rigaudiere

Replies are listed 'Best First'.
Re: Re: Running a C Program within Perl.
by basicdez (Pilgrim) on Dec 27, 2001 at 21:34 UTC
    I am trying to run an external C program. I can run it fine from any Unix prompt, but when I put it into a perl program I get a long winded error, ending with "Directory" is not an identifier. Please help me I am very distraught.
      Please, post a piece of code :-)

      David "Sniper" Rigaudiere

        I can run this at the prompt, but putting in the following, /opt/BIPSConnect/bin/rdes, but when I put it in perl code (here is what I am trying to do - Quite simple and nothing complex, until I get this working) ...
        #!/usr/bin/perl-Tw use strict; my $cmd_to_run = "/opt/BIPSConnect/bin/rdes"; my @results = `$cmd_to_run`;
        I get the following error...
        /opt/BIPSConnect/bin/rdes: LD_LIBRARY_PATH=:/usr/lib:/usr/ucblib:/usr/ +openwin/lib:/usr/dt/lib:/usr/local/lib:/opt/hpnpl/lib:/p01cfg0 1/harvest/Harvest/lib:/opt/BIPSConnect/bin: is not an identifier
        I am most baffled and confused, please help me if you can.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://134638]
help
Chatterbox?
[Corion]: I hope you had a good weekend!
[marto]: jetlag has really done a number on the kids, it's been a tough week
choroba played with the band on Saturday, so Sunday was very sleepy
[choroba]: managed to release Syntax::Construct with 5.28 support in the night, though
[Corion]: choroba: Whee ;)
[Corion]: marto: Ouch - I would've thought that kids adapt much better, but that's obviously not the case...
[marto]: well, their mother let them sleep till 15:00 & 12:00 last week, which didn't help them adjust :P
[Corion]: I was "productive" over the weekend in the sense that I revived my old "Perlmonks on SQLite" code, which likely means I can get a test instance back up running on my webhost. Small steps :)
[Corion]: marto: Ow, no, that doesn't help at all :)
[choroba]: Related to the new release, anyone could explain this or this tester report?

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2018-06-25 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?