| CPAN Ratings Reviews by Nikolay Nishin | |
| Home | Search | About | Bitcard Account | Login |
very good for old version of Perl
I use instead of ~~
folowing:
use Modern::Perl;
use List::MoreUtils qw(any);
my @list=qw{boots balls smelt};
my $search_value='balls';
my $not_found_value='gnome';
foreach my $sv($search_value,$not_found_value){
if (any { $_ eq $sv } @list) {
print "$sv found\n";
}else{
print "$sv not found\n";
};
}
Nikolay Nishin - 2012-05-18T07:35:16
very good, I will also add example:
use Data::Page;
use Modern::Perl;
#my $page = Data::Page->new();
my $total_entries = 1500;
my $entries_per_page = 900;
my $current_page = 1;
my @array=1..$total_entries;
#say "@array";
my $page = Data::Page->new( $total_entries, $entries_per_page, $current_page );
my $i;
for ( $i = 1 ; $i <= $page->last_page ; $i++ ) {
say $i;
$page->current_page($i);
my @curr=@array[$page->first-1 .. $page->last-1];
say "@curr";
}
gist.github.com/2414089
Nikolay Nishin - 2012-04-18T07:57:05
it seems to be good, but simple script(in example):
use MyTest;
use Test::More tests => 4;
Test::DataDriven->run;
__END__
=== Test 1
--- add1 chomp
3
--- result
4
=== Test 1
--- add1 chomp
7
--- result
8
-------------------------
don't work
C:\Users\nmishin\Documents\db\20120409\t>perl -Ilib start.t
1..4
Undefined subroutine &MyTest::add_1 called at lib/MyTest.pm line 16, <DATA> line
1.
# Looks like your test exited with 255 before it could output anything.
Nikolay Nishin - 2012-04-09T03:03:47
cool editor, good job
Nikolay Nishin - 2012-02-28T00:20:32
thanks a lot,
very useful module,
I think these module must go in standart perl5 distribution
my $total1 = du( { recursive => 0 } , <data/*.xml> );
my $total2 = du( { recursive => 0 } , <data/message.*> );
### $total1
### $total2
Nikolay Nishin - 2012-02-03T01:48:22
super module, most useful!! thank you
Nikolay Nishin - 2011-11-29T00:35:56
i devoted fan of this module
Nikolay Nishin - 2011-11-26T14:45:26
best module, very good, automate putty gist.github.com/1382756
another code:
#!perl -w
#
# Create directory in totalcmd with name of date
#
use strict;
use Win32::GuiTest qw(:ALL);
use Win32::Clipboard;
use POSIX qw(strftime);
my @windows = FindWindowLike( 0, "Total", "" );
die "Could not find Total\n" if not @windows;
SetForegroundWindow( $windows[0] );
&send_keys;
sub send_keys {
my $dir=strftime( '%Y%m%d', localtime(time) );
my $CLIP = Win32::Clipboard();
$CLIP->Set($dir);
$CLIP->WaitForChange();
SendKeys("{F7}");
SendKeys("^V");
#SendKeys("$dir");
SendKeys("{ENTER}");
SendKeys("{ENTER}");
}
Nikolay Nishin - 2011-11-21T09:03:29
but may be on windows use $ENV{USERPROFILE}
or add such code:
our $is_windows;
$is_windows = ( $^O =~ /MSWin32/ );
if ( ( !defined $ENV{HOME} ) and $is_windows ) {
$ENV{HOME} = $ENV{USERPROFILE};
}
# Locate the home directory...
if ( !defined $ENV{HOME} ) {
print 'Please enter the full path of your home directory: ';
$ENV{HOME} = <>;
chomp $ENV{HOME};
croak 'Not a valid directory. Aborting.'
if !-d $ENV{HOME};
}
true module-starter still does not know anything about the $ENV{USERPROFILE}
and it just will not use it
then turns to module-starter and change it
or add Home env with such reg file(win7) home.reg:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
"HOME"="%USERPROFILE%"
Nikolay Nishin - 2011-11-03T02:56:16
it's not work on windows
prove -l -Q --formatter=TAP::Formatter::HTML check_data.pl > out13.html 2>&1
and i see error in out13.html :
Warning: couldn't read C:%5Cstrawberry%5Cperl%5Csite%5Clib%5CTAP%5CFormatter%5CHTML%5Cdefault_page.css: file does not exist!
Warning: couldn't read C:%5Cstrawberry%5Cperl%5Csite%5Clib%5CTAP%5CFormatter%5CHTML%5Cdefault_report.css: file does not exist!
what should i do?
Nikolay Nishin - 2011-11-02T03:53:27
use the module Attribute:: Signature
is also not suitable because of an error (warning on perl -c)
CODE package attribute may clash with future reserved word: returns at - line 46
CODE package attributes may clash with future reserved words: with: returns at - line 60
#!/usr/bin/perl
##############################################################################
# $URL: mishin.narod.ru $
# $Date: 2011-11-01 16:32:04 +0400 (Nov, 01 Nov 2011) $
# $Author: mishnik $
# $Revision: 1.02 $
# $Source: test check variables $
# $Description: check input parameters of function
# $ Domian Conway in PBP offer to use croak, is it correct? $
# 01-11-2011:
# put question to
# stackoverflow.com/questions/7963866/i...
##############################################################################
use strict;
use warnings;
use 5.010;
use Carp qw(cluck carp);
use Data::Dumper;
use Readonly;
#use autodie;
use Attribute::Signature;
our $VERSION = '0.01';
#run main procedure
main();
sub main : returns(integer) {
#make test for chack input parameters
Readonly my $CHECK_LEVEL => 100;
my %filials;
my $ref_hash = \%filials;
my @test = qw/444 33a 2 d 300 ffd 22/;
my $ret;
for my $test_val (@test) {
$ref_hash->{foo} = $test_val;
$ret = test_var( $ref_hash->{foo}, $CHECK_LEVEL )
|| carp("couldn't invoke test_var \%filials, $CHECK_LEVEL ");
}
return 1;
}
sub test_var : with(integer, integer) returns(integer) {
my $evaluated_value = shift;
my $check_value = shift;
#check values by business rule
if ( $evaluated_value > $check_value ) {
say "$evaluated_value > $check_value";
}
else {
say "$evaluated_value <= $check_value";
}
return 1;
}
Nikolay Nishin - 2011-11-02T00:19:47
very good editor. super, wait next version,
many thanks for developers
Nikolay Nishin - 2011-09-27T09:20:33
good
Nikolay Nishin - 2011-04-29T09:33:14
|
Perl.org sites
: bugs
| dev
| history
| jobs
| learn
| lists
| use
Site Information and Contacts |
|