How to get the exact Oracle Error message on a select without the text and store in variable
my ($ret) = $l_dbh->selectrow_array("select dummy from " . $l_dbh->quote_identifier($dblink, 'SYSIBM', "SYSDUMMY1") ); $ret; }; ...
my ($ret) = $l_dbh->selectrow_array("select dummy from " . $l_dbh->quote_identifier($dblink, 'SYSIBM', "SYSDUMMY1") ); $ret; }; ...
I am new to Moose and am trying to use it with DBIx::Class. Basic DBIC querying and updating work find, but any trigger I attempt to write does not get executed when I modify an attribute. use Modern::Perl; use Data::Dumper; my $schema = My::Schema->connect(<connect str>, <usr>, <psw>) or die $!; my $rs = $schema->resultset('Isin')->s...
I am looking for every occurence of a search term, e.g. ddd, in a file and output the surroundings, like this: File.txt aaa bbb ccc ddd eee fff ttt uuu iii eee ddd ddd ggg jjj kkk ddd lll output ccc ddd eee eee ddd ddd kkk ddd lll As a starting point, I am using this piece of code #!/usr/bin/perl -w while(<>) { while (/...
I'm building a perl application that interacts with a PostgreSQL database via the DBD::Pg module, and that uses Perl/Tk for it's GUI. It works fairly well on my system, but I'm designing it for a family member to use for their business. They don't have a c++ compiler and don't have a clue what CPAN is. The goal is to not bog them down by...
I have followin code in one legacy script: while (<FPTR>) # While still input lines in the file... { if($_ =~ /\x1b&d@ /) { $aa=$_; $aa =~ s/\x1b&d@ / \x1b&d@/; print STDOUT $aa; } ... } Could you please explain - what doe this code do and how to replace it with correct code? I do not like that there is a line feed ...
Hello! In my sms-script I read in the text to send with this subroutine: my $input = input( "Enter the input: " ); sub input { my $arg = shift; print $arg if $arg; print "\n "; chomp( my $in = <> ); return $in; } This way I can correct errors only through canceling all until I reach the error and this only in the ...
Let's say I have 10 threads running simultaneously. Is there any way of calling some method when a thread finishes? I was thinking of something like: $thread->onFinish(sub { print "I'm done"; }); ...
Hi there. At work we've found our test suite has got to the point that's it too slow to run repeatedly, which I really don't like. It's at least 5 minutes over the entire suite, and over 3 minutes for just the back-end data object tests. So, I'm curious to hear how people do their testing. At the moment, we have a single database serve...
I've read about fork and from what I understand, the process is cloned but which process? The script itself or the process that launched the script? For example: I'm running rTorrent on my machine and when a torrent completes, I have a script run against it. This script fetches data from the web so it takes a few seconds to complete. D...
Hello! I have a file named file with three lines: line one line two line three When I do this: perl -ne 'print if /one/' file I get this output: line one when i try this: perl -pe 'next unless /one/' file the output is: line one line two line tree I expected the same output with bot...
Hello! On http://sial.org/howto/perl/one-liner/ I found the following two one-liners. The outputs are different because the unless statement is different from if ! ( due to the associativity and precedence rules ). cat file: foo bar perl -ne 'print unless /^$/../^$/' file foo bar perl -ne 'print if ! /^$/../^$/' fi...
I have a big perl script (about 650 lines) that parses data off imdb.com, tvrage.com and can get data using last.fm API, and a few other sites. This script uses quite a few Perl modules so it takes a few seconds to load (on an old PC). What are the different ways (including any 'ugly hacks') in which the script can be sent quickly to the...
I'm currently doing some research on DBIx::Class in order to migrate my current application from Class::DBI. Honestly I'm a bit disappointed about the DBIx::Class when it comes to configuring the result classes, with Class::DBI I could setup metadata on models just by calling the on function without a code generator and so on my questio...
Possible Duplicates: How can I cleanly handle error checking in Perl? Whats broken about exceptions in Perl? I saw code which works like this: do_something($param) || warn "something went wrong\n"; and I also saw code like this: eval { do_something_else($param); }; if($@) { warn "something went wrong\n"; } Should ...
From perldoc -f each we read: There is a single iterator for each hash, shared by all each, keys, and values function calls in the program; it can be reset by reading all the elements from the hash, or by evaluating keys HASH or values HASH. The iterator is not reset when you leave the scope containing the each(), and this can le...
Is it possible one way or another to, within a Perl script, effectively execute grep against a Perl variable? An equivalent Perl function would be equally acceptable, I just want to keep the solution as simple as possible. For example: #!/usr/bin/perl #!/bin/grep $var="foobar"; $newvar="system('grep -o "foo" $var'); sprintf $newvar;...
I'm not too good with SQL and I know there's probably a much more efficient way to accomplish what I'm doing here, so any help would be much appreciated. Thanks in advance for your input! I'm writing a short program for the local school high school. At this school, juniors and seniors who have driver's licenses and cars can opt to drive...
I'm an absolute beginner at Perl, and am trying to use some non-core modules on my shared Linux web host. I have no command line access, only FTP. Host admins will consider installing modules on request, but the ones I want to use are updated frequently (DateTime::TimeZone for example), and I'd prefer to have control over exactly which ...
I have the following code my $db = DBI->connect( "dbi:SQLite:data.db", "", "", { RaiseError => 1, AutoCommit => 1, PrintError => 0 } ); my $row = $db->selectall_arrayref( "SELECT * FROM something WHERE name=\'$hash->{name}\'"); print Dumper $row; How do I do the same with my $sql = $db->prepare("......"); $sql->execute...
$w = 'self-powering'; %h = (self => 'self', power => 'pauә', ); if ($w =~ /(\w+)-(\w+)ing$/ && $1~~%h && $2~~%h && $h{$2}=~/ә$/) { $p = $h{$1}.$h{$2}.'riŋ'; print "$w:"," [","$p","] "; } I expect the output to be self-powering: selfpauәriŋ But what I get is: self-powering: [riŋ] My guess is something's wro...