What do you mean by that? Do you ask how to set a key in your hash?
I think it would help me if you show what you got and show what you want.
| [reply] |
I checked it into a google code SVN repo, so here ya go.
(Again, I still kinda consider myself a perl noob, atleast as far as creating perl modules goes and using OOP in perl, so don't hate! lol)
http://big-ip-f5-api.googlecode.com/svn/trunk/
Basically, if you look in the sample (which some of it works, some doesn't, I doubt you have an F5 laying around to test it on though), the code is as below
my $connection = BigIP::F5->new($settings);
die ("Unable to connect to " . $settings{'server'} . "\nIt said: " . $
+connection->fault) if (!$connection);
I basically need the logic behind that to work, Yes I could make my module just die or croak, but id rather give the user the ability to end it in their own way if it throws a fail code | [reply] [d/l] |
Please don't post (links to) offsite code. I prefer that you take the time to reduce your code (and problem) to a small, self-contained example.
That said, your example API can be made to work by using overload to return a false value on which you still can call methods. I'm not sure whether that's the best API though. I would (also for testing purposes) split up the call to new and the call to connect, and have the call to connect just return a false value:
my $conn = Net::Big5->new(...);
$conn->connect or die $conn->error;
That way you can make the call to connect fatal (via die) if it is in void context. | [reply] [d/l] |
I would recommend not returning an error code or value. If you don't get the data you need, a good option is to carp/warn and return undef, or die/croak ( depending on whatever is appropriate ).
| [reply] |