Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl6
- use v6;
- use DBIish;
- use GTK::Simple;
- class phoneBook
- {
- has $.DB;
- has GTK::Simple::App $.app;
- method new()
- {
- self.dbConnect();
- self.createWindow();
- }
- method dbConnect()
- {
- my $mdriver = 'mysql';
- my $host = 'localhost';
- my $port = 3306;
- my $database = 'test';
- my $test_user = 'root';
- my $test_password = 'test';
- $.DB = try {
- DBIish.connect($mdriver, :user($test_user), :password($test_password),
- :$host, :$port, :$database, RaiseError => 1, PrintError => 1, AutoCommit => 0
- );
- }
- return self;
- }
- method createWindow()
- {
- $.app = GTK::Simple::App.new( title => 'Name' );
- $.app.border_width = 20;
- $.app.size_request(400, 500);
- $.app.set_content(
- GTK::Simple::VBox.new(
- GTK::Simple::Grid.new(
- [0, 0, 1, 1] => my $imieLabel = GTK::Simple::Label.new( text => 'Tests' ),
- )
- )
- );
- }
- }
- #----------------------------------------------------------------------------------------------------------------------
- my phoneBook $application .= new ;
- $application.app.run;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement