How can I identify if an item is a file or a directory using Net::SFTP?
How to identify whether the item of a directory is a file or a directory using Net::SFTP or ruby code? ...
How to identify whether the item of a directory is a file or a directory using Net::SFTP or ruby code? ...
I have created a tool to plot graphs using Perl and gnuplot. This is working fine but I just have an issue with the timefmt. I have many input data files with date and some are with time. So, I have created two separate tools with the below difference only. For the input files which have time I used set timefmt "%H:%M:%S" set format ...
I need to do things in 2 steps here: modify all occurences of [xx_someText] with [someText] modify all occurences of [someText] with [SomeText] I need this in 2 regex because some table names are not prefixed with xx_ I am on a windows machine. I have access to unix, BUT I am using the GIT bash utility which seems to have sed and...
Hi, I'm with some difficulties in make this. I have a login HTML form, and I want to know if the user and password match with the information in my MySQL server. What is the best way to do it? Thank you very much ...
I'm using pQuery (a Perl port of jQuery) to select elements and retrieve text from a HTML-document. Consider the following markup: <x> <y>code1</y> <z>stuff</z> <y>code2</y> <z>foobar</z> </x> And the following pQuery code: my $target_value = pQuery($markup)->find($pquery_selector)->text; I'm trying to formulate $pquer...
I can query the SQL server DB fine. The problem happens when I try and query a view. I'm not trying to do anything crazy: $sql = 'select * from location_v'; $stj = $db_destination->prepare($sql); It keeps dying on the prepare line. Here's what I'm getting back (which isn't all that useful): DBD::ODBC::db prepare failed: (DBD: st...
Are there any reasons to ever use the two-argument form of open(...) in Perl rather than the three-or-more-argument versions? The only reason I can come up with is the obvious observation that the two-argument form is shorter. But assuming that verbosity is not an issue, are there any other reasons that would make you choose the two-arg...
Here's something weird that I can't figure out. I have a Moose class that I also want to export some constants, using the age-old standard Exporter module. However, as soon as I add extends Exporter to my class, for some reason, the default Moose constructor no longer gets inherited and I get the fatal error: Can't locate object method ...
Suppose i have the following Moose package: package GSM::Cell; use Moose; has 'ID' => (is => 'ro', required => 1); has [qw(BCCH NEIGHBOUR)] => (is => 'rw', default => undef); no Moose; __PACKAGE__->meta->make_immutable; 1; I then create two objects and add the one as the 'NEIGHBOUR' attribute of the other: my $a = GSM::Cell->new(I...
I was asked to write a Perl-to-Python and Perl-to-Ruby (and vice versa) code translator by an evil boss, and therefore I'm curious to know if some automatic code translators between them exist already. Just by googling it, I found Perthon, plus endless discussions and dead projects trying to do this. In your opinion, is there a standard...
I have a text file which contains: Cycle code Cycle month Cycle year Event type ID Event ID Network start time I want to change this text so that when ever there is a space, I want to replace it with a _. And after that, I want the characters to lower case letter like below: cycle_code cycle_month cycle_year event_type_id event_id ne...
Hi! When I write #!/usr/bin/perl -w use strict; while( <DATA> ) { print "\n-------------------------\n\n"; print; <>; } after each "return" I get one line. Why don't I get with the next script after each "return" one paragraph? #!/usr/bin/perl -w use strict; local $/ = ""; while( <DATA> ) { print "\n-------------...
On Win32, I wonder how to detect whether Left Shift or Right ALT is pressed using Perl, Python, or Ruby (or even in C)? Not just for the current window, but the global environment overall. Example: when I am typing a document, I can press Right ALT to start the music player written in Ruby, and then press Right ALT again and it can p...
I want to pass a serialized Perl data structure as a GET variable to a CGI application. I tried Data::Serializer as my first option. Unfortunately the serialized string is too long for my comfort, in addition to containing options joined by '^' (a caret). Is there a way I can create short encoded strings from perl data structures so tha...
Let's say I have something like this (this is only an example, actual request will be different: I loaded StackOverflow with LiveHTTPHeaders enabled to have some samples to work on): http://stackoverflow.com/ GET / HTTP/1.1 Host: stackoverflow.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070220 Firefox/2...
I'm writing a module that has some functions dealing with text files. I'm new to testing, so I decided to go with Test::More. Here's how my test file looks like now: use mymod; use 5.10.0; use strict; use warnings; use Test::More 'no_plan'; my $file_name = "test.file"; sub set_up { my $self = shift; open(my $handle,">",$file_n...
Suppose I have: my $a = "http://site.com"; my $part = "index.html"; my $full = join($a,$part); print $full; >> http://site.com/index.html What do I have to use as join, in order to get my snippet to work? EDIT: I'm looking for something more general. What if a ends with a slash, and part starts with one? I'm sure in some module, some...
While reading the snippets provided by FormFiller ( where I kinda got by accident ) , I noticed this line: $f->add_filler( password => Interactive => []); Is this password => Interactive => [] equivalent to {"password" => {"Interactive"=>[]}}? If not, what does it become? ...
I would like to simply declare a read only attribute in Moose that cannot be initialized in a call to new. So after declaring the following: package SOD::KuuAnalyze::ProdId; use Moose; has 'users' => (isa => 'ArrayRef[Str]', is => "ro"); 1; I do not want the following to work: my $prodid = SOD::KuuAnalyze::ProdId->new(users => ["...
When writing Perl scripts I frequently find the need to obtain the current time represented as a string formatted as YYYY-mm-dd HH:MM:SS (say 2009-11-29 14:28:29). In doing this I find myself taking this quite cumbersome path: man perlfunc /localtime to search for localtime - repeat five times (/ + \n) to reach the relevant section of...