Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding description

  • Loading branch information...
commit 51f0a0562204f6d9f244a5b2c4095e2594c2a8db 1 parent 5881466
Maksym Naboka authored

Showing 2 changed files with 44 additions and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  AutoRiaUa.pl
  2. +43 0 README
2  AutoRiaUa.pl
@@ -196,7 +196,7 @@ sub parse {
196 196 ##########################################################################
197 197 ## INSERTING INTO DB ##
198 198 ##########################################################################
199   -
  199 + exit;
200 200 eval { $DBi->insert($self->{db}->{table}, {
201 201 autoId => $autoid,
202 202 model => $model,
43 README
@@ -2,5 +2,48 @@ Hello guys
2 2
3 3 Here is parser which takes cars from http://auto.ria.ua and stores in database. Pretty simple but it works
4 4
  5 +it uses:
  6 +DBIx::Simple
  7 +SQL::Abstract
  8 +Mojo::UserAgent
  9 +Mojo::DOM
  10 +
  11 +How to use it:
  12 +under package main create an AutoRiaUa object
  13 +#####################################################################################################################
  14 +package main;
  15 +my $obj = AutoRiaUa->new(
  16 + debug => 1, #To turn on debugging info on STDOUT
  17 +
  18 + db => {
  19 + engine => 'mysql', #Can be mysql,sqlite for more drivers see http://search.cpan.org/~timb/DBI-1.616/DBI.pm
  20 +
  21 + user => 'root', #Username for DB
  22 + password => '', #Pass for DB
  23 + database => 'auto', #DB name, for sqlite must be location to a file
  24 + table => 'cars' #Table to store info
  25 + },
  26 +
  27 + cond => { #Condition of cars
  28 + year_from => '2007', #Year from
  29 + year_to => '2011', #Year to
  30 + gear => '-1', #Gear: [-1 = automatic; 1 = manual]
  31 + price_from => '8000', #Proce from
  32 + price_to => '12000' #Proce to
  33 + }, #Options will be added...
  34 +
  35 +);
  36 +#####################################################################################################################
  37 +
  38 +AutoRiaUa object has got only one method 'parse'
  39 +
  40 +$obj->parse
  41 +
  42 +This will parse and store auto into DB. No need to create table in database. Script will create table schema if it's not present.
  43 +
  44 +
  45 +
  46 +
  47 +
5 48 maksym.naboka@gmail.com
6 49

0 comments on commit 51f0a05

Please sign in to comment.
Something went wrong with that request. Please try again.