C-TinyCompiler

 view release on metacpan or  search on metacpan

lib/C/TinyCompiler.pm  view on Meta::CPAN

 };

Still not awesome, but at least a little better.

=cut

sub line_number {
	my ($line) = @_;
	# The line needs to be incremented by one for the bookkeeping to work
	$line++;
	# Get the source filename using caller()
	my (undef, $filename) = caller;
	# Escape backslashes:
	$filename =~ s/\\/\\\\/g;
	return "\n#line $line \"$filename\"";
}

=head2 apply_packages

Adds the given packages to this compiler context. The names should be the name
of the Perl package that has the functions expected by the C::TinyCompiler

lib/C/TinyCompiler/package.pm  view on Meta::CPAN


use strict;
use warnings;

sub get_packages {
	my $package_list;
	if (@_ > 0) {
		$package_list = shift;
	}
	else {
		my $hashref = (caller(1))[10];
		$package_list = $hashref->{C_TinyCompiler_packages} if defined $hashref;
	}
	$package_list ||= '';
	return split /[|]/, $package_list;
}

# Args:
#  * $package_name
#  * $compiler_state
#  * @options



( run in 0.562 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )