I am facing a strange error while creating posix threads:
Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output.
Snippet 1
This works:
--------------
int *threadids;
threadids = (int *) malloc (num_threads * sizeof(int));
... (4 Replies)
Hi,
can I use array elements ( all ) in conditional statements?
the problem is ,the total number of elements is not known.
e.g
A is an array with elements - 1,2,3
now if i want to test if the 1 st field of input record is either 1,2 or 3, i can do something like this
if ( $1 ~... (1 Reply)
Hi,
I want to check a particular string inserted by User to be checked against the values i already have in a ARRAY string using IF condition. Is this possible? if yes how to do that.
example :
i have a,b,c,d,e,f values in a array called values
i asked user to enter a value:
user entered... (2 Replies)
Hello,
I want to check if all element of an array have the same value regardless the length of the array.
example:
@array1 = qw(44 44 44 44);
@array2 = qw(55 55 55 55 55 55 55);
Please advice,
Ahmed (11 Replies)
Executed the following if conditions .. and got different results .
only (( )) gave correct o/p with all scenarios .
Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition.
And why each condition gave different result.
1.... (2 Replies)
hi,
I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command
Here are my simple script
After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
I have an array and two variables as below,
I need to check if $datevar is present in $filename.
If so, i need to replace $filename with the values in the array.
I need the output inside an ARRAY
How can this be done.
Any help will be appreciated. Thanks in advance. (2 Replies)
Hello experts,
I'm stuck with this script for three days now. Here's what i need.
I need to split a large delimited (,) file into 2 files based on the value present in the last field.
Samp: Something.csv
bca,adc,asdf,123,12C
bca,adc,asdf,123,13C
def,adc,asdf,123,12A
I need this split... (6 Replies)
HI
My doubt may be basic one but I need to get it clarified..
When i use "if" condition that checks for many AND, OR logical conditions
like
if ]; then
return 0
fi
Even the if condition fails it returns as zero.. Any clue..
But if i add else condition like
if ]; ... (2 Replies)
I want to build an Errorlog. I would like to build an array as I move through the if statements and print the array once all error conditions have been defined. The results need to be comma delimited.
tsver will be static "1.9.6(2)"
other vars $prit $lt $rt can have the same or a different... (1 Reply)
Discussion started by: popeye
1 Replies
LEARN ABOUT MOJAVE
moose::autobox5.18
Moose::Autobox(3) User Contributed Perl Documentation Moose::Autobox(3)NAME
Moose::Autobox - Autoboxed wrappers for Native Perl datatypes
SYNOPOSIS
use Moose::Autobox;
print 'Print squares from 1 to 10 : ';
print [ 1 .. 10 ]->map(sub { $_ * $_ })->join(', ');
DESCRIPTION
Moose::Autobox provides an implementation of SCALAR, ARRAY, HASH & CODE for use with autobox. It does this using a hierarchy of roles in a
manner similar to what Perl 6 might do. This module, like Class::MOP and Moose, was inspired by my work on the Perl 6 Object Space, and the
'core types' implemented there.
A quick word about autobox
The autobox module provides the ability for calling 'methods' on normal Perl values like Scalars, Arrays, Hashes and Code references. This
gives the illusion that Perl's types are first-class objects. However, this is only an illusion, albeit a very nice one. I created this
module because autobox itself does not actually provide an implementation for the Perl types but instead only provides the 'hooks' for
others to add implementation too.
Is this for real? or just play?
Several people are using this module in serious applications and it seems to be quite stable. The underlying technologies of autobox and
Moose::Role are also considered stable. There is some performance hit, but as I am fond of saying, nothing in life is free. Note that this
hit only applies to the use of methods on native Perl values, not the mere act of loading this module in your namespace.
If you have any questions regarding this module, either email me, or stop by #moose on irc.perl.org and ask around.
Adding additional methods
Moose::Autobox asks autobox to use the Moose::Autobox::* namespace prefix so as to avoid stepping on the toes of other autobox modules.
This means that if you want to add methods to a particular perl type (i.e. - monkeypatch), then you must do this:
sub Moose::Autobox::SCALAR::bar { 42 }
instead of this:
sub SCALAR::bar { 42 }
as you would with vanilla autobox.
METHODS
mixin_additional_role ($type, $role)
This will mixin an additional $role into a certain $type. The types can be SCALAR, ARRAY, HASH or CODE.
This can be used to add additional methods to the types, see the examples/units/ directory for some examples.
TODO
More docs
More tests
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>
with contributions from:
Anders (Debolaz) Nor Berle
Matt (mst) Trout
renormalist
COPYRIGHT AND LICENSE
Copyright 2006-2008 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.18.2 2013-10-27 Moose::Autobox(3)