in reply to prefered syntax for using imported subs
Well, i really prefer the OO version:
but to answer your question, i too prefer the latter. Take CGI.pm for example -- i enjoy using that module the most when i use its function-oriented interface:use Module::Foo; my $foo = Module::Foo->new(); $foo->do_something();
But it can be easy to mix up your subroutines with the subroutines from the module(s) you are importing, and programs can really benefit from the OO approach in ways other than preventing name collision:print header, start_html( -title => 'Decimal to Hex Converter', -bgcolor => 'black', -text => 'white', ), h1({align=>'center'},'Decimal to Hex Converter'), ;
In that example, "magic" happens when you instantiate the CGI object and pass the reference to the HTML::Template constructor. You get forms that remember their values when the user submits invalid form information.my $cgi = CGI->new; my $tmpl = HTML::Template->new( filehandle => \*DATA, associate => $cgi, ); print $cgi->header, $tmpl->output; __DATA__ <html> yadda ...
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|