User Control Panel
Advertisements

HELP US, HELP YOU!

Time::Convert

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Modules & Add-ons
View unanswered posts
Author Message
mat007
Almost An Agent
Almost An Agent


Joined: 12 Jan 2004
Posts: 1375

Reputation: 15.8Reputation: 15.8
votes: 2

PostPosted: Sat Apr 02, 2005 1:46 pm    Post subject: Reply with quote

This is my module i spent a few minutes writing, I've included the POD file (In ./docs)

Attached is the module in .zip format.
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Sat Apr 02, 2005 3:36 pm    Post subject: Reply with quote

=\ dont see much point in a whole module for that, maybe if there was other stuff but i made a simple commands with just a couple of lines =/

Code:
<br />sub convertsec<br />{ <br />    my ($bot,$self, $user, $name, $msg, $color) = @_;<br /><br />if ($msg =~ /[^0-9]/) {<br />   return "[error]It has to be an amount of seconds!";<br />}<br />   <br />   else{<br />   my ($hours,$days,$seconds,$mins,$years) = 0;<br />   $hours = int($msg / 3600);<br />  $days = int($hours / 24);<br />  $hours = $hours % 24;<br />   $seconds = $msg % 3600;<br />  $mins = int($seconds / 60);  <br />  $seconds = $seconds % 60;<br />     $years = int($days / 365);<br />     $days = $days % 365;<br />  <br />  return "There is $years Years,$days Days, $hours Hours, $mins Minutes, $seconds Seconds until $msg Seconds...";<br />   }<br />   }<br />



Plus, doesntn it print 112 ='s?
that would be extremely annoying..... Wink
Back to top
mat007
Almost An Agent
Almost An Agent


Joined: 12 Jan 2004
Posts: 1375

Reputation: 15.8Reputation: 15.8
votes: 2

PostPosted: Sat Apr 02, 2005 3:50 pm    Post subject: Reply with quote

No it prints 56 on each line wene the module is loaded.
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Sat Apr 02, 2005 4:49 pm    Post subject: Reply with quote

yeah and theres two lots so thats 112
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sat Apr 02, 2005 6:58 pm    Post subject: Reply with quote

Basic, it prints this:

Code:
========================================================<br />   Time::Convert (Version: $VERSION) - Matthew Fenton 2005<br />========================================================


So it prints three whole lines all together. That's only two more than the MSN module does (and if they follow the pattern with the Yahoo module, those two together would print 2 lines Surprised ).

Although the module really could do without it, you're supposed to just have a version function to get the version. Razz Very few other modules print things on startup.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Sat Apr 02, 2005 7:11 pm    Post subject: Reply with quote

QUOTE(Cer @ Apr 2 2005, 10:58 AM)
Basic, it prints this:

Code:
========================================================<br />   Time::Convert (Version: $VERSION) - Matthew Fenton 2005<br />========================================================


So it prints three whole lines all together. That's only two more than the MSN module does (and if they follow the pattern with the Yahoo module, those two together would print 2 lines  Surprised ).

Although the module really could do without it, you're supposed to just have a version function to get the version. Razz Very few other modules print things on startup.
[right][snapback]47482[/snapback][/right]



In fact the only reason MSN.pm prints it is for debuging. Often people post the output, if the module prints its version then it is easy to see what they are using.

_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Sat Apr 02, 2005 8:45 pm    Post subject: Reply with quote

I don't really see any point in this code. First, it's not a module, it's a command. Second, it's tied to text input and text output from a bot, so it doesn't fit the concept of a self-contained module. Third, it expects someone to type in some time in seconds?! Hmm. Finally, there are dozens of modules on CPAN that work with time, date, duration and such. Why not use one of those?
Back to top
thomashp
Member
Member


Joined: 22 Feb 2004
Posts: 121
Location: Richmond, VA
Reputation: 29.3Reputation: 29.3Reputation: 29.3

PostPosted: Thu Apr 14, 2005 6:05 am    Post subject: Reply with quote

Code:
my ($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Thu Apr 14, 2005 6:15 am    Post subject: Reply with quote

Surprised didnt know localtime TOOK time!
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Thu Apr 14, 2005 11:36 am    Post subject: Reply with quote

QUOTE(Dazzy @ Apr 14 2005, 02:15 AM)
Surprised didnt know localtime TOOK time!
[right][snapback]47753[/snapback][/right]


I thought I told you that before. Razz

Yeah... and to find out when epoch time started, do localtime(0). Razz localtime assumes the current time(), although some people put it in anyway like localtime(time).

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Modules & Add-ons All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group