This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import System | |
Import System.IO | |
Class Test | |
Public Shared Sub Main() | |
Try | |
' Create an instance of StreamReader to read from a file. | |
Dim sr As StreamReader = New StreamReader("TestFile.txt") | |
Dim line As String | |
' Read and display the lines from the file until the end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub markdown { | |
my( $text, $title ) = @_; | |
my $parser = Markdent::Simple::Document->new(); | |
return $parser->markdown_to_html( | |
title => 'My Document', | |
markdown => $markdown, | |
); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub sum { | |
my @values = @_; | |
my $sum = 0; | |
for my $i ( @values ){ | |
$sum += $i; | |
} | |
return $sum; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ok 1 - literal | |
not ok 2 - eval | |
# Failed test 'eval' | |
# at tmp/unicode_test.pl line 18. | |
Wide character in print at /usr/share/perl5/Test/Builder.pm line 1759. | |
# got: '�' | |
# expected: 'ó' | |
SV = PV(0x1c87dd8) at 0x1cca1b8 | |
REFCNT = 1 | |
FLAGS = (PADMY,POK,pPOK,UTF8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use utf8; | |
use Devel::Peek; | |
use Test::More; | |
use Data::Dumper; | |
$Data::Dumper::Terse = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
package Factory; | |
use Moose; | |
has log_file_name => ( is => 'ro', default => "logfile.log" ); | |
has logger => ( is => 'ro', lazy_build => 1 ); | |
sub _build_logger { FileLogger->new( log_file_name => shift->log_file_name ) } | |
has dsn => ( is => 'ro', default => "dbi:SQLite:dbname=my-app.db" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $log_file_name = "logfile.log"; | |
my $logger = FileLogger->new( log_file_name => $log_file_name ); | |
my $dsn = "dbi:SQLite:dbname=my-app.db"; | |
my $username = "user234"; | |
my $password = "****"; | |
my $dbh = do { | |
require DBI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Bread::Board; | |
my $c = container 'MyApp' => as { | |
service 'log_file_name' => "logfile.log"; | |
service 'logger' => ( | |
class => 'FileLogger', | |
lifecycle => 'Singleton', | |
dependencies => [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope->register('routes', class => 'Lamework::Routes'); | |
$scope->register( | |
'dispatcher', | |
class => 'Lamework::Dispatcher::Routes', | |
deps => 'routes' | |
); | |
$scope->register(action_namespace => (ref $self) . '::Action::'); | |
$scope->register( | |
'action_builder', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package MyClass; | |
sub new { | |
my ( $class ) = @_; | |
my $self = bless {}, $class; | |
$self->{dbh} = DBI->connect( 'DBI:mysql:database=db', 'dbuser', 'dbpassword' ); |