Re: [Ssh-sftp-perl-users] Net::SSH::Perl error handling
Brought to you by:
dbrobins
From: Mark A. F. <mar...@ea...> - 2005-03-09 18:39:56
|
From: "Mark A. Fuller" <mar...@ea...> >I trapped the die signal in the eval and accumulated the messages in an array. I should have also said that I found it useful to accumulate messages in an array because it seemed like multiple die signals might be trapped within an eval of one method call. I found that I could end up with more than one message after the eval, when I detected that the die signal handler had been called. Sometimes the first message was more meaningful than the last. BTW: Earlier you said it was too bad that I had to do something outside of Perl. Why's that bad? What is the downside of using Expect.pm (a Perl module) to drive an executable module (like an open-ssh sftp module)? It's slightly more complicated to code. A larger memory footprint? The upside to me was that it was more "WYSIWYG." What I mean is, if I put something into production and it stopped working for some bizarre reason a year or two down the road, it was relatively straightforward to exercise the executable and verify what the driving process was encountering. With N:S:P, I found myself making a number of invalid assumptions about how my experience with the executable should be the expected experience with the Perl binding. Things got simpler for me when there was a one-to-one correlation between what I could do at the command line and via my script to automate the same connection. I suppose psftp (the command-line emulator tool implementing N:S:P) might have alleviated my problem. Another benefit, however is that once I went through the learning curve for Expect.pm I could apply it to *any* executable. I didn't have to learn the ins-and-outs of every Perl binding I might want to use. Or, trip over various shortcomings. The executables tend to see more widespread use and therefore the bugs are worked out. Using a single binding (Expect.pm) to drive all of them seemed like a more stable proposition *to me*. I'm not trying to evangelize anyone away from N:S:P. Just offering my own experience. Mark |