Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Inline::PERL

by jmcnamara (Monsignor)
on May 31, 2001 at 20:25 UTC ( #84638=sourcecode: print w/ replies, xml ) Need Help??

Category: Miscellaneous
Author/Contact Info jmcnamara
Description: Inline::PERL - Bring the power of PERL programming to your Perl programs.
package Inline::PERL;


######################################################################
+#######
#
# Inline::PERL - Bring the power of PERL programming to your Perl prog
+rams.
#
# John McNamara, jmcnamara@cpan.org
#
# Documentation after __END__
#

$VERSION = '0.01';
require Inline;
@ISA = qw(Inline);
use strict;
use Carp;

sub register {
    return {
        language => 'PERL',
        aliases  => ['PEARL', 'CGI'],
        type     => 'interpreted',
        suffix   => 'PL',
       };
}

sub build {
    my $o = shift;
    my $code = $o->{API}{code};

    if ($code =~ /strict/) {
    carp 'Your code contains "use strict;". Please be aware that '.
          'this may provide you with too much of a clue.';
    }

    sleep 1; # imitate compile delay
    {
    package PERL::Tester;
    eval $code;
    }

    croak "PERL build failed:\n$@" if $@;
    my $path = "$o->{API}{install_lib}/auto/$o->{API}{modpname}";
    my $obj = $o->{API}{location};
    $o->mkpath($path) unless -d $path;
    open PERL_OBJ, "> $obj" or croak "Can't open $obj for output\n$!";
    print PERL_OBJ $code;
    close \*PERL_OBJ;
}

sub load {
    my $o = shift;
    my $obj = $o->{API}{location};
    open PERL_OBJ, "< $obj" or croak "Can't open $obj for output\n$!";
    my $code = join '', <PERL_OBJ>;
    close \*PERL_OBJ;
    eval "package $o->{API}{pkg};\n$code";
    croak "Unable to load PERL module $obj:\n$@" if $@;
}

sub validate {
    my $o = shift;
    # Place holder
}

sub info {
    my $o = shift;
    # Place holder
}

1;

__END__


=head1 NAME

Inline::PERL - Bring the power of PERL programming to your Perl progra
+ms.


=head1 SYNOPSIS

    use Inline::Files;
    use Inline PERL;


    greeting("PERL");


    __PERL__
    sub greeting {

        $foo = shift @_ || $_[0];

        $! = 1; # Turn buffering off

        for ($i=1, $i<=10, $i++) {
            @a[$i] = $i;
        }

        local $length = @a.length;

        print "Hello, $foo\n";
    }


=head1 DESCRIPTION

Inline::PERL gives you the power of the PERL programming language from
within your Perl programs. This gives you instant access to hundreds
of pre-coded applications such as bulletin boards, hit counters and
shopping carts.

PERL is a programming language for writing CGI applications. It's main
strength is that it doesn't have any unnecessary warnings or
strictures. It is a direct descendent of Perl, a programming language
which was used mainly by programmers. However, the original language
required too much reading and thinking and so PERL was developed as a
language which was more in tune with the requirements of the Internet
age.


=head1 PERL DOCUMENTATION

Unfortunately there is no documentation for PERL (believe me I've
looked everywhere). Therefore, the best thing to do is to go straight
to comp.lang.perl.misc and ask your questions there.


=head1 PERFORMANCE

Your Inline::PERL program will run slowly the first few times that you
run it. After that you will get used to it.


=head1 AUTHOR

John McNamara jmcnamara@cpan.org

When I set out to write this I discovered that everything that I
needed was already in the Inline::Foo module. Curse you, Brian
Ingerson, you are making life *too* easy.

My apologies to Brian, the Inline community and, er, the PERL communit
+y.


=head1 COPYRIGHT

 MMI, John McNamara.

All Rights Reserved. This module is free software. It may be used,
redistributed and/or modified under the same terms as Perl itself.


Comment on Inline::PERL
Download Code

Back to Code Catacombs

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2014-12-19 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (75 votes), past polls