Advertisement
Guest User

Untitled

a guest
May 26th, 2015
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 1.09 KB | None | 0 0
  1. #!/usr/bin/env perl6
  2. use v6;
  3. use DBIish;
  4. use GTK::Simple;
  5.  
  6.  
  7. class phoneBook
  8. {
  9.     has $.DB;
  10.     has GTK::Simple::App $.app;
  11.    
  12.     method new()
  13.     {
  14.         self.dbConnect();
  15.         self.createWindow();
  16.     }
  17.    
  18.     method dbConnect()
  19.     {
  20.         my $mdriver = 'mysql';
  21.         my $host = 'localhost';
  22.         my $port = 3306;
  23.         my $database = 'test';
  24.         my $test_user = 'root';
  25.         my $test_password = 'test';
  26.        
  27.         $.DB = try {
  28.             DBIish.connect($mdriver, :user($test_user), :password($test_password),
  29.                 :$host, :$port, :$database, RaiseError => 1, PrintError => 1, AutoCommit => 0
  30.             );
  31.         }
  32.         return self;
  33.     }
  34.    
  35.     method createWindow()
  36.     {
  37.         $.app = GTK::Simple::App.new( title => 'Name' );
  38.  
  39.         $.app.border_width = 20;
  40.         $.app.size_request(400, 500);
  41.         $.app.set_content(
  42.             GTK::Simple::VBox.new(
  43.                 GTK::Simple::Grid.new(
  44.                     [0, 0, 1, 1] => my $imieLabel           = GTK::Simple::Label.new( text => 'Tests' ),
  45.                 )
  46.             )
  47.         );
  48.     }
  49. }
  50. #----------------------------------------------------------------------------------------------------------------------
  51. my phoneBook $application .= new ;
  52. $application.app.run;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement