WWW::Battrick

Check-in [9917b0435d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge branch 'feature/initial-code' into develop
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1:9917b0435d0828b842c26329ac48b982a4890de3
User & Date: erezs@teleweb.co.il 2011-09-07 15:56:10
Context
2011-09-07
16:01
docs check-in: d93666fba7 user: erezs@teleweb.co.il tags: develop
15:56
Merge branch 'feature/initial-code' into develop check-in: 9917b0435d user: erezs@teleweb.co.il tags: develop
15:55
basic login method call check-in: 448af9be0a user: erezs@teleweb.co.il tags: develop
15:24
schemas check-in: d7a06f8d00 user: erezs@teleweb.co.il tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bin/battrick.

1
2
3
4
5
6
7




8
#!/usr/bin/perl

use strict;
use warnings;

use WWW::Battrick;





WWW::Battrick::run();







>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl

use strict;
use warnings;

use WWW::Battrick;

print "Username: ";
chomp (my $user = <STDIN>);
print "Password: ";
chomp (my $pass = <STDIN>);
WWW::Battrick::run($user, $pass);

Changes to lib/WWW/Battrick.pm.

1
2
3
4






























5


6
7
use strict;
use warnings;
package WWW::Battrick;































sub run {


}
1;




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>


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
38
39
use strict;
use warnings;
package WWW::Battrick;

use WWW::Battrick::Schema;
use WWW::Battrick::Site;
use Moose;

has schema => (
    is => 'ro',
    isa => 'DBIx::Class::Schema',
    lazy_build => 1,
);

sub _build_schema {
    my $self = shift;

    unless (opendir my $DIR, "$ENV{HOME}/.battrick") {
        mkdir "$ENV{HOME}/.battrick";
    }

    my $schema = WWW:Battrick::Schema->connect(
        "dbi:SQLite:$ENV{HOME}/.battrick/data.db"
    );

    eval {
        $schema->resultset('Player')->search->all;
    };
    $schema->deploy if $@;

    return $schema;
}


sub run {
    my ($user, $pass) = @_;
    WWW::Battrick::login();
}
1;

Added lib/WWW/Battrick/Site.pm.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use strict;
use warnings;
package WWW::Battrick::Site;

use WWW::Mechanize;

my $mech = WWW::Mechanize->new;

sub login {
    my ($user, $password) = @_;
    $mech->get( 'http://battrick.org/nl/public.asp?sid=new' );

}