Acme-MITHALDU-XSGrabBag
view release on metacpan or search on metacpan
inc/Inline.pm view on Meta::CPAN
use Inline::denter;
use Config;
use Carp;
use Cwd qw(abs_path cwd);
use File::Spec;
use File::Spec::Unix;
use Fcntl qw(LOCK_EX LOCK_UN);
my %CONFIG = ();
my @DATA_OBJS = ();
my $INIT = 0;
my $version_requested = 0;
my $version_printed = 0;
my $untaint = 0;
my $safemode = 0;
our $languages = undef;
our $did = '_Inline'; # Default Inline Directory
inc/Inline.pm view on Meta::CPAN
$o->{API}{script} = $script;
$o->{API}{language_id} = $language_id;
if ($option =~ /^(FILE|BELOW)$/i or
not $option and
defined $INC{File::Spec::Unix->catfile('Inline','Files.pm')} and
Inline::Files::get_filename($pkg)
) {
$o->read_inline_file;
$o->{CONFIG} = handle_language_config(@config);
}
elsif ($option eq 'DATA' or not $option) {
$o->{CONFIG} = handle_language_config(@config);
push @DATA_OBJS, $o;
return;
}
elsif (uc $option eq uc 'Config') {
$CONFIG{$pkg}{$language_id} = handle_language_config(@config);
return;
}
else {
$o->receive_code($option);
$o->{CONFIG} = handle_language_config(@config);
}
inc/Inline.pm view on Meta::CPAN
\$INIT = \$INIT; # Needed by Sarathy's patch.
sub INIT {
\$INIT++;
&init;
}
END
sub init {
local ($/, $") = ("\n", ' '); local ($\, $,);
while (my $o = shift(@DATA_OBJS)) {
$o->read_DATA;
$o->glue;
}
}
sub END {
warn M51_unused_DATA() if @DATA_OBJS;
print_version() if $version_requested && not $version_printed;
}
#==============================================================================
# Print a small report about the version of Inline
#==============================================================================
sub print_version {
return if $version_printed++;
print STDERR <<END;
inc/Inline.pm view on Meta::CPAN
eval ($nowarn .
'my ($o) = @_;
for my $override (keys %{$o->{OVERRIDDEN}}) {
no strict "refs";
*{$override} = $o->{OVERRIDDEN}{$override};
}
delete $o->{OVERRIDDEN};')
}
#==============================================================================
# Get source from the DATA filehandle
#==============================================================================
my (%DATA, %DATA_read);
sub read_DATA {
require Socket;
my ($marker, $marker_tag);
my $o = shift;
my ($pkg, $language_id) = @{$o->{API}}{qw(pkg language_id)};
unless ($DATA_read{$pkg}++) {
no strict 'refs';
*Inline::DATA = *{$pkg . '::DATA'};
local ($/);
my ($CR, $LF) = (&Socket::CR, &Socket::LF);
(my $data = <Inline::DATA>) =~ s/$CR?$LF/\n/g;
@{$DATA{$pkg}} = split /(?m)^[ \t]{0,}(__\S+?__\n)/, $data;
shift @{$DATA{$pkg}} unless ($ {$DATA{$pkg}}[0] || '') =~ /__\S+?__\n/;
}
($marker, $o->{API}{code}) = splice @{$DATA{$pkg}}, 0, 2;
croak M08_no_DATA_source_code($language_id)
unless defined $marker;
($marker_tag = $marker) =~ s/__(\S+?)__\n/$1/;
croak M09_marker_mismatch($marker, $language_id)
unless $marker_tag eq $language_id;
}
#==============================================================================
# Validate and store the non language-specific config options
#==============================================================================
sub check_config {
inc/Inline.pm view on Meta::CPAN
END
}
sub M02_usage {
my $usage = <<END;
Invalid usage of Inline module. Valid usages are:
use Inline;
use Inline language => "source-string", config-pair-list;
use Inline language => "source-file", config-pair-list;
use Inline language => [source-line-list], config-pair-list;
use Inline language => 'DATA', config-pair-list;
use Inline language => 'Config', config-pair-list;
use Inline Config => config-pair-list;
use Inline with => module-list;
use Inline shortcut-list;
END
# This is broken ????????????????????????????????????????????????????
$usage .= <<END if defined $Inline::languages;
Supported languages:
${\ join(', ', sort keys %$Inline::languages)}
inc/Inline.pm view on Meta::CPAN
sub M07_code_file_does_not_exist {
my ($file) = @_;
return <<END;
Inline assumes '$file' is a filename,
and that file does not exist.
END
}
sub M08_no_DATA_source_code {
my ($lang) = @_;
return <<END;
No source code in DATA section for Inline '$lang' section.
END
}
sub M09_marker_mismatch {
my ($marker, $lang) = @_;
return <<END;
Marker '$marker' does not match Inline '$lang' section.
END
inc/Inline.pm view on Meta::CPAN
but without specifying the DIRECTORY option. This is potentially unsafe.
Either use the DIRECTORY option or turn off SAFEMODE.
END
($terminate ? <<END : "");
Since you are running as a privileged user, Inline.pm is terminating.
END
}
sub M51_unused_DATA {
return <<END;
One or more DATA sections were not processed by Inline.
END
}
sub M52_invalid_filter {
my ($filter) = @_;
return <<END;
Invalid filter '$filter' is not a reference.
END
( run in 1.050 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )