Class::HPLOO

Class::HPLOO is an easier way to declare classes on Perl, based in the popular class {...} style and ePod.
Download

Class::HPLOO Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Graciliano M. P.
  • Publisher web site:
  • http://search.cpan.org/~gmpassos/

Class::HPLOO Tags


Class::HPLOO Description

Class::HPLOO is an easier way to declare classes on Perl, based in the popular class {...} style and ePod. Class::HPLOO is an easier way to declare classes on Perl, based in the popular class {...} style and ePod.USAGE use Class::HPLOO ; class Foo extends Bar , Baz { use LWP::Simple qw(get) ; ## import the method get() to this package. attr ( array foo_list , int age , string name , foo ) ## define attributes. vars ($GLOBAL_VAR) ; ## same as: use vars qw($GLOBAL_VAR); my ($local_var) ; ## constructor/initializer: sub Foo { $this->{attr} = $_ ; } ## methods with input variables declared: sub get_pages ($base , @pages , %options) { my @htmls ; if ( $options{proxy} ) { ... } foreach my $pages_i ( @pages ) { my $url = "$base/$pages_i" ; my $html = get($url) ; push(@htmls , $html) ; $this->cache($url , $html) ; } return @htmls ; } ## methos like a normal Perl sub: sub cache { my ( $url , $html ) = @_ ; $this->{CACHE}{$url} = $html ; } sub attributes_example { $this->set_foo_list(qw(a b c d e f)) ; my @l = $this->get_foo_list ; $this->set_age(30) ; $this->set_name("Joe") ; $this->set_foo( time() ) ; print "NAME: ". $this->get_name ."n" ; print "AGE: ". $this->get_age ."n" ; print "FOO: ". $this->get_foo ."n" ; } } ## Example of use of the class: package main ; my $foo = new Foo(123) ; $foo->get_pages('http://www.perlmonks.com/', , {proxy => 'localhost:8080'}) ; Requirements: · Perl


Class::HPLOO Related Software