Hello,
I'd like some advice on what to name a module I am contributing. It's job is to configure Linksys "Instant Broadband Series" routers (BEFSR41 and the like). Currently, there is no other way to configure these units other than to manually navigate through HTML forms using a web browser such as Netscape. The routers lacks SNMP support as well as any method of exporting/importing configurations, which is useful when working with large quantities of routers. What was needed was a Perl interface to quickly perform firmware upgrades (via TFTP), import/export configurations, change passwords, and modify various settings... I have already coded the module and it is near point of release.
I propose that it be called Linksys::Config, and will use that name for my examples below. I welcome critism of this choice.
SYNOPSYS
use Linksys::Config;
my $router = new Linksys::Config;
my $rv = $router->connect("$host[:$port]", $password, $prompt);
print $router->errmsg if(!$rv);
my $rv = $router->change_password($new_password);
print $router->errmsg if(!$rv);
$router->clear; # Clear all pages!
$router->clear($page); # Clear all the vars $page
$router->clear($page, @names); # Clear @names on $page
my $rv = $router->query;
my $rv = $router->query(@pages);
print $router->errmsg if(!$rv);
my $value = $router->get($page, $name);
my @values = $router->get($page, @names);
my %page_config = $router->get($page);
my %full_config = $router->get;
my %full_config = ( 'PageA' => { name => value, name2 => value2 },
'PageB' => { name => value, name2 => value2 }, );
my %page_config = ( name => value, name2 => value2 );
$router->set( \%full_config );
$router->set( $page, \%page_config );
$router->set( $page, $name, $value );
$router->force; # Force all variables to update (next apply() will be slow!)
$router->force($page); # Force all for $page
$router->force($page, @names); # Force $var on $page
my $rv = $router->apply; -or-
my $rv = $router->apply(@pages);
print $router->errmsg if(!$rv);
my $config = $router->export_cfg;
$other_router->import_cfg($config);
my $rv = $router->upgrade( $path_to_firmware_file );
print $router->errmsg if(!$rv);
Tested with Linksys Router Version: BEFSR41
Dependencies Include:
LWP::UserAgent, HTML::Parser, HTML::PullParser, HTML::Entities
(Used to communicate with the router via HTTP, and pull variable information from the outputted HTML)
Embeded in this the module is also Linksys::Config::TFTP which is a slightly modified version of Net::TFTP that supports Linksys's propreitary extention to TFTP to authenticate via password. Linksys::Config::TFTP is used internally by Linksys::Config during firmware upgrades, however it could be used independently of Linksys::Config by someone wishing to have direct TFTP access to a Linksys router. The usage for Linksys::Config::TFTP is exactly the same as Net::TFTP with the addition of a "Password" paramter. I am assumeing that this TFTP module would be a child of whatever name space is agreed to here, but I am not opposed to moving the Linksys::Config::TFTP sub-module entirely to some other name space, such as Net::TFTP::Linksys some such designation...
Thanks,
James Tavares
- Re: Request for Advice on Namespace for New Module James Tavares