<div>Yeah, the 'Maybe' works great, and thanks for pointing me to the doc.</div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">My ssh_builder looks like your safe_ssh, not sure what you meant. I have one &ssh_builder for all (86!) classes. If a new class wants an ssh connection, it consumes the 'SSH' role with the ssh attribute populated by &ssh_builder.</div>

<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>I have one case where I'm connecting to a bunch of machines and if one machine is offline I absolutely want the script to keep going to process the other machines and not die. In other cases, I connect to one machine and if it can't connect, then there is no point in continuing and go ahead and die. (In fact, I'm frequently forking and threading off the connections in parallel now, but that's besides the point - I want to reserve the right to handle any exception elegantly.)</div>

<div><br></div><div>So in my case, the consuming class, instead of the builder, needs to decide how to handle a bad ssh connection: die or handle it and propagate handling up the class hierarchy. Therefore the builder via the attribute needs to pass success or fail to the consuming class and not make it's own decision to die. And, I want as much of the common code as possible and all of the Net::SSH2 code to go into &ssh_builder.</div>

<div><br></div><div>Finally, I get a lot of benefit from using this within the lazy build context. It simplifies use of ssh for the consuming class - just check to see if it has a value of undef (thanks now to 'Maybe') and if not, start using it. It provides great encapsulation and minimizes over all resources, because the program may end before needing to create some or all of the connections.</div>

<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>Thanks Again,</div>Sean<br><br><br>
<br><br><div class="gmail_quote">On Fri, Apr 29, 2011 at 8:37 AM, Andrew Rodland <span dir="ltr"><<a href="mailto:andrew@cleverdomain.org">andrew@cleverdomain.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Moose::Util::Typeconstraints</blockquote></div><br>