in reply to Re: Viewing a PDF file from a Perl program
in thread Viewing a PDF file from a Perl program

++zengargoyle

IMHO the best (i.e.: more portable) way to do it is fork, since it works on every UNIX-like OS and it is emulated on Win32, and it won't "freeze" your application. Calling system "acroread poe.pdf &"; won't work on non-UNIX systems

Ciao!
--bronto


The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz

Replies are listed 'Best First'.
Re: Re: Re: Viewing a PDF file from a Perl program
by Courage (Parson) on Mar 24, 2003 at 11:03 UTC
    ... but it is buggy for at least 5.6.0 and not ported to everywhere. Also will not work in any way with perl-5.005 on Win32.

    So it is no way more portable.

    Courage, the Cowardly Dog

      Right. So, if perlgrl needed a reason to upgrade his/her Perl to 5.8, you gave him/her two ;-)

      Ciao!
      --bronto


      The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
      --John M. Dlugosz
        you mean not only upgrade from 5.8 but, if platform does not support fork (as WinCE do not support it currently) he/she must upgrade PocketPC to Notebook, and also upgrade pocket to bag (because notebook no longer fits to pocket).

        Hey, throw away your costume, as it contains too small pockets. We must upgrade and your pockets must be at least 30cm in size.

Re: Re: Re: Viewing a PDF file from a Perl program
by zengargoyle (Deacon) on Mar 25, 2003 at 01:36 UTC

    indeed fork is the only way to go.

    other replys have suggested:

    system start => acrord32 => $pdf_file; # or system start => $pdf_file;
    neither of which has any hope of running anywhere but Windows.

    for cross-platform-ability have a config setting for the reader executable.

    # in child after fork (close STD* for good measure) close STDIN; close STDOUT; close STDERR; system $cfg{PDFViewer}, $pdf_file;

    i'm sure there are modules on CPAN that abstract Running a program for multiple OSs.