++ed by:
JETEVE ASHLEY EMAZEP NWELLNHOF CKRAS
6 non-PAUSE users
Author image Marvin Humphrey
and 1 contributors

NAME

Clownfish::Util - Miscellaneous helper functions.

DESCRIPTION

Clownfish::Util provides a few convenience functions used internally by other Clownfish modules.

FUNCTIONS

slurp_text

    my $foo_contents = slurp_text('foo.txt');

Open a file, read it in (as text), return its contents.

current

    compile('foo.c') unless current( 'foo.c', 'foo.o' );

Given two elements, which may be either scalars or arrays, verify that everything in the second group exists and was created later than anything in the first group.

verify_args

    verify_args( \%defaults, @_ ) or confess $@;

Verify that named parameters exist in a defaults hash. Returns false and sets $@ if a problem is detected.

strip_c_comments

    my $c_minus_comments = strip_c_comments($c_source_code);

Quick 'n' dirty stripping of C comments. Will massacre stuff like comments embedded in string literals, so watch out.

write_if_changed

    write_if_changed( $path, $content );

Test whether there's a file at $path which already matches $content exactly. If something has changed, write the file. Otherwise do nothing (and avoid bumping the file's modification time).