6 use parent qw
/Exporter/;
8 our $VERSION = '0.001';
9 our @EXPORT_OK = qw
/get_cpu_list get_gpu_list/;
10 our @EXPORT = @EXPORT_OK;
12 use WWW
::Passmark
::CPU
;
13 use WWW
::Passmark
::GPU
;
15 use HTML
::TreeBuilder
;
16 use LWP
::UserAgent
; # TreeBuilder->new_from_url uses this
17 use List
::MoreUtils qw
/natatime/;
19 use Data
::Dumper qw
/Dumper/;
21 our $CPU_URL = 'https://www.cpubenchmark.net/CPU_mega_page.html';
22 our $GPU_URL = 'https://www.videocardbenchmark.net/GPU_mega_page.html';
26 my $tree = HTML
::TreeBuilder
->new_from_url($url);
27 my $table = $tree->look_down(class => 'tablesorter');
28 my $iter = natatime
2, $tree->find('tbody')->find('tr');
31 while (my @items = $iter->()) {
32 my ($item, $desc) = @items;
33 push @results, [ map { $_->as_text } $item->find('td'), $desc->find('td') ]
40 my @results = map { bless $_, 'WWW::Passmark::CPU' } get_main_table
$CPU_URL;
41 #bless \@results, 'WWW::Passmark::CPUList'
46 my @results = map { bless $_, 'WWW::Passmark::GPU' } get_main_table
$GPU_URL;
47 #bless \@results, 'WWW::Passmark::GPUList'
58 WWW::Passmark - look up CPU/GPU benchmark results
63 my $cpu_list = get_cpu_list;
64 my $some_cpu = $cpu_list->[232];
65 say $some_cpu->name; # AMD Ryzen 7 2700X
66 say $some_cpu->socket; # AM4
67 say $some_cpu->cpumark; # 17016
68 say $some_cpu->test_date; # Apr 2018
70 my $gpu_list = get_gpu_list;
71 my $some_gpu = $gpu_list->[5];
72 say $some_gpu->name; # Radeon R9 Fury
73 say $some_gpu->g3dmark; # 9212
77 This module is a scraper for Passmark software result websites. This
78 is the first version of the module, which only supports two of the
79 websites (cpubenchmark.net and videocardbenchmark.net) and offers few
82 There are currently two functions, both exported by default. They are
83 B<get_cpu_list> and B<get_gpu_list>, which download the list of all
84 benchmark results for CPUs/GPUs and return an arrayref of objects of
85 type L<WWW::Passmark::CPU> or L<WWW::Passmark::GPU>. Each such object
86 represents one CPU/GPU, and contains its name and benchmark results.
90 L<https://www.cpubenchmark.net>, L<https://www.videocardbenchmark.net>
94 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
96 =head1 COPYRIGHT AND LICENSE
98 Copyright (C) 2018 by Marius Gavrilescu
100 This library is free software; you can redistribute it and/or modify
101 it under the same terms as Perl itself, either Perl version 5.24.1 or,
102 at your option, any later version of Perl 5 you may have available.
This page took 0.023743 seconds and 4 git commands to generate.