From what I understand, %04x pads the first element with 0s to make up 4 digits in hex, and is assigned to variable counter. After this, we print the rest of the line as a string.
However I cannot understand why we need counter+=NF in this case, as NF should be 16. Can you please explain this logic? Can we use something else to accomplish this (i.e for loop).
hi,
for reading a cobol indexed file i need to convert "mmddyy" date format to "ccyyddd" format.
i checked the datecalc and other scripts but couldnt modify them to cater to my need:(...
The datecalc gives an output which i believe is the total days till that date, but i want to convert it... (2 Replies)
:) Hi
i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error
Function i used it as
$ iconv -f UTF8 -t ANSI filename
Error iam getting is NOT Supported UTF8 to ANSI
please some help me out on this.........Let me... (1 Reply)
:confused: Hi
i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error
Function i used it as
$ iconv -f UTF8 -t ANSI filename
Error iam getting is NOT Supported UTF8 to ANSI
please some help me out on... (9 Replies)
Hi
I have a file which has ascii , binary, binary decimal coded,decimal & hexadecimal data with lot of special characters (like öƒ.ƒ.„İİ¡Š·œƒ.„İİ¡Š· ) in it. I want to standardize the file into ASCII format & later use that as source .
Can any one suggest a way a logic to convert such... (5 Replies)
Hello everybody,
I am having problem in converting byte array variables to Hexa String variables for Linux. I have done, converting byte array variables to Hexa String variables for Windows but same function doesn't work for linux. Is there any difference in OS ? The code for Windows is given... (2 Replies)
I have a file named "suspected" with series of line like these :
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent... (3 Replies)
I have a comma delimited log file which has the date as MM/DD/YY in the 2nd column, and HH:MM:SS in the 3rd column.
I need to change the date format to YYYY-MM-DD and merge it with the the time HH:MM:SS. How will I got about this?
Sample input
02/27/09,23:52:31
02/27/09,23:52:52... (3 Replies)
Hi All,
Is there any way to convert a file which is in UNIX format to a PC format....
Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (1 Reply)
Hi All,
Is there any way to convert a file which is in UNIX format to a PC format....
Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (2 Replies)
Hi Folks,
I have written a perl script that reads data from excel sheet(.xls) using Spreadsheet::ParseExcel module. But the problem is this module doesn't work for excel sheets with extension .xlsx.
I have gone through Spreadsheet::XLSX module with which we can read from .xlsx file directly.... (1 Reply)
Discussion started by: giridhar276
1 Replies
LEARN ABOUT DEBIAN
moosex::attributehelpers::trait::counter
MooseX::AttributeHelpers::Trait::Counter(3pm) User Contributed Perl Documentation MooseX::AttributeHelpers::Trait::Counter(3pm)NAME
MooseX::AttributeHelpers::Counter - simple counter attribute
SYNOPSIS
package MyHomePage;
use Moose;
use MooseX::AttributeHelpers;
has 'counter' => (
metaclass => 'Counter',
is => 'ro',
isa => 'Num',
default => sub { 0 },
provides => {
inc => 'inc_counter',
dec => 'dec_counter',
reset => 'reset_counter',
}
);
my $page = MyHomePage->new();
$page->inc_counter; # same as $page->counter($page->counter + 1);
$page->dec_counter; # same as $page->counter($page->counter - 1);
DESCRIPTION
This module provides a simple counter attribute, which can be incremented and decremeneted.
If your attribute definition does not include any of is, isa, default or provides but does use the "Counter" metaclass, then this module
applies defaults as in the "SYNOPSIS" above. This allows for a very basic counter definition:
has 'foo' => (metaclass => 'Counter');
$obj->inc_foo;
METHODS
meta
method_provider
has_method_provider
helper_type
process_options_for_provides
Run before its superclass method.
check_provides_values
Run after its superclass method.
PROVIDED METHODS
It is important to note that all those methods do in place modification of the value stored in the attribute.
set Set the counter to the specified value.
inc Increments the value stored in this slot by 1. Providing an argument will cause the counter to be increased by specified amount.
dec Decrements the value stored in this slot by 1. Providing an argument will cause the counter to be increased by specified amount.
reset
Resets the value stored in this slot to it's default value.
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to
cpan-RT.
AUTHOR
Stevan Little <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2007-2009 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2010-01-02 MooseX::AttributeHelpers::Trait::Counter(3pm)