[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] printing from browswer with glue



At 15:29 -0400 2000.09.26, Eric Rainey wrote:
>use Mac::Glue;
>
>my $Moz = new Mac::Glue 'Internet_Explorer_4_5';
>
>
>if ($Moz->print('masterpiece:archive:1:1.html')) {
>
>	print "ok!\n";
>
>} else {
>
>	print "nope!\n";
>};


Well, for starters, there's nothing in the docs that says a glue method
will return true for success or false for failure, so that is part of the
problem.  I would not expect it to ever print "ok!\n" even on success,
unless print() returned some data, which I don't think it ever does in any
app I've seen.

Other than that, I don't know.  Maybe there is an error message returned
from the Glue?  The code below works for Netscape and IE:

  #!perl -w
  use Mac::Glue;
  my $browser = new Mac::Glue 'Internet Explorer';  # using 5.0
  $browser->ERRORS(sub {
     my(@stuff) = @_;
     print "Error: $stuff[4]";
  });

  $browser->activate;  # requires me to hit RETURN ...
  $browser->print('Bourque:Desktop Folder:a.html');

The ERRORS method is fully documented in the POD, assuming you have
Mac::Glue 1.00, which is the only version ERRORS is implemented in.  There
is no reason to not have Mac::Glue 1.00, but if you want to use an older
version, or just don't want to use ERRORS, you can also handle errors in
the traditional way mentioned in the POD:

  $browser->print('foo');
  warn "Print error: $^E" if $^E;

Hope that helps,

-- 
Chris Nandor                      pudge@pobox.com    http://pudge.net/
Open Source Development Network    pudge@osdn.com     http://osdn.com/

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org