Apache2-SSI
view release on metacpan or search on metacpan
lib/Apache2/SSI.pm view on Meta::CPAN
my $self = shift( @_ );
my $word = shift( @_ );
return( 0 ) if( !length( $word ) );
return( $word =~ /^(?:$RE{num}{int}|$RE{num}{real})$/ ? 1 : 0 );
}
sub _is_perl_script
{
my $self = shift( @_ );
my $file = shift( @_ );
return( $self->error( "No file was provided to check if it looks like a perl script." ) ) if( !length( "$file" ) );
if( -T( "$file" ) )
{
my $io = IO::File->new( "<$file" ) || return( $self->error( "Unable to open file \"$file\" in read mode: $!" ) );
my $shebang = $io->getline;
chomp( $shebang );
$io->close;
# We explicitly return 1 or 0, because otherwise upon failure perl would return undef which we reserve for errors
return( $shebang =~ /^\#\!(.*?)\bperl\b/i ? 1 : 0 );
}
return( 0 );
lib/Apache2/SSI/SharedMem.pod view on Meta::CPAN
}
If you do not provide any buffer, you can call L</read> like this and it will return you the shared memory content:
my $buffer;
if( !defined( $buffer = $s->read ) )
{
die( $s->error );
}
The content is stored in shared memory as L<JSON> encoded, but since it is shared, L<read> do some minimal check to see if the data looks like JSON data. It it does not, the data is returned as-is.
=head2 remove
Remove entire the shared memory identified with L</key>
=head2 removed
Returns true if the shared memory was removed, false otherwise.
=head2 semid
( run in 0.444 second using v1.01-cache-2.11-cpan-64827b87656 )