println() API function.
This commit is contained in:
1 parent
f400bf99f2
commit
6e979ced56
2 files changed
+55
-1
No files matched your search
@@ -15,6 +15,7 @@ use FindBin qw($Bin);
|
|||||||
our $Bin = $Bin;
|
our $Bin = $Bin;
|
||||||
unshift(@INC, "$Bin/../src");
|
unshift(@INC, "$Bin/../src");
|
||||||
require API::Std;
|
require API::Std;
|
||||||
|
require API::Log;
|
||||||
#require DB::Flatfile;
|
#require DB::Flatfile;
|
||||||
require Parser::Config;
|
require Parser::Config;
|
||||||
require Parser::Lang;
|
require Parser::Lang;
|
||||||
@@ -35,6 +36,6 @@ our %SETTINGS = $CONF->parse;
|
|||||||
my @lclv = API::Std::conf_get("locale");
|
my @lclv = API::Std::conf_get("locale");
|
||||||
our $LOCALE = $lclv[0][0];
|
our $LOCALE = $lclv[0][0];
|
||||||
my @lang = split('_', $LOCALE);
|
my @lang = split('_', $LOCALE);
|
||||||
Parser::Lang::parse($lang[0]) or print ".\n" and exit;
|
Parser::Lang::parse($lang[0]);
|
||||||
undef @lang;
|
undef @lang;
|
||||||
undef @lclv;
|
undef @lclv;
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# Auto IRC Bot. An advanced, lightweight and powerful IRC bot.
|
||||||
|
# Copyright (C) 2010-2011 Xelhua Development Team (doc/CREDITS)
|
||||||
|
# This program is free software; rights to this code are stated in doc/LICENSE.
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Exporter;
|
||||||
|
use API::Std qw(conf_get);
|
||||||
|
|
||||||
|
# API logging subroutines.
|
||||||
|
package API::Log;
|
||||||
|
|
||||||
|
our @ISA = qw(Exporter);
|
||||||
|
our @EXPORT_OK = qw(println dbug alog);
|
||||||
|
|
||||||
|
|
||||||
|
# Print with the system newline appended.
|
||||||
|
sub println
|
||||||
|
{
|
||||||
|
my ($out) = @_;
|
||||||
|
|
||||||
|
my ($nl);
|
||||||
|
if ($^O =~ /dos/i or $^O =~ /win/i or $^O =~ /netware/i) {
|
||||||
|
$nl = "\r\n";
|
||||||
|
}
|
||||||
|
elsif ($^O =~ /linux/i or $^O =~ /bsd/i) {
|
||||||
|
$nl = "\n";
|
||||||
|
}
|
||||||
|
elsif ($^O =~ /mac/i or $^O =~ /darwin/i) {
|
||||||
|
$nl = "\r";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$nl = "\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print $out.$nl;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print only if in debug mode.
|
||||||
|
sub dbug
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Log to file.
|
||||||
|
sub alog
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
||||||
Reference in new issue
Block a user