File: Module.pm

package info (click to toggle)
libperl-metrics-simple-perl 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 344 kB
  • sloc: perl: 1,433; makefile: 7
file content (37 lines) | stat: -rw-r--r-- 782 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# This is a comment. I love comments.

package Perl::Metrics::Simple::Test::Module;

use strict;
use warnings;

sub new {
    my ( $class, @args ) = @_;
    my $self = { _args => \@args, };
    return bless $self, $class;
}

sub foo {
    my ($self) = @_;
    foreach my $thing ( @{ $self->{_args} } ) {
        $self->say_hello($thing);
        next if ( $thing eq 'goodbye' );
        last if ( $thing eq 'bailout' );
    }
    return $self->{_args};
}

package Perl::Metrics::Simple::Test::Module::InnerClass;

sub say_hello {
    my ( $self, $name ) = @_;
    if ( $name && $name ne 'Fred' ) {
        return print "Hello $name\n";
    }
    else {
        return print "Hello Kiddo\n";
    }    
}

package Perl::Metrics::Simple::Test::Module;    # back to original package
1;