WWW::Battrick

Check-in [7bc428360f]
Login

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

Overview
Comment:login now works, results now work
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1:7bc428360f330b547b89553958058bdc5d84d710
User & Date: erezs@teleweb.co.il 2011-09-08 15:42:42
Context
2011-09-08
15:43
links check-in: 75c6486d72 user: erezs@teleweb.co.il tags: develop
15:42
login now works, results now work check-in: 7bc428360f user: erezs@teleweb.co.il tags: develop
2011-09-07
16:01
docs check-in: d93666fba7 user: erezs@teleweb.co.il tags: develop
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/WWW/Battrick.pm.

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
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;







|







 







|


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
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::Site::login($user, $pass);
}
1;

Changes to lib/WWW/Battrick/Schema/Result/Finances.pm.

1
2
3


4
package WWW::Battrick::Schema::Result::Finances;
use base 'DBIx::Class::Core';



1;



>
>

1
2
3
4
5
6
package WWW::Battrick::Schema::Result::Finances;
use base 'DBIx::Class::Core';

__PACKAGE__->table('finances');

1;

Changes to lib/WWW/Battrick/Schema/Result/Fixtures.pm.

1
2
3


4
package WWW::Battrick::Schema::Result::Fixtures;
use base 'DBIx::Class::Core';



1;



>
>

1
2
3
4
5
6
package WWW::Battrick::Schema::Result::Fixtures;
use base 'DBIx::Class::Core';

__PACKAGE__->table('fixtures');

1;

Changes to lib/WWW/Battrick/Schema/Result/Ground.pm.

1
2
3


4
package WWW::Battrick::Schema::Result::Ground;
use base 'DBIx::Class::Core';



1;



>
>

1
2
3
4
5
6
package WWW::Battrick::Schema::Result::Ground;
use base 'DBIx::Class::Core';

__PACKAGE__->table('ground');

1;

Changes to lib/WWW/Battrick/Schema/Result/Player.pm.

1
2
3


4
package WWW::Battrick::Schema::Result::Player;
use base 'DBIx::Class::Core';



1;



>
>

1
2
3
4
5
6
package WWW::Battrick::Schema::Result::Player;
use base 'DBIx::Class::Core';

__PACKAGE__->table('player');

1;

Changes to 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' );


}

















>
>



<

>
|
>
>
>
>
>
>
>

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

use WWW::Mechanize;

my $mech = WWW::Mechanize->new;
$mech->agent_alias('Linux Mozilla');
$mech->cookie_jar(HTTP::Cookies->new());

sub login {
    my ($user, $password) = @_;


    $mech->get( 'http://battrick.org/nl/public.asp' );

    return unless $mech->success;
    $mech->form_id('login');
    $mech->set_fields(
        username => $user,
        password => $password,
    );
    $mech->click;

    $mech->get( 'http://battrick.org/nl/squad.asp', ':content_file' => 'squad.asp' );
}