|
|
Up |
|
|
  |
Author: Ben MorrowBen Morrow
Date: Mar 18, 2008 18:03
Quoth Ron Eggler example.com>:
> Hi,
>
> I get a "called too early to check prototype at" in my script and i have no
> idea what this is referring to.It is pointing to this line:
> for(my $count = 0; $count < scalar(@dbset); $count++){ which sits on top of
> my file and is part of:
> use DBI;
> #
> # Open the DB connection
> #
> my @dbset=(xmlparse($nemsconf,"DBNAME"));
Have you by any chance declared xmlparse below like this
sub xmlparse() {
? This is not how you declare a Perl sub. Remove the ().
If not, you will need to reduce your problem to a *small*
*self-contained* program *we can all run*, or we can't help you.
Ben
|
| |
|
| |
no comments
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Mar 18, 2008 18:03
This is an excerpt from the latest version perlfaq7.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
7.4: How do I skip some return values?
One way is to treat the return values as a list and index into it:
$dir = (getpwnam($user))[7];
Another way is to use undef as an element on the left-hand-side:
($dev, $ino, undef, undef, $uid, $gid) = stat($file);
You can also use a list slice to select only the elements that you need:
($dev, $ino, $uid, $gid) = ( stat($file) )[0,1,4,5];
--------------------------------------------------------------------
|
| Show full article (1.41Kb) |
|
| |
no comments
|
|
  |
Author: Jürgen ExnerJürgen Exner
Date: Mar 18, 2008 18:01
Ron Eggler example.com> wrote:
>Hi,
>
>I get a "called too early to check prototype at" in my script and i have no
>idea what this is referring to.It is pointing to this line:
>for(my $count = 0; $count < scalar(@dbset); $count++)
This can be rewritten in a much easier to read way as
for my $count (0..@dbset-1)
>for(my $count = 0; $count < scalar(@dbset); $count++){
> my $myDBI = 'DBI:mysql:' . $dbset[$count] . ':localhost';
> my $dbh = DBI->connect($myDBI,'root','novax')
> or die "Couldn't connect to database: " . DBI->errstr . "\n";
However, as you don't do anything with $count but to index the array in a
linear fashion it is even easier to use a simple
for(@dbset){
my $myDBI = "DBI:mysql:$_ :localhost";
....
jue
|
| |
|
4 Comments |
|
  |
Author: NospamNospam
Date: Mar 18, 2008 16:29
After force upgrading a module, I tried to search the ppm repository and I
met this error msg:
Searching in Active Repositories
error: can't parse
Nagios-NSCA
Use the Amazon Simple Queue Service
Leon Brocard C<acme@astray.com>
:
mismatched tag at line 4, column 52, byte 136 at
c:/Perl/site/lib/XML/Parser.pm
line 187
Also on any script I try to run I get this error msg:
Can't locate object method "decoded_content" via package "HTTP::Headers" at
(eva
l 16) line 1.
line 1 is usually the line
#! /usr/bin/perl
|
| Show full article (0.73Kb) |
|
no comments
|
|
  |
Author: Ron EgglerRon Eggler
Date: Mar 18, 2008 13:57
Hi,
I would like to open a file for appending content and create it if it
doesn't exist. I have been trying to do all I can but it just wouldn't open
it. My code looks like:
@files = ; #path where the log files are saved
my $key_indicator="----Public key----"; #string that specifies that there
is an ssh public key in the next lines and it will need to be appended to
~/.ssh/authorized_keys
my $key_file="~/.ssh/authorized_keys"; #path the the authorized-keys file
foreach $file (@files) { # read out the directory content
print "parse file ".$file.":\n";
file_parser($file);
}
sub file_parser
{
$file = $_[0]; # get 1st parameter (filename)
open(INFO, $file); #opens file systemstats
@lines = ; ...
|
| Show full article (1.73Kb) |
|
5 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Mar 18, 2008 12:03
This is an excerpt from the latest version perlfaq6.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
6.17: Why don't word-boundary searches with "\b" work for me?
(contributed by brian d foy)
Ensure that you know what \b really does: it's the boundary between a
word character, \w, and something that isn't a word character. That
thing that isn't a word character might be \W, but it can also be the
start or end of the string.
It's not (not!) the boundary between whitespace and non-whitespace, and
it's not the stuff between words we use to create sentences.
In regex speak, a word boundary (\b) is a "zero width assertion",
meaning that it doesn't represent a character in the string, but a
condition at a certain position.
|
| Show full article (3.21Kb) |
|
no comments
|
|
  |
Author: Dave HammondDave Hammond
Date: Mar 18, 2008 11:41
For those who are thinking "just install the MySQL ODBC driver and
point Crystal to it", bear with me...
Most users connect to our MySQL databases via web applications. The
web apps and databases live on hosts which are in a "DMZ" segment of
our network, thus protecting our LAN from any direct Internet access.
However, in addition to the web apps, some power users use Crystal
Reports to directly access the databases, in exactly the manner you
might have assumed -- via the MySQL ODBC driver.
We have been tasked with moving the MySQL databases off the DMZ hosts
and into the LAN. This won't cause problems for the web apps, however
the Crystal users will be S.O.L. unless we can install some kind of
middleware app which lives in the DMZ and shuttles data between
Crystal and the MySQL databases.
I was thinking that we might be able to use DBD::ODBC for such an
app. Ideally, Crystal would connect to the middleware app via
DBD::ODBC, the app would validate and forward the SQL query to the
MySQL server, and then shuttle the results back to Crystal.
|
| Show full article (1.29Kb) |
|
3 Comments |
|
  |
Author: MikeMike
Date: Mar 18, 2008 11:00
I'm working on a program to help with my site's mail filtering. I'm
using Net::Blacklist::Client and the module for the most part works.
Is there a return code passed back from $res->search($peeraddr)
that says the site is definitly on a blacklist or do I need to
search the {'txt'} key for 'v=spf1 -all' and 'spam'?
Mike
|
| |
|
2 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Mar 18, 2008 06:03
This is an excerpt from the latest version perlfaq6.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
6.4: I put a regular expression into $/ but it didn't work. What's wrong?
$/ has to be a string. You can use these examples if you really need to
do this.
If you have File::Stream, this is easy.
use File::Stream;
my $stream = File::Stream->new(
$filehandle,
separator => qr/\s*,\s*/,
);
print "$_\n" while <$stream>;
If you don't have File::Stream, you have to do a little more work.
|
| Show full article (2.39Kb) |
|
no comments
|
|
  |
|
|
  |
|
|
|
|
|
|
|