Why aren't more C programs embedding Perl?

I know there is a way to call Perl routines from C. As shown here http://search.cpan.org/dist/perl/pod/perlcall.pod#NAME

But still, I don't see widespread use of this by C programmers. Has anyone used this ... ever? or any idea what are the reasons why it is not used so much?

+2


source to share


6 answers


Well, the most famous example of Perl implementation of a program is Apache and mod_perl , which allows people to access the Apache API through Perl.



You probably don't see a lot of programs embedding perl because they don't need it as a function. Why aren't more C programs sending email? :)

+10


source


This is usually done in reverse order. That is, the scripting language coordinates things and the C program does the processing. The idea is that the code that coordinates is easy to modify, and the code that does the processing is fast.



What needs to be done is probably to spawn the perl interpreter through a "system" call from C to do something. Probably not exactly what you mean, though.

+6


source


There are two reasons why a perl function can be called from C: extension and nesting.

In the first case, this is not so rare, but it is quite invisible to outsiders.

I think your question is actually "why don't people insert perl more often?" There are a number of reasons for this: it is much more complicated than it should be, it is the most important IMHO (see perlcall , perlembed , perlguts and perlapi ).

+3


source


Why would I slow down my C program by calling Perl? And I say this as a confirmed Perler . Now, moving to C from Perl, it makes sense (if you need some extra speed).

When a person develops in C, it is because they want to trade development time for speed.

When someone develops into Perl, it is because they want to trade execution speed for design time.

+3


source


One of the situations where this is used is in the architecture of a plug-in or script. For example, the irssi IRC client is written in C but supports scripting with Perl .

In my experience, however, creating an irssi with Perl enabled is troublesome and prone to crashing. I have had instances where the program was not built at all with Perl bindings enabled (some compilation or communication failure), and also where the program would compile but immediately run with a runtime error when launched. These problems may explain why it's not very popular: calling one language from another is almost never as easy as it is in .Net.

+2


source


Many programmers know how to obfuscate C effectively without resorting to Perl.

-1


source







All Articles