Sponsored Content
Top Forums Shell Programming and Scripting Perl : unable to frame code with Business:Hours module with example Post 302822635 by scriptscript on Tuesday 18th of June 2013 03:51:12 AM
Old 06-18-2013
Perl : unable to frame code with Business:Hours module with example

Hi all ,

There are two datetimes in the below format

$datetime1="2007-12-31 16:50:00";
$datetime2="2008-1-1 04:24:00";

I need to calculate time in minutes only in between the office hours.(08:00 to 18:00 ). in PERL.

For the above requirement I found a module Business::Hours that calculates the time in seconds after which I can calculate in minutes or hours.

But I am struggling to frame the code using the above module.

Could anyone please explain the module with relevant example?

Thanks in advance....

Code:
  use Business::Hours;
  $hours = Business::Hours->new();    
  # Get a Set::IntSpan of all the business hours in the next week.
  # use the default business hours of 9am to 6pm localtime.
  
  my %hours = (
        0 => { Name     => 'Sunday',
               Start    => '08:00',
               End      => '18:00' },

        1 => { Name     => 'Monday',
               Start    => '08:00',
               End      => '18:00' },
        
        2 => { Name     => 'Tuesday',
               Start    => '08:00',
               End      => '18:00' },

        3 => { Name     => 'Wednesday',
               Start    => '08:00',
               End      => '18:00' },

        4 => { Name     => 'Thursday',
               Start    => '08:00',
               End      => '18:00' },
        
        5 => { Name     => 'Friday',
               Start    => '08:00',
               End      => '18:00' },

        6 => { Name     => 'Saturday',
               Start    => '08:00',
               End      => '18:00' },
        ,
    );  


print $hours->for_timespan( Start => time(), End => time()+(86400*7) );
  
  
  print $hours->{$0};

print $hours->for_timespan(%hours);

link for the above module
Code:
http://search.cpan.org/dist/Business-Hours/lib/Business/Hours.pm#___top

Once again thanks ...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace Perl Module name in all Perl scripts

I want to replace a Perl module name in all my Perl Scripts in the cgi-bin directory. How is it possible? I have the following statement in my scripts use myUtil; I want to change it to use myUtil777; Regards, Rahul (2 Replies)
Discussion started by: rahulrathod
2 Replies

2. Solaris

Unable to load module

Hey guys i got this error in my messages: warning : mod_load: cannot load module sbd - I dont know anything about this. - How do i verify if there is a module sbd - What are the reasons modules cant be loaded (1 Reply)
Discussion started by: sbn
1 Replies

3. Solaris

unable to detect new cpu/memory module

Hi all, I just add in new cpu/memory module into SFV480 and unable to see new module on slot B. I already try many way like only 1 new module and swap the both module and boot up but still unable to see it. If I only install the module into slot B, then the server is unbootable at all. I... (1 Reply)
Discussion started by: mailbox80
1 Replies

4. OS X (Apple)

Unable to install Perl module via CPAN

Hi, I am trying to install Unicode::String from the cpan shell, and here is what I get: Checking if your kit is complete... Looks good Writing Makefile for Unicode::String cp String.pm blib/lib/Unicode/String.pm cp lib/Unicode/CharName.pm blib/lib/Unicode/CharName.pm... (3 Replies)
Discussion started by: psychomachine
3 Replies

5. Shell Programming and Scripting

calling perl subroutine from perl expect module

All, Is it possible to call a subroutine from the perl expect module after logging to a system that is within the same program. My situation is I need to run a logic inside a machine that I'm logging in using the expect module, the logic is also available in the same expect program. Thanks,... (5 Replies)
Discussion started by: arun_maffy
5 Replies

6. Shell Programming and Scripting

Unable to Install "Devel-Profile" perl module in windows.

Hi, I want to install 'Devel-Profile' in windows but i am not able to install. Here is the error. PPM> install Devel-Profile Install package 'Devel-Profile?' (y/N): y Installing package 'Devel-Profile'... Error installing package 'Devel-Profile': Could not locate a PPD file for... (3 Replies)
Discussion started by: vanitham
3 Replies

7. Infrastructure Monitoring

Nagios - alert during business hours

Is there a way for certain nagios alerts to only alert during business hours? (1 Reply)
Discussion started by: streetfighter2
1 Replies

8. Shell Programming and Scripting

Unable to install module using cpan

Hi, I am unable to install module using cpan. It says 407 Proxy Authentication Required I did setup proxy server and given username and password in .bashrc file and apt.conf file. export http_proxy=http://username:password@proxyserver:portno/ However, still unable to install... (1 Reply)
Discussion started by: Anjan1
1 Replies

9. Shell Programming and Scripting

awk : Search for text between two time frame (12 hours)

I have created the script to grep the errors from weblogic logs files and redirecting output to file.txt ...From file.txt I'm using awk command to collect the past 20 mins output...The script running from cron every 15 mins... The script working well... Now the challenges, I'm trying to use... (27 Replies)
Discussion started by: zenkarthi
27 Replies

10. Shell Programming and Scripting

CGI Perl : only frame is getting updated

I am working on CGI perl and trying to overcome the below problem.. I have divided the page into 3 frames( attached the screenshot) how to my frameset look like. In frame2, there will be a cgi script consisting on names(links), when clicked on link , the frame3 should get changed. But in... (1 Reply)
Discussion started by: scriptscript
1 Replies
Business::OnlinePayment::TransactionCentral(3pm)	User Contributed Perl Documentation	  Business::OnlinePayment::TransactionCentral(3pm)

NAME
Business::OnlinePayment::TransactionCentral - Transaction Central backend module for Business::OnlinePayment SYNOPSIS
use Business::OnlinePayment; #### # One step transaction, the simple case. #### my $tx = new Business::OnlinePayment("TransactionCentral"); $tx->content( type => 'CC', login => '10011', #MerchantID password => 'KK48NPYEJHMAH6DK', #Regkey action => 'Normal Authorization', description => 'Business::OnlinePayment test', amount => '49.95', name => 'Tofu Beast', address => '123 Anystreet', city => 'Anywhere', state => 'UT', zip => '84058', phone => '420-867-5309', email => 'tofu.beast@example.com', card_number => '4012000000001', expiration => '08/06', cvv2 => '1234', #optional ); $tx->submit(); if($tx->is_success()) { print "Card processed successfully: ".$tx->authorization." "; } else { print "Card was rejected: ".$tx->error_message." "; } =head1 DESCRIPTION This is a Business::OnlinePayment backend module for the Transaction Central (MerchantAnywhere, PRIMerchants) gateway. It is only useful if you have a merchant account with MerchantAnywhere / PRIMerchants: http://www.merchantanywhere.com/ http://www.merchantanywhere.com/ecshop/TC_elink.htm http://www.primerchants.com/ http://www.primerchants.com/info/transactioncentral.asp SUPPORTED TRANSACTION TYPES
CC, Visa, MasterCard, American Express, Discover Content required: type, login, password, action, amount, card_number, expiration, name, address, zip. ECHECK Content required: type, login, password, action, amount, account_number, routing_code, name PREREQUISITES
URI::Escape Net::SSLeay _or_ ( Crypt::SSLeay and LWP ) DESCRIPTION
For detailed information see Business::OnlinePayment. NOTE
The newest publicly available documentation is available at: http://www.merchantanywhere.com/ecshop/TC%20Interface%20NEW.pdf It is somewhat out-of-date and contains a few discrepancies. Google "TCInterfaceGuide" for current documentation. AUTHOR
Ivan Kohler <ivan-transactioncentral@420.am> COPYRIGHT AND LICENSE
Copyright (C) 2006 by Ivan Kohler Copyright (C) 2007 Freeside Internet Services, Inc. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl(1). Business::OnlinePayment. perl v5.8.8 2008-02-27 Business::OnlinePayment::TransactionCentral(3pm)
All times are GMT -4. The time now is 08:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy