Visualizzazione dei risultati da 1 a 2 su 2

Discussione: problema http::daemon

  1. #1

    problema http::daemon

    Salve,

    ho una domanda riguardante il modulo http::daemon (
    http://search.cpan.org/dist/libwww-p...HTTP/Daemon.pm ), nella sua
    guida c'è scritto:

    $c->send_file( $filename )
    $c->send_file( $fd )

    Copy the file to the client. The file can be a string (which will be
    interpreted as a filename) or a reference to an IO::Handle or glob.

    Sinceramente non ho mai usato IO::Handle per leggere dei files...

    io di solito uso questo codice:

    my $song = 'song.mp3';
    open my $fh1, '<', $song or die "open(): $!\n";
    binmode $fh1;
    close($fh1);

    come faccio tramite IO::Handle ad agganciarlo a $c->send_file( $fd ) ???

    --

    btw, dovrei iniziare a leggere questo file da un certo punto e non
    dall'inizio, e meglio usare "seek" o "sysseek" ?? e dopo dovrei usare
    "read" o "sysread" ??

    Grazie
    Alla batteria dai retta ballA

  2. #2
    Se per aprire un file usi la forma:

    open (FILE, "<$file");

    allora devi usare:
    open (FILE, "<$file");
    $c->send_file( fileno(FILE) );

    se usi la tua forma allora:
    open my $fh1, '<', $song or die "open(): $!\n";
    $c->send_file( $fh1 );

    le funzioni sys... funzionano a più basso livello delle corrispondenti funzioni, quindi dipende da quello che devi fare.
    Marco Allegretti
    shishii@tiscalinet.it
    Lang: PERL, PHP, SQL.
    Linux user n° 268623 Fedora Core 10, Fedora Core 6, Debian Sarge on mips

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.