If
you have a question on how to do something in Perl, or
you need a Perl solution to an actual real-life problem, or
you're unsure why something you've tried just isn't working...
then this section is the place to ask. Post a new question!
However, you might consider asking in the chatterbox first (if you're a
registered user). The response time tends to be quicker, and if it turns
out that the problem/solutions are too much for the cb to handle, the
kind monks will be sure to direct you here.
Hello Perl wise ones, forgive me if I'm having my usual frustration with installing Perl modules on Windows XP with ActiveState. I specifically want to install DBD::JDBC.
I don't see it in the list when running ppm, and "ppm install DBD-JDBC" doesn't find it.
ppm install DBD-JDBC
ppm install failed: Can't find any package that provides DBD-JDBC
I also tried installing DBD::ODBC and got an "authorization required" error, but I don't know where to "authorize." ERROR: 401 Authorization Required
I tried adding cpan to the repository list in ppm (http://www.cpan.org) but zero modules are added.
I tried installing with cpan. I get dozens of errors, including a C Compiler not being installed. Just running "cpan" gives me this:
It looks like you don't have a C compiler and make utility installed.
+ Trying
to install dmake and the MinGW gcc compiler using the Perl Package Man
+ager.
This may take a a few minutes...
Downloading MinGW-5.1.4.1...redirect
Downloading MinGW-5.1.4.1...failed 401 Authorization Required
ppm.bat install failed: 401 Authorization Required
It looks like the installation of dmake and MinGW has failed. You wil
+l not be
able to run Makefile commands or compile C extension code. Please che
+ck your
internet connection and your proxy settings!
cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.
I looked at the instructions for installing modules on cpan.org which says you need a C compiler: "(it's easy to get this setup - don't panic), see your OS of choice below to find out how to get the right compiler." ... but couldn't find any instructions on how to install this.
Perhaps this is all related to the authorization error? Any idea how I can get running here?
I have a structure I want to test for that comes back as a hash where one of the values is 'objects' which is an array of hash objects that have 2 fields that should always be present, but a 3rd field that may sometimes be present and sometimes not be present. When it is present I'd like to verify it with a re(...) comparison, but when it isn't present I'd like to prevent an error message telling me so... because it is optional! However if any other fields show up in there that aren't known optionals, I want to know about it. Does this make sense? How can I code this with Test::Deep?
I read through the doc on cpan and noticed the superhash stuff, but I wasn't sure how to apply it with this array situation and also in such a way that met my specific needs. Any counsel would be appreciated... thanks.
my $myObjs = {
alpha => re('^alpha(.*)'),
beta => re('\d+'),
#myOptionalField => re('^opt(.*)'), #sometimes there is a "myOpti
+onalField", but sometimes there is not. What to do?
};
cmp_deeply(
$response,
{
field1 => re('\d+'),
field2 => 2,
field3 => 1,
objects => array_each($myObjs)
},
'testing for valid response structure'
);
I've been reading the Perl 5.18 delta, and now that smartmatch is both experimental and depreciated I'm in a bit of a muck. I have a big project that uses given/when quite heavily (28 givens, 85 whens).
What is the recommended way to fix this? I know I can turn off the warning, but I'd rather fix the code. The documentation says that given/when is subject to big changes and might even go away, so disabling the warning is only a temporary fix. An automatic fix would be nice, but I don't mind doing all the work by hand. I have a good test suite, so I'm not concerned about breaking things.
I'd like to ask for suggestions to control a program running as a Windows service....stop, start, monitor, etc.
Shared memory doesn't look too practical (according to what I've found on CPAN)...I have considered a semaphore file which would be parsed at intervals.
I am newbie to perl and i am stuck in arranging the output. Here is my problem.
I have N number of files that i process and get data such as :
file 1 output :
a
b
c
file 2 output:
2
f
4
s
w
i want the final output to be like this (arranged in column and comma separated):
a,2
b,f
c,4
,s
,w
Please note that the number of files can be in 100's , so i cant simply use join function.
Thanks.
I have a file of blast results of different sequences. Some of them have "no hits found", and the others have hits.
How do I obtain the lines which have the results , ignoring the initial lines.
Here"s what a file looks like
BLASTX 2.2.26 [Sep-21-2011]
Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaff
+er,
Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997),
"Gapped BLAST and PSI-BLAST: a new generation of protein database sear
+ch
programs", Nucleic Acids Res. 25:3389-3402.
Query= XLOC_000039-chr1:983051-985037
(1987 letters)
Database: nr
26,236,801 sequences; 9,088,244,489 total letters
Searching..................................................done
Score
+ E
Sequences producing significant alignments: (bits
+) Value
ref|XP_002322127.1| autoinhibited H+ ATPase [Populus trichocarpa...
+195 2e-93
emb|CAD29314.1| plasma membrane H+-ATPase [Oryza sativa Japonica...
+213 1e-55
ref|NP_001048647.1| Os03g0100800 [Oryza sativa Japonica Group] >...
+213 1e-55
gb|EEC74325.1| hypothetical protein OsI_09609 [Oryza sativa Indi...
+213 1e-55
gb|EMT10609.1| ATPase 11, plasma membrane-type [Aegilops tauschii]
+208 3e-54
ref|XP_002511598.1| H(\+)-transporting atpase plant/fungi plasma...
+207 3e-54
ref|XP_002274074.1| PREDICTED: ATPase 7, plasma membrane-type is...
+207 5e-54
ref|XP_003633895.1| PREDICTED: ATPase 7, plasma membrane-type is...
+207 6e-54
gb|AAA34099.1| plasma membrane H+ ATPase, partial [Nicotiana plu...
+197 8e-54
ref|XP_003562242.1| PREDICTED: plasma membrane ATPase 1-like [Br...
+207 8e-54
ref|XP_002326870.1| autoinhibited H+ ATPase [Populus trichocarpa...
+206 1e-53
ref|XP_003529038.1| PREDICTED: plasma membrane ATPase 1-like iso...
+205 4e-53
so now i've created a text file which has the names of all those files without any hits.
Now i have to create another file with the names of those which have significatn hits, along with the first ten hits. Please help :(
I am working through my first CGI::Application module. I kind of like what I am seeing, and would like to continue on with it. I guess I am not married to it, so other options are available, but at this moment, it is what I am working with.
I was going to write a plugin of my own that took a MySQL table name and view name, and present the user with a CRUD based page. I was going to use as defaults (if the view did not already exist) the info I could extract from the MySQL DESCRIBE command.
I could then build a CGI::App module that used a specific view (the views info kept in another table), and build as many module/view combinations as I needed.
To try to make that make more sense, say there is a user_info table. Each "view" defines which fields can be seen, and which can be edited (the rest are invisible). The "user view" allows the user to update certain fields, see certain fields but not update them, the rest are invisible to them. The sysadmin could edit and view some fields. The HR folks could view/update certain fields, etc. I know -- this is a dumb example, but it does describe what I am wanting to do with the views.
My goal is one plugin that can automagically pull all of this off.
While casting about for ideas and/or an existing plugin, I found the BREAD plugin named above. I decided to try it out, and it failed. I spent a few hours tinkering about trying to get it to work. I just kept running into undocumented requirements.
In my research into this plugin, I noted it does not seem to have had any real work done on it in 8 years. So I am guessing it is no longer valid.
So my questions:
Has anyone used this plugin recently (currently)? What did you have to do to make it work?
Is there a more complete plugin available?
Is someone working on a plugin close enough to this that we can cartel our efforts?
I cannot imagine I am the first one to think of this idea and/or want to pull this kind of thing off, so I'm betting someone reading this has already invented the wheel, and is happily using it. Any help/pointers/etc would be greatly appreciated.