Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Class
- class Database {
- method connect {
- my $pg = DB::Pg.new(conninfo => 'host=localhost port=5432 dbname=postgres user=bla password=sadsa');
- return $pg if $pg;
- return -1;
- }
- method addDomain ($fqdn, $tld, $sid) {
- my $pg = $.connect;
- $pg.query('insert into public.sourcelist_domain (sid, tld, fqdn)
- values ($1,$2,$3)', $sid, $tld, $fqdn);
- }
- }
- #### calling function
- # .. some other stuff goes here
- my $id = $db.getSourceID("fooBar");
- race for $path.IO.lines(:batch(1)) {
- next if / ^\# /;
- my $tld = (.split( / \. / ))[ *-1 ];
- $db.addDomain( $_, $tld, $id);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement