App-ZofCMS
view release on metacpan or search on metacpan
lib/App/ZofCMS/Plugin/Barcode.pm view on Meta::CPAN
my $bar = GD::Barcode->new( @$conf{ qw/type code/ } );
unless ( $bar ) {
$t->{t}{plug_barcode_error} = $GD::Barcode::errStr;
return;
}
if ( defined $conf->{file} and length $conf->{file} ) {
if ( open my $fh, '>', $conf->{file} ) {
binmode $fh;
print $fh $conf->{format} eq 'png'
? $bar->plot( Height => $conf->{height}, NoText => $conf->{no_text} )->png
: $bar->plot( Height => $conf->{height}, NoText => $conf->{no_text} )->gif;
}
else {
$t->{t}{plug_barcode_error} = $!;
return;
}
}
else {
binmode STDOUT;
if ( $conf->{format} eq 'png' ) {
print "Content-Type: image/png\n\n";
print $bar->plot( Height => $conf->{height}, NoText => $conf->{no_text} )->png;
}
else {
print "Content-Type: image/gif\n\n";
print $bar->plot( Height => $conf->{height}, NoText => $conf->{no_text} )->gif;
}
exit;
}
lib/App/ZofCMS/Plugin/CRUD.pm view on Meta::CPAN
while ( -e File::Spec->catdir( $self->{CONF}{file_dir}, $filename ) ) {
$filename = "_$filename";
}
$filename = File::Spec->catdir( $self->{CONF}{file_dir}, $filename );
return +{ error => "Failed to open local file $filename [$!]" }
unless open my $fh_out, '>', $filename;
seek $fh, 0, 0;
binmode $fh;
binmode $fh_out;
{
local $/ = \1024;
while ( <$fh> ) {
print $fh_out $_;
}
}
close $fh;
close $fh_out;
lib/App/ZofCMS/Plugin/FileUpload.pm view on Meta::CPAN
return
unless $fh;
my $fh_out;
unless ( open $fh_out, '>', $upload->{name} ) {
$template->{t}{ $error_key } = "Failed to open local file [$!]";
return;
}
seek $fh, 0, 0;
binmode $fh;
binmode $fh_out;
{
local $/ = \1024;
while ( <$fh> ) {
print $fh_out $_;
}
}
close $fh;
close $fh_out;
t/00-compile.t view on Meta::CPAN
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { +require blib; blib->VERSION('1.01') };
if (@_warnings)
{
warn @_warnings;
t/00-compile.t view on Meta::CPAN
close $fh and skip("$file uses -T; not testable with PERL5LIB", 1)
if grep { $_ eq '-T' } @switches and $ENV{PERL5LIB};
my $stderr = IO::Handle->new;
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-c', $file))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-c', $file);
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$file compiled ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { +require blib; blib->VERSION('1.01') };
# in older perls, -c output is simply the file portion of the path being tested
if (@_warnings = grep { !/\bsyntax OK$/ }
grep { chomp; $_ ne (File::Spec->splitpath($file))[2] } @_warnings)
( run in 1.605 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )