|< 1 2 >| | 12 Einträge, 2 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use HTML::Template::Compiled; sub stream { my ($fh) = @_; while (<$fh>) { print "STREAM: $_"; sleep 1; } } if (my $pid = open my $pipe, "-|") { # prozess forken, kind schreibt in $pipe als STDOUT, # wir lesen von $pipe stream($pipe); } else { my $htc = HTML::Template::Compiled->new( scalarref => \<<EOM, test 1 zwo blubb EOM out_fh => 1, ); $htc->output(\*STDOUT); # schreibt in $pipe exit; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
# Seminartermin für Outlook-Kalender ausgeben sub SendeOutlookTermin { my $self = shift; $self->{ICALENDAR_TMPL} = HTML::Template::Compiled->new ( filename => 'htc_icalendar.ics', path => '/usr/local/httpd/htdocs/cgi-bin/seminare_v2/tmpl/', ); $self->ICalendar::HoleIcalTerminDaten(); $self->{DOWNLOAD} = 'files/'.$self->session->id().'.ics'; open (ICAL, ">$self->{DOWNLOAD}") || die 'Fehler bei open \n'; print ICAL $self->{ICALENDAR_TMPL}->output(); close(ICAL) || die 'Fehler bei close \n'; $self->{DateiDownloadTyp} = 'ics'; } # Seminartermin für Outlook-Kalender aus DB auslesen sub HoleIcalTerminDaten { my $self = shift; $self->SqlStatements::HoleIcalTerminDatenSQL() unless defined $self->{HoleIcalTerminDatenSQL}; $self->{HoleIcalTerminDatenSQL}->execute( $self->{TerminID} ); my ( $seminar_nr, $seminar_titel, $start_datum, $start_uhrzeit, $ende_datum, $ende_uhrzeit, $start_datum_ical, $start_uhrzeit_ical, $ende_datum_ical, $ende_uhrzeit_ical ); $self->{HoleIcalTerminDatenSQL}->bind_columns(undef, \( $seminar_nr, $seminar_titel, $start_datum, $start_uhrzeit, $ende_datum, $ende_uhrzeit, $start_datum_ical, $start_uhrzeit_ical, $ende_datum_ical, $ende_uhrzeit_ical )); $self->{HoleIcalTerminDatenSQL}->fetch(); $self->{ICALENDAR_TMPL}->param( CGISESSID => $self->session->id(), SEMINAR_NR => "$seminar_nr", SEMINAR_TITEL => "$seminar_titel", SEMINAR_VON => "$start_datum $start_uhrzeit", SEMINAR_BIS => "$ende_datum $ende_uhrzeit", SEMINAR_VON_DATETIME => "$start_datum_ical"."T$start_uhrzeit_ical", SEMINAR_BIS_DATETIME => "$ende_datum_ical"."T$ende_uhrzeit_ical", JETZT_DATETIME => "20081006T080000", ); }
1 2 3 4 5
... use CGI::Application::Plugin::Stream (qw/stream_file/); ... $self->stream_file($self->{DOWNLOAD}, 2048) || die 'Fehler bei stream_file \n'; $self->header_add( -attachment => "kalender.ics" );
1 2 3 4 5
use IO::String; #... $self->{DOWNLOAD} =IO::String->new($self->{ICALENDAR_TMPL}->output());
1
2
3
4
stat() on unopened filehandle GEN0 at /usr/lib/perl5/site_perl/5.8.6/CGI/Application/Plugin/Stream.pm line 21., referer: https://xxx/seminare_v2/kalender
Failed to load File::MMagic module to determine mime type: Can't locate object method "BINMODE" via package "FileHandle" at /usr/lib/perl5/site_perl/5.8.6/File/MMagic.pm line 576., referer: https://xxx/seminare_v2/kalender
Error executing class callback in postrun stage: Can't locate object method "SEEK" via package "FileHandle" at /usr/lib/perl5/site_perl/5.8.6/CGI/Application/Plugin/Stream.pm line 84., referer: https://xxx/seminare_v2/kalender
malformed header from script. Bad header=Content-length: seminare.pl, referer: https://xxx/seminare_v2/kalender
|< 1 2 >| | 12 Einträge, 2 Seiten |