[22159] in Perl-Users-Digest
Perl-Users Digest, Issue: 4380 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 10 18:07:08 2003
Date: Fri, 10 Jan 2003 15:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 10 Jan 2003 Volume: 10 Number: 4380
Today's topics:
Re: ActiveState PerlApp with SWIG dll (Andrew Allaire)
Re: Converting CGI to XML <bongie@gmx.net>
Re: How does one Iterate an array to remove duplicates? <bongie@gmx.net>
Re: How does one Iterate an array to remove duplicates? <bongie@gmx.net>
Re: Matching entries in lists (h\)
Re: My, our, etc. <tassilo.parseval@post.rwth-aachen.de>
Re: My, our, etc. (Jay Tilton)
net-snmp tkmib <slurper1234@hotmail.com>
Re: net-snmp tkmib <slurper1234@hotmail.com>
Re: Net::Mysql - capture error messages <tapkin@rol.ru>
newline "\n" not working (bazzz777)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Jan 2003 12:40:49 -0800
From: Andrew.Allaire@na.teleatlas.com (Andrew Allaire)
Subject: Re: ActiveState PerlApp with SWIG dll
Message-Id: <6bdb91de.0301101240.43be9d23@posting.google.com>
Andrew.Allaire@na.teleatlas.com (Andrew Allaire) wrote in message news:<6bdb91de.0301091542.3bc627df@posting.google.com>...
> After looking for answers via lurking for quite some time, I have
> finally signed up to post my latest dilema. If anyone has a quick
> answer without troubling yourself to go into great detail...is there
> any special trick to building a perlApp application which uses a dll
> created with SWIG?
Well I found the answer to my dilema. No special trick, I just had to
put the dll file in a directory called auto/<module name> where it
appears perlApp expected to find it.
------------------------------
Date: Fri, 10 Jan 2003 21:03:52 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: Converting CGI to XML
Message-Id: <1403504.j9bPFYRLJS@nyoga.dubu.de>
Malcolm Dew-Jones wrote:
> Or more commonly
>
> while ($Tina =~ /SMOKER/)
> {
> $Tina =~ s/SMOKER/NON_SMOKER/;
> }
You should give her a cigarette break somewhere in that endless loop.
;-)
Ciao,
Harald
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
How do I set my laser printer on stun?
------------------------------
Date: Fri, 10 Jan 2003 20:37:01 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: How does one Iterate an array to remove duplicates?
Message-Id: <5666900.hOb4xdXVof@nyoga.dubu.de>
Lance wrote:
> I need to audit a web server to find out which web dirs have cgi
> installed, and the same for FPX and which are using php. I have come
> up with a way to search out these directories and compile a list.
> However, I need a way to iterate through the list to remove duplicate
> parent directories. Here is what I have thus far;
First some comments on your code:
> #! /usr/bin/perl -w
You enable warnings - good!
Even better would be to use strictures and declare your variables so you
find typos more easily:
use strict;
> @cgi = `find /www3 -name cgi-bin`;
Should be changed to
my @cgi = ...
with strictures enabled.
Maybe you want to restrict the search to directories:
find /www3 -name cgi-bin -type d
but that's just a remark.
> @fpx = `find /www3 -name "*_vti_pvt*"`;
see above
> foreach $domain (@cgi) {
foreach my $domain (@cgi) {
Reduce the scope of your variables. This way, $domain is local to the
loop, as it should be.
> if ($domain =~ m#^/#) {
> $domain =~ s#/cgi-bin##;
> push(@newcgi, "${domain}");
Neither quotes nor braces are needed here.
push @newcgi, $domain;
> }
> }
>
> foreach $domain (@fpx) {
> if ($domain =~ m#^/#) {
> $domain =~ s#/_vti_pvt##;
> push(@newfpx, "${domain}");
> }
> }
like above
>
> open(WEBS, ">>/www2/kryhavok/websaudit");
ALWAYS check the result of an open():
open (WEBS, ">>/www2/kryhavok/websaudit")
or die "cannot open websaudit: $!";
> print WEBS "\#\#These have CGI installed\#\#\n\n";
No need to escape a hash sign.
> print WEBS sort @newcgi;
> print WEBS "\n\#\#These have FPX installed\#\#\n\n";
see above
> print WEBS sort @newfpx;
> close(WEBS);
Well, at first I was tempted just to insert improvements into your code,
but then I decided that it might be more helpful to rewrite it.
-------------------- snip --------------------
#!/usr/bin/perl
use warnings;
use strict;
# gather all global variables at the top
# file-scoped variables with uppercase first letter,
# to distinguish from other locals
my $Root = '/www3';
my $Websaudit = '/www2/kryhavok/websaudit';
# parametrize the patterns with the to "areas" CGI and FPX
my %FilePatterns = (
CGI => 'cgi-bin',
FPX => '*_vti_pvt*',
);
my %ReplacePatterns = (
CGI => '/cgi-bin',
FPX => '/_vti_pvt',
);
# open the log in append mode
open(WEBS, ">>$Websaudit")
or die "cannot open $Websaudit: $!";
# loop over both areas (thus avoiding duplicated code)
for my $area (qw(CGI FPX)) {
my %newmatches = ();
# get find result -> match results and do replacement -> sort
my @matches = sort
grep {m#^/# && s#$ReplacePatterns{$area}$## }
`find $Root -name "$FilePatterns{$area}"`;
# I don't like dangling linebreaks
chomp (@matches);
DOMAINLOOP: foreach my $domain (@matches) {
my $position = length($domain);
# search through all parent directories
# if we had indexed that already (@matches are sorted, so
# the parent dir will always be checked *before* any child!)
while (($position = rindex ($domain, '/', $position-1)) > 0) {
next DOMAINLOOP
if exists $newmatches{substr($domain,0,$position)};
}
++$newmatches{$domain};
}
# print results; added a time stamp for convenience
print WEBS "## These have $area installed as of ",
scalar(localtime), " ##\n\n";
print WEBS join ("\n", sort keys %newmatches), "\n\n";
}
close (WEBS);
exit;
-------------------- snip --------------------
HTH,
Harald
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>how do i remove all spaces in a file?
I usually place it in the floor and jump up and down on it a few times.
-- aus comp.unix.programmer
------------------------------
Date: Fri, 10 Jan 2003 20:43:30 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: How does one Iterate an array to remove duplicates?
Message-Id: <1517524.836fgu3zBt@nyoga.dubu.de>
Tad McClellan wrote:
> Lance <ls@worldpath.net> wrote:
>> I need to audit a web server to find out which web dirs have cgi
>> installed, and the same for FPX
>
> What is FPX ?
I assume the OP is talking about MS Frontpage extensions.
(I don't work with Frontpage, so it's only a guess.)
> my @cgi = grep -d, `find /www3 -name cgi-bin`; # dirs only
One can tell find(1) to look for dirs only:
my @cgi = `find /www3 -type d -name cgi-bin`; # dirs only
>> foreach $domain (@cgi) {
>> if ($domain =~ m#^/#) {
>> $domain =~ s#/cgi-bin##;
>
>
> You don't need two pattern matches. One will do:
>
> if ( $domain =~ s#/cgi-bin## ) {
The first pattern checks if $domain starts with a '/', so it's not
equivalent to your match. I suppose the OP wants to eliminate any
additional output of find(1).
Ciao,
Harald
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"The vast majority of our imports come from outside the country."
-- George W. Bush Jr.
------------------------------
Date: Fri, 10 Jan 2003 21:25:49 +0100
From: "Michael Peuser \(h\)" <post@mpeuser.de>
Subject: Re: Matching entries in lists
Message-Id: <avna6e$bcf$06$1@news.t-online.com>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> schrieb im Newsbeitrag
news:avmodu$qem$1@mamenchi.zrz.TU-Berlin.DE...
> Bernd Schandl <schandl@gmx.net> wrote in comp.lang.perl.misc:
> > I have the following problem: I have a list where each entry is a
telephone
> > number, a name and a category. In a second list, I have telephone
numbers
> > (in the same format) and I want to check whether they appear in the
first
> > list and if yes, what the corresponding name and category is. As an
> > additional difficulty, the numbers in the first list are not necessarily
> > complete numbers but rather the beginning of a telephone number (think
area
> > code or company). So for the entry 12345678 in the second list, I want
to be
> > able to find the entry (123,"Some company","work") in the first list. I
only
> > need to find the first match.
> >
> > So my questions are:
> > - What is the best data structure for the first list? Some kind of
array?
> > Two hashes?
>
> A hash (why two?) is the usual Perl answer to a lookup problem.
>
> Out of the "first list", build a hash keyed on the phone numbers
> with the values containing the other info (as a string, or as a
> listref, it doesn't matter).
>
> > - What is a good/efficient/elegant way to find an entry in the first
list
> > matching a number from the second?
>
> sub lookup {
> my ( $table, $number) = @_;
> # find the longest prefix of $number that is in $table
> while ( length $number ) {
> last if exists $table->{ $number};
> chop $number;
> }
> ( $number, @{ $table->{ $number}} ) if length $number;
> return;
> }
I like the idea of the above soulution very much. The important to consider
run time behaviour of Perl scripts is generally not very much appreciated,
because Perl normally manipulates MB of data in a flash. It becomes
important when you shuffle around GB, or even just 100 MB through the memory
for several times.
The standard solution for the above problem would be not a hash but an
array, sorted according to telephone number and accessing it by binary
search. Be N the length of that list a*ld N would be the time needed, 'a'
beeing the time for accessing an array.
The above soulution takes h*M where M ist the mean length of a requested
telefon number and 'h' the time for a hash access, 'h' upto 10 times slower
than 'a' (though it depends on various circumstances, read the,man page for
pre-allocating hash space, e.g.).
So I should expect for 10 digit telephone numbers the clasical binary search
to be faster up to a list of 2**20 = 1 Mio entries.
Kindly Mike
I am well aware there is a factor to compensate for "mean" behaviour which
is 1/2 in both cases, though somewhat smaller for the second situation, so
my argument is biased in favour of the binary search ;-)
------------------------------
Date: 10 Jan 2003 21:21:23 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: My, our, etc.
Message-Id: <avndgj$fo1$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Richard S Beckett:
> "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de> wrote
>> With the above technique you wont have problems using strictures without
>> relying on global variables (as they are declared by our()).
>
> This is killing me!
Nah, it really isn't that bad.
> As far as I can see you have the following types of variables...
>
> 1. Ones that are just used within the current subroutine, and not needed
> anywhere else.
Note that what you call subroutine is actually a block (something
delimited by { }). So even the block in 'while CONDITION BLOCK' can have
its own set of variables when you declare them in this very block using
my(). You can even have several different lexical variables with the same
name:
sub func {
my $var = "test";
...
for my $var (0 .. 10) {
print $var; # prints a number between 0 and 10
...
}
print $var; # prints "test"
}
> 2. Ones that are used in the current subroutine, and passed to
> sub-subroutines, but are not needed anywhere else.
I don't know which ones you mean here, though. Perl doesn't really have
any special type of variables for subroutines (unless you count @_).
What you pass into a subroutine can either be a global or a lexical
variable...in both cases @_ holds aliases to them.
> 3. Ones that are global to the script, and are all over the place.
This can either be lexicals or globals. This distinction will start to
matter as soon as you work with packages (that is, different
namespaces). A my() variable on top of your script is visible throughout
the whole file regardless whether you have several packages in them.
Each package can see it. A global (you can also call them dynamic
variables because they can be temporarily given new values with local())
on the other hand is not automatically visible in the whole file. It is
only visible throughout the package. But they can still be accessed from
other packages by fully qualifying them with their package name:
$Namespace::var refers to $var in the package 'Namespace'.
package foo;
$var = "foo";
package bar;
$var = "bar"
print $foo::bar; # prints "foo"
print $bar; # prints "bar"
> 4. Ones that go out of the script, like being saved to a text file, and come
> back in, by reading the file.
I think the concept you have in mind complicates things. Perl has just
two types of variables: lexical variables and dynamic variables. I
prefer 'dynamic' over 'global' because the latter is misleading. A
lexical can also be global and is often used as such. All you need to
know is how each of these two behave and what kind of scoping rules
apply to them. Roughly speaking, lexical variables in Perl are similar
to ordinary variables in other languages such as C or Java. They are
only visible in the block you declare them. Dynamic variables don't
really have an exact equivalent in those languages I know. Static
variables in Java may come close to them, but Java doesn't have
something like that:
our $dynamic = 10;
{
local $dynamic = 100;
print $dynamic, "\n";
function();
}
print $dynamic, "\n";
sub function { print $dynamic, "\n" }
__END__
100
100
10
> I know that I will need to use our for type 4, but what about the others?
A rule of thumb: When you only have one package (and a script without
any package-declaration only has one package, namely package 'main')
then you don't need our() at all. Simply confine yourself to lexical
variables. Declaring them in the outer-most block will ensure that they
are visible everywhere starting with the line after the declaration.
This includes subroutines.
But if you have several namespaces and want each namespace to have a set
of variables that must be accessible from other packages as well, you
need our() (or its ancient predecessor 'use vars qw($var ...)'.
> What's the harm in using our, if you have a type 3 variable? In fact, as
> long as they're not duplicated, what's wrong with our anyway, just to be on
> the safe side?
There's nothing conceptually wrong with our(): It's just as though you'd
be programming C and only using 'extern' variables. But just as Tad sad:
Beware of action-at-a-distance effects. If you declare the variables
close by where you use them, you are less likely to get confused or
change the contents of a variable that is also used somewhere else.
The worst thing that can happen is that you loose control over your
global variables (this time this includes both lexical and dynamic
vars). Long ago I've written my own mp3-player in Perl (it started as a
quick hack to test the functionality of a new module I had previously
installed). Well, I added some things till the source grew to about 30K.
This is now the section where I declare the global variables:
my %Opt;
my ($SizeX, $SizeY);
my (@Songs, @Played, $Current, $C_frames, $C_fra_len);
my (@Output, @Function);
my $P;
my $Mode;
my ($P_state, $P_position_range, $P_position_offset, $P_volume);
my ($C_h, $C_m, $C_s) = (0, 0, 0);
my $Last_search = "";
my @Playlists;
If you ask me what $P_position_range is for, I'd have to confess that I
have no idea. The player works (it is my default player now) but I can't
change anything any longer just because it has become such a mess. Had
I not started it as a hack and instead spent some thoughts on useful
global variables and proper scoping, I could still extend and modify it
now.
Tassilo
--
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;
------------------------------
Date: Fri, 10 Jan 2003 22:53:33 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: My, our, etc.
Message-Id: <3e1f4e83.71521129@news.erols.com>
"Richard S Beckett" <spikey-wan@bigfoot.com> wrote:
: In fact, as
: long as they're not duplicated, what's wrong with our anyway, just to be on
: the safe side?
The "as long as they're not duplicated" part is a big issue.
_The_ issue, in fact.
Writing a program while manually ensuring that variables do not get
clobbered is hard.
Writing a program (or portion thereof) where variables have guaranteed
privacy and cannot get clobbered is easy.
Defensive programming is where it's at, cat.
------------------------------
Date: Fri, 10 Jan 2003 22:23:06 GMT
From: slurper <slurper1234@hotmail.com>
Subject: net-snmp tkmib
Message-Id: <eJHT9.5700$ym5.909@afrodite.telenet-ops.be>
hi,
i have a problem running tkmib from net-snmp package
i successfully installed net-snmp
but when i want to run tkmib, following complaints are echoed:
>ERROR: You don't have the SNMP perl module installed. Please obtain this
>by
>getting the latest source release of the ucd-snmp toolkit from
>http://www.net-snmp.org/download/ . The perl module is contained in
>the perl/SNMP directory. See the INSTALL file there for
>instructions.
so i go to perl/SNMP in the source tree
run perl Makefile.PL make and then make test
make test reports this (at end of article)
i saw the test couldn't find default_store: Can't locate
NetSNMP/default_store.pm in @INC
in the source tree of the perl-module there is a default_store.pm
but there isn't an NetSNMP-directory.
anybody can help???
tx
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/async.......Can't locate NetSNMP/default_store.pm in @INC (@INC contains:
/root/net-snmp-5.0.6/perl/SNMP/blib/lib
/root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
BEGIN failed--compilation aborted at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
Compilation failed in require at t/async.t line 12.
BEGIN failed--compilation aborted at t/async.t line 12.
t/async.......dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-20
Failed 20/20 tests, 0.00% okay
t/bulkwalk....Can't locate NetSNMP/default_store.pm in @INC (@INC contains:
/root/net-snmp-5.0.6/perl/SNMP/blib/lib
/root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
BEGIN failed--compilation aborted at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
Compilation failed in require at t/bulkwalk.t line 17.
BEGIN failed--compilation aborted at t/bulkwalk.t line 17.
t/bulkwalk....dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-62
Failed 62/62 tests, 0.00% okay
t/conf........Can't locate NetSNMP/default_store.pm in @INC (@INC contains:
/root/net-snmp-5.0.6/perl/SNMP/blib/lib
/root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
BEGIN failed--compilation aborted at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
Compilation failed in require at t/conf.t line 22.
BEGIN failed--compilation aborted at t/conf.t line 22.
t/conf........dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-3
Failed 3/3 tests, 0.00% okay
t/get.........Can't locate NetSNMP/default_store.pm in @INC (@INC contains:
/root/net-snmp-5.0.6/perl/SNMP/blib/lib
/root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
BEGIN failed--compilation aborted at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
Compilation failed in require at t/get.t line 11.
BEGIN failed--compilation aborted at t/get.t line 11.
t/get.........dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-17
Failed 17/17 tests, 0.00% okay
t/getnext.....Can't locate NetSNMP/default_store.pm in @INC (@INC contains:
/root/net-snmp-5.0.6/perl/SNMP/blib/lib
/root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
BEGIN failed--compilation aborted at
/root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
Compilation failed in require at t/getnext.t line 12.
BEGIN failed--compilation aborted at t/getnext.t line 12.
------------------------------
Date: Fri, 10 Jan 2003 22:50:22 GMT
From: slurper <slurper1234@hotmail.com>
Subject: Re: net-snmp tkmib
Message-Id: <O6IT9.5731$ym5.895@afrodite.telenet-ops.be>
looking further, i noticed something strange: the SNMP module is installed
according to me
it resides in "/usr/lib/perl5/site_perl/5.8.0/i686-linux/SNMP.pm"
when i execute : perl -e 'print qq/@INC/;' i get
/usr/lib/perl5/5.8.0/i686-linux
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i686-linux
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
strange no??
how can i tell tkmib?
tx
slurper wrote:
> hi,
>
> i have a problem running tkmib from net-snmp package
> i successfully installed net-snmp
> but when i want to run tkmib, following complaints are echoed:
>
>>ERROR: You don't have the SNMP perl module installed. Please obtain this
>>by
>>getting the latest source release of the ucd-snmp toolkit from
>>http://www.net-snmp.org/download/ . The perl module is contained in
>>the perl/SNMP directory. See the INSTALL file there for
>>instructions.
>
> so i go to perl/SNMP in the source tree
> run perl Makefile.PL make and then make test
>
> make test reports this (at end of article)
>
> i saw the test couldn't find default_store: Can't locate
> NetSNMP/default_store.pm in @INC
> in the source tree of the perl-module there is a default_store.pm
> but there isn't an NetSNMP-directory.
>
> anybody can help???
> tx
>
> PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/async.......Can't locate NetSNMP/default_store.pm in @INC (@INC
> contains: /root/net-snmp-5.0.6/perl/SNMP/blib/lib
> /root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> BEGIN failed--compilation aborted at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> Compilation failed in require at t/async.t line 12.
> BEGIN failed--compilation aborted at t/async.t line 12.
> t/async.......dubious
> Test returned status 2 (wstat 512, 0x200)
> DIED. FAILED tests 1-20
> Failed 20/20 tests, 0.00% okay
> t/bulkwalk....Can't locate NetSNMP/default_store.pm in @INC (@INC
> contains: /root/net-snmp-5.0.6/perl/SNMP/blib/lib
> /root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> BEGIN failed--compilation aborted at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> Compilation failed in require at t/bulkwalk.t line 17.
> BEGIN failed--compilation aborted at t/bulkwalk.t line 17.
> t/bulkwalk....dubious
> Test returned status 2 (wstat 512, 0x200)
> DIED. FAILED tests 1-62
> Failed 62/62 tests, 0.00% okay
> t/conf........Can't locate NetSNMP/default_store.pm in @INC (@INC
> contains: /root/net-snmp-5.0.6/perl/SNMP/blib/lib
> /root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> BEGIN failed--compilation aborted at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> Compilation failed in require at t/conf.t line 22.
> BEGIN failed--compilation aborted at t/conf.t line 22.
> t/conf........dubious
> Test returned status 2 (wstat 512, 0x200)
> DIED. FAILED tests 1-3
> Failed 3/3 tests, 0.00% okay
> t/get.........Can't locate NetSNMP/default_store.pm in @INC (@INC
> contains: /root/net-snmp-5.0.6/perl/SNMP/blib/lib
> /root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> BEGIN failed--compilation aborted at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> Compilation failed in require at t/get.t line 11.
> BEGIN failed--compilation aborted at t/get.t line 11.
> t/get.........dubious
> Test returned status 2 (wstat 512, 0x200)
> DIED. FAILED tests 1-17
> Failed 17/17 tests, 0.00% okay
> t/getnext.....Can't locate NetSNMP/default_store.pm in @INC (@INC
> contains: /root/net-snmp-5.0.6/perl/SNMP/blib/lib
> /root/net-snmp-5.0.6/perl/SNMP/blib/arch /usr/lib/perl5/5.8.0/i686-linux
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
> /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> BEGIN failed--compilation aborted at
> /root/net-snmp-5.0.6/perl/SNMP/blib/lib/SNMP.pm line 16.
> Compilation failed in require at t/getnext.t line 12.
> BEGIN failed--compilation aborted at t/getnext.t line 12.
------------------------------
Date: Sat, 11 Jan 2003 00:13:50 +0300
From: "Andrey Tapkin" <tapkin@rol.ru>
Subject: Re: Net::Mysql - capture error messages
Message-Id: <avndc2$nal$1@news.sovam.com>
Use MysqlPP instead of Mysql:
...DBI->connect("DBI:mysqlPP:database...
Don't close ur eyes when you write something :-))
"Mike Solomon" <mike_solomon@lineone.net> ???????/???????? ? ????????
?????????: news:56568be5.0301100757.7f118617@posting.google.com...
> I am using Net::Mysql to connect to MySql and it works
>
> The problem with it (or me) if that I can't capture any MySql error
> messages
>
> Is there a way to do this using Net::MySql ?
>
> I originally intented to use DBI which I have used in the past, on a
> Linux box, but when I use ActiveState's PPM (I am running on windows)
> to find the correct module the only thing it gives me is DBD-mysqlPP
> which instals Net:Mysql
>
> Any help with either capturing error messages from Net:MySql or
> getting DBI working would be much appreciated.
>
> If I try the code I used to use:
>
> use DBI ();
>
> my $host = "localhost";
> my $database = "test";
> my $user = "mike";
> my $password = "mike";
> my $dbh;
>
> # Connect to the database.
> if ($dbh = DBI->connect("DBI:mysql:database=$database;host=$host","$user",
> "$password")) {
> print "VALID";
> } else { print "INVALID"; }
>
> I get the following error message
>
> install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC
> contains: C:/Perl/lib C:/Perl/site/lib .) at (eval 1) line 3.
> Perhaps the DBD::mysql perl module hasn't been fully installed,
>
>
> Any help will be gratefully received
>
>
> Thanks
>
>
> Mike Solomon
------------------------------
Date: 10 Jan 2003 14:49:34 -0800
From: bazzz777@yahoo.com (bazzz777)
Subject: newline "\n" not working
Message-Id: <6c9ad26f.0301101449.26b2c270@posting.google.com>
I'm trying to write lines to a javascript file using the perl CGI module on Linux.
The lines are written to the .js file with:
open(file1,">>/tmp/$projectname");
print file1 "$duedate\n";
print file1 "$email\n";
print file1 "$description\n";
close(file1);
The .js looks okay in Linux but cannot be
read by any web browser.
AND...
In MS Windows all the data appears as one long line.
I can make the javascript web browser readable if I edit in newlines
using a Windows text editor.
I also tried my CGI with "\r" instead of "\t" but
the results are the same.
Thanks for any help or suggestions.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 4380
***************************************