App-ZofCMS-PluginBundle-Naughty

 view release on metacpan or  search on metacpan

lib/App/ZofCMS/Plugin/Captcha.pm  view on Meta::CPAN


    if ( $conf->{particle} ) {
        $image->particle( ref $conf->{particle} ? @{ $conf->{particle} } : () );
    }

    my ( $image_data, $mime_type, $random_number ) = $image->out( force => $conf->{format} );
    $t->{d}{session}{captcha} = $random_number;

    if ( defined $conf->{file} and length $conf->{file} ) {
        if ( open my $fh, '>', $conf->{file} ) {
            binmode $fh;
            print $fh $image_data;
            close $fh;
        }
        else {
            $t->{t}{plug_captcha_error} = $!;
            return;
        }
    }
    else {
        binmode STDOUT;
        print "Content-Type: image/$mime_type\n\n";
        print $image_data;
        exit
            unless $conf->{no_exit};
    }
}

1;
__END__

lib/App/ZofCMS/Plugin/ImageGallery.pm  view on Meta::CPAN

                    $cgi->cgi_error ? ': ' . $cgi->cgi_error : ''
                )
            );
            $t->param( success => 1 );
            return;
        };

    open my $fh_out, '>', $photo_file
        or do { $t->param( error => "Failed to create local file [$!]" ); return; };

    binmode $fh_out;

    {
        local $/ = \102400;
        while (<$fh>) {
            print $fh_out $_;
        }
    }
    close $fh_out;
    close $fh;

lib/App/ZofCMS/Plugin/ImageGallery.pm  view on Meta::CPAN

        my $gd = $thumb->resize( @{ $conf->{thumb_size} } );

        open my $fh_thumb, '>', $thumb_file
            or $t->param( error => "Failed to create thumbnail [$!]" )
                and return;

        my $img_type = substr $ext, 1;
        $img_type = 'jpeg'
            unless $img_type eq 'png' or $img_type eq 'gif';

        binmode $fh_thumb;
        print $fh_thumb $gd->$img_type();
        close $fh_thumb;
    }
    else {
        copy $photo_file, $thumb_file;
    }

    if ( ref $conf->{photo_size} eq 'ARRAY'
        or ( ref $conf->{photo_size} eq 'HASH'
            and ( (%{ $conf->{photo_size} })[0] < $x

lib/App/ZofCMS/Plugin/ImageGallery.pm  view on Meta::CPAN

        my $gd = $photo->resize( @{ $conf->{photo_size} } );

        open my $fh_photo, '>', $photo_file
            or $t->param( error => "Failed to resize photo [$!]" )
                and return;

        my $img_type = substr $ext, 1;
        $img_type = 'jpeg'
            unless $img_type eq 'png' or $img_type eq 'gif';

        binmode $fh_photo;
        print $fh_photo $gd->$img_type();
        close $fh_photo;

        ( $x, $y ) = ( $gd->width, $gd->height );
    }
    my ( $thumb_x, $thumb_y ) = imgsize $thumb_file;

    $t->param( success => 1 );

    $dbh->do(

t/00-compile.t  view on Meta::CPAN


open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";

my @warnings;
for my $lib (@module_files)
{
    # see L<perlfaq8/How can I capture STDERR from an external command?>
    my $stderr = IO::Handle->new;

    my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
    binmode $stderr, ':crlf' if $^O eq 'MSWin32';
    my @_warnings = <$stderr>;
    waitpid($pid, 0);
    is($?, 0, "$lib loaded ok");

    if (@_warnings)
    {
        warn @_warnings;
        push @warnings, @_warnings;
    }
}



( run in 0.870 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )