Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

The complete story is more complicated,

by thoglette (Scribe)
on Sep 06, 2006 at 02:34 UTC ( [id://571362]=note: print w/replies, xml ) Need Help??


in reply to Re: RunTime & compile Time Doubt on Perl
in thread RunTime & compile Time Doubt on Perl

The complete story is more complicated still, as perl is able to dynamically link to "Perl" libraries compiled from other languages, including C and C++.

But this is an aside. The problem in Perl is that certain operations can only be parsed completely in the run-time context.

Consider the following, for which C has no analog (buffer overflows notwithstanding).

my $str = $ARGV[0]; eval("use $str;");
Now, some theorists will complain bitterly that this must slow your code down, but this is usually the least of your problems. (See Optimising Perl.. for example)

Thog.

--
Dorothy Sayers is still correct.

Replies are listed 'Best First'.
Re: The complete story is more complicated,
by kscaldef (Pilgrim) on Dec 29, 2006 at 19:03 UTC
    "Consider the following, for which C has no analog"

    In that particular case, dlopen does provide an analog. In fact, sufficiently devious use of system() and dlopen() and friends can do what eval does. (Not that I would recommend this.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://571362]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-19 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found