[23022] in Perl-Users-Digest
Perl-Users Digest, Issue: 5242 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 19 18:05:50 2003
Date: Sat, 19 Jul 2003 15:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 19 Jul 2003 Volume: 10 Number: 5242
Today's topics:
Re: "use" remote modules? <jaspax@u.washington.edu>
Re: "use" remote modules? <l.tierney@btinternet.com>
_Text Processing in Python_ (David Mertz, Ph.D.)
Changing module dynamically (Thomas M. Widmann)
Re: Changing module dynamically <grazz@pobox.com>
Re: Changing module dynamically <tassilo.parseval@rwth-aachen.de>
Re: Changing module dynamically <jaspax@u.washington.edu>
Re: Changing module dynamically (Thomas M. Widmann)
Re: File::Find is slower than using recursion!? <spamblock@junkmail.com>
IP Conversion..Sending to Subroutine.. <joecool118@nospam.hotmail.com>
Re: prime ?? <bik.mido@tiscalinet.it>
Re: Read the contents of a text file into an HTML page <bwalton@rochester.rr.com>
Re: s there a module to acess Micorsoft Access datafile <jwillmore@cyberia.com>
Re: s there a module to acess Micorsoft Access datafile <wsegrave@mindspring.com>
Re: sinfo script, xchat, slackware <neosad1st@charter.net>
Re: Taint Mode Newbie Help <bwalton@rochester.rr.com>
Re: Taint Mode Newbie Help (sekdab)
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 19 Jul 2003 11:34:55 -0700
From: JS Bangs <jaspax@u.washington.edu>
Subject: Re: "use" remote modules?
Message-Id: <Pine.A41.4.55.0307191129110.79354@dante09.u.washington.edu>
lawrence tierney sikyal:
> Hello again,
>
> After reading your post and the "require" docs I came up with the following:
> [snip]
>
> But it doesn't work. Notes:
>
> 1. The call to remote_module hook in @INC works.
> 2. The LWP::Simple call works.
> 3. If I dump out $doc after the LWP::Simple call it is indeed the module I
> want, containing sub password.
> 4. Filehandle opens successfully
>
> Script dies however on the password() call with
>
> "Undefined subroutine &main::password called........"
Not to point out the painfully obvious, but . . . did you ever _use_ the
module? Perhaps the top of your code should be
BEGIN {
push @INC, \&get_remote_module;
use remote_module;
}
(untested)
Which should do the business of actually requiring and importing all of
the functions.
As I recently discovered, Perl also tries to process uses as early as
possible, so it might be necessary to move the use statement inside a
quoted eval.
Jesse S. Bangs jaspax@u.washington.edu
------------------------------
Date: Sat, 19 Jul 2003 21:29:17 +0100
From: lawrence tierney <l.tierney@btinternet.com>
Subject: Re: "use" remote modules?
Message-Id: <bfc9mv$1pr$1$8302bc10@news.demon.co.uk>
>
> Not to point out the painfully obvious, but . . . did you ever _use_ the
> module? Perhaps the top of your code should be
>
> BEGIN {
> push @INC, \&get_remote_module;
> use remote_module;
> }
>
Yes, it resulted in compilation error
Can't locate remote_module.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at test.pl
line 5.
BEGIN failed--compilation aborted at test.pl line 5.
------------------------------
Date: 19 Jul 2003 11:44:00 -0700
From: groups.google@gnosis.cx (David Mertz, Ph.D.)
Subject: _Text Processing in Python_
Message-Id: <8cf9f521.0307191044.27414b04@posting.google.com>
At the risk of heresy, I thought I might let readers of this group know
that I have written a book for Addison Wesley with the title listed in
the subject line. Obviously, readers are here because they program in
Perl; I hardly want to engage in a language war. But my book -does-
address how to do many of the things that Perl is best at, but in the
context of another popular programming language.
Anyway, you can buy my book, or you can read the complete source text
at:
http://gnosis.cx/TPiP/
I encourage both of those. But I am writing here primarily for a
different purpose. I would be very interested in getting members of
the Perl community to write reviews of my book. In a way, it's hard
to imagine better experts for evaluation of my title than y'all. Of
course, I am ready for reviews that start "You can do it better in
Perl..."; hopefully they'll continue past the opening.
If someone here thinks they might like to publish a review of _TPiP_,
let me know so I can work out getting you a free review copy. Or you
can write to AW directly--they're even more interested in promoting my
book than I am, since they wind up with most of the money :-).
Yours, David Mertz
mertz@gnosis.cx
------------------------------
Date: 19 Jul 2003 19:08:40 +0100
From: thomas@widmann.uklinux.net (Thomas M. Widmann)
Subject: Changing module dynamically
Message-Id: <m3lluugziv.fsf@widmann.uklinux.net>
Hi,
I have a slightly odd problem. I know I'm abusing OO programming a
bit, but I cannot think of any better way.
Simply stated, my problem is as follows: I'm writing a bibliography
package with multilingual features, so all texts are encapsulated in
functions.
E.g., $bib->edition(5) might return 'fifth edition' or '5th ed.' if
the language is English, and 'femte udgave' og '5. udg' if it's
Danish.
Now, if one only ever needed one language in each bibliography, one
could simply have put something like
use Bibulus::Lang::da;
in the beginning of the script using the bibliography package, and
Bibulus::Lang::da would then have defined the relevant language
functions to return Danish texts and it would have inherited the rest
from the parent.
However, the language can change for each entry. I could of course
write functions like the following:
sub edition {
my $self = shift;
my $ed = shift;
if ($self->LANG eq 'da') {
return "$ed. udgave";
} elsif ($self->LANG eq 'en') {
...
-- but this would quickly become unwieldy, and it would make it
difficult for users to define their own languages easily.
If only @ISA had not been package-scoped, one could have done
something along the following lines:
sub changelang {
my $self = shift;
my $lang = shift;
@ISA = ("Bibulus::Lang::$lang");
}
-- but it is, so one cannot. :-( (Well, if I have to, I can go down
this route -- since one would only write one entry at a time, one can
of course just always switch to correct language at the beginning of
each entry.)
Instead, I've been playing around with autoloading:
sub AUTOLOAD {
my $self = shift;
my $f = $AUTOLOAD;
$f =~ s/(.*::)/$1$self->{LANG}\:\:/;
&$f(@_);
}
but it most certainly isn't pretty, and it seems to break down if one
tries to use inheritance. It also seems to be necessary to require
all the language modules initially, which again makes it difficult for
users to define their own languages.
So, to sum up: I'd like a function, let's call it changelang, which
will do the following:
- Take one argument, the language to change to ($lang).
- If it hasn't been loaded, load Bibulus::Lang::$lang (or whatever
-- I don't care much about the name, so long as each language is
defined in its own file).
- Change the symbol table look-up path, so that Bibulus::Lang::$lang
is searched first.
- This should not affect the whole package, just the instance (as if
there was something called @{$self->ISA}).
Thanks a lot in advance!
/Thomas
--
Thomas Widmann Bye-bye to BibTeX: join the Bibulus project now!
thomas@widmann.uklinux.net <http://www.nongnu.org/bibulus/>
Glasgow, Scotland, EU <http://savannah.nongnu.org/projects/bibulus/>
------------------------------
Date: Sat, 19 Jul 2003 20:19:09 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Changing module dynamically
Message-Id: <1JhSa.14949$7O.6092@nwrdny01.gnilink.net>
Thomas M. Widmann <thomas@widmann.uklinux.net> wrote:
> I have a slightly odd problem. I know I'm abusing OO programming a
> bit, but I cannot think of any better way.
[snip]
> So, to sum up: I'd like a function, let's call it changelang, which
> will do the following:
>
> - Take one argument, the language to change to ($lang).
>
> - If it hasn't been loaded, load Bibulus::Lang::$lang (or whatever
> -- I don't care much about the name, so long as each language is
> defined in its own file).
>
> - Change the symbol table look-up path, so that Bibulus::Lang::$lang
> is searched first.
>
> - This should not affect the whole package, just the instance (as if
> there was something called @{$self->ISA}).
What you're describing (a class for every object) is possible --
sub changelang {
my ($self, $lang) = @_;
my $pack = "Bibulus::Lang::$lang";
my $addr = sprintf '0x%x', $self;
eval qq{
require ${pack};
package ${pack}_${addr};
sub DESTROY { undef %${pack}_${addr}:: }
}.q{
our @ISA = ($pack, ref $self);
bless $self;
}
}
But delegating/dispatching the language methods by hand would be
cleaner:
sub changelang {
my ($this, $lang) = @_;
my $package = "Bibulus::Lang::$lang";
eval "require $package" or die $@;
$this->{lang} = $package;
}
sub edition {
my $this = shift;
($this->{lang} || $default)->edition(@_);
}
And as you might have suggested in the big snip, any number of
those language-aware proxy methods could be generated on the fly
by AUTOLOAD().
--
Steve
------------------------------
Date: 19 Jul 2003 19:46:08 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Changing module dynamically
Message-Id: <bfc760$c6o$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Thomas M. Widmann:
> I have a slightly odd problem. I know I'm abusing OO programming a
> bit, but I cannot think of any better way.
>
> Simply stated, my problem is as follows: I'm writing a bibliography
> package with multilingual features, so all texts are encapsulated in
> functions.
>
> E.g., $bib->edition(5) might return 'fifth edition' or '5th ed.' if
> the language is English, and 'femte udgave' og '5. udg' if it's
> Danish.
>
> Now, if one only ever needed one language in each bibliography, one
> could simply have put something like
> use Bibulus::Lang::da;
> in the beginning of the script using the bibliography package, and
> Bibulus::Lang::da would then have defined the relevant language
> functions to return Danish texts and it would have inherited the rest
> from the parent.
>
> However, the language can change for each entry. I could of course
> write functions like the following:
> sub edition {
> my $self = shift;
> my $ed = shift;
> if ($self->LANG eq 'da') {
> return "$ed. udgave";
> } elsif ($self->LANG eq 'en') {
> ...
> -- but this would quickly become unwieldy, and it would make it
> difficult for users to define their own languages easily.
>
> If only @ISA had not been package-scoped, one could have done
> something along the following lines:
> sub changelang {
> my $self = shift;
> my $lang = shift;
> @ISA = ("Bibulus::Lang::$lang");
> }
> -- but it is, so one cannot. :-( (Well, if I have to, I can go down
> this route -- since one would only write one entry at a time, one can
> of course just always switch to correct language at the beginning of
> each entry.)
I don't understand this paragraph. @ISA is indeed package-scoped, but
why does that prevent you from changing it?
> Instead, I've been playing around with autoloading:
> sub AUTOLOAD {
> my $self = shift;
> my $f = $AUTOLOAD;
> $f =~ s/(.*::)/$1$self->{LANG}\:\:/;
> &$f(@_);
> }
> but it most certainly isn't pretty, and it seems to break down if one
> tries to use inheritance. It also seems to be necessary to require
> all the language modules initially, which again makes it difficult for
> users to define their own languages.
No, it does not. Just extract the package from $AUTOLOAD and
eval-require it:
sub AUTOLOAD {
my ($pkg, $meth) = $AUTOLOAD =~ /(.*)::(.*)/;
eval "require $pkg";
goto &$AUTOLOAD;
}
> So, to sum up: I'd like a function, let's call it changelang, which
> will do the following:
>
> - Take one argument, the language to change to ($lang).
>
> - If it hasn't been loaded, load Bibulus::Lang::$lang (or whatever
> -- I don't care much about the name, so long as each language is
> defined in its own file).
>
> - Change the symbol table look-up path, so that Bibulus::Lang::$lang
> is searched first.
>
> - This should not affect the whole package, just the instance (as if
> there was something called @{$self->ISA}).
Ah, now I see what you meant. You want an @ISA per object. That arguably
does not exist.
I'd go for an AUTOLOAD approach thusly:
Make a convention that you sufffix the edition() method with the
language. Extract this suffix, pull in the appropriate module and call
the edition() method from this namespace:
sub AUTOLOAD {
my ($meth, $lang) = $AUTOLOAD =~ /(edition)_(.*)/
or return;
eval "require Bibulus::Lang::$lang";
# for $self->edition_da(@args) this will translate to
# $self->Bibulus::Lang::da::edition(@args)
goto &{"Bibulus::Lang::${lang}::edition"};
}
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Sat, 19 Jul 2003 12:01:13 -0700
From: JS Bangs <jaspax@u.washington.edu>
Subject: Re: Changing module dynamically
Message-Id: <Pine.A41.4.55.0307191143590.79354@dante09.u.washington.edu>
Thomas M. Widmann sikyal:
> So, to sum up: I'd like a function, let's call it changelang, which
> will do the following:
>
> - Take one argument, the language to change to ($lang).
>
> - If it hasn't been loaded, load Bibulus::Lang::$lang (or whatever
> -- I don't care much about the name, so long as each language is
> defined in its own file).
>
> - Change the symbol table look-up path, so that Bibulus::Lang::$lang
> is searched first.
>
> - This should not affect the whole package, just the instance (as if
> there was something called @{$self->ISA}).
I'm not sure how much control you have over the architecture of the whole
thing, but this is how I would implement such a system:
First, have all of your text methods be defined in the base class
Bibulus::Lang, but don't actually define any text there. Rather, define a
global hash %text that has key => value pairs for the text, and simply
import that hash from a module. Thus, your base class has this:
our %text = (); # whatever . . .
sub new {
# blah blah blah . . .
$self->{text} = \%text;
bless $self, $class;
}
# Text functions could easily be generalized w/ AUTOLOAD
sub edition {
return $self->{text}->{edition};
}
sub changelang {
my $lang = pop;
require "Bibulus::Lang::$lang";
$self->{text} = \%Bibulus::Lang::$lang::text;
}
All of the Bibulus::Lang::lang subclasses then have the responsibility of
populating %text with appropriate values. The package variable %text will
have the "standard" values for each lang, while $self->{text} will have
instance-specific values.
Jesse S. Bangs jaspax@u.washington.edu
http://students.washington.edu/jaspax/
http://students.washington.edu/jaspax/blog
------------------------------
Date: 19 Jul 2003 23:02:43 +0100
From: thomas@widmann.uklinux.net (Thomas M. Widmann)
Subject: Re: Changing module dynamically
Message-Id: <m3adbagoos.fsf@widmann.uklinux.net>
"Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> writes:
> Also sprach Thomas M. Widmann:
>
> [...]
> > Instead, I've been playing around with autoloading:
> > sub AUTOLOAD {
> > my $self = shift;
> > my $f = $AUTOLOAD;
> > $f =~ s/(.*::)/$1$self->{LANG}\:\:/;
> > &$f(@_);
> > }
> > but it most certainly isn't pretty, and it seems to break down if one
> > tries to use inheritance. It also seems to be necessary to require
> > all the language modules initially, which again makes it difficult for
> > users to define their own languages.
>
> No, it does not. Just extract the package from $AUTOLOAD and
> eval-require it:
>
> sub AUTOLOAD {
> my ($pkg, $meth) = $AUTOLOAD =~ /(.*)::(.*)/;
> eval "require $pkg";
> goto &$AUTOLOAD;
> }
>
Ah, I hadn't thought of that -- thanks a lot!
> [...]
> I'd go for an AUTOLOAD approach thusly:
>
> Make a convention that you sufffix the edition() method with the
> language. Extract this suffix, pull in the appropriate module and call
> the edition() method from this namespace:
>
> sub AUTOLOAD {
> my ($meth, $lang) = $AUTOLOAD =~ /(edition)_(.*)/
> or return;
> eval "require Bibulus::Lang::$lang";
>
> # for $self->edition_da(@args) this will translate to
> # $self->Bibulus::Lang::da::edition(@args)
> goto &{"Bibulus::Lang::${lang}::edition"};
> }
No, that wouldn't work, since the edition function will be called in a
place where the language is not known in advance.
However, with help from your eval-require, I've come up with some code
that seems to work. At least, the following program:
use A;
my $l1 = new A;
$l1->lang('da');
print $l1->test, "\n";
$l1->lang('en');
print $l1->test, "\n";
my $l2 = new A;
$l2->lang('da');
print $l2->test, "\n";
print $l1->test, "\n";
will produce the required output:
da
en
da
en
given the following three files A.pm, da.pm and en.pm:
##### file A.pm #####
package A;
sub new {
my $class = shift;
my $self = {};
bless($self, $class);
return $self;
}
sub lang {
my $self = shift;
my $lang = shift;
$self->{LANG} = $lang;
}
sub AUTOLOAD {
my $self = shift;
my ($pkg, $meth) = $AUTOLOAD =~ /(.*)::(.*)/;
eval "require '$self->{LANG}.pm'";
$meth = "$self->{LANG}::$meth";
goto &$meth;
}
1;
##### file da.pm #####
package da;
sub test {
return 'da';
}
1;
##### file en.pm #####
package en;
sub test {
return 'en';
}
1;
Thanks a lot for your help!
/Thomas
--
Thomas Widmann Bye-bye to BibTeX: join the Bibulus project now!
thomas@widmann.uklinux.net <http://www.nongnu.org/bibulus/>
Glasgow, Scotland, EU <http://savannah.nongnu.org/projects/bibulus/>
------------------------------
Date: Sat, 19 Jul 2003 11:42:17 -0700
From: "David Oswald" <spamblock@junkmail.com>
Subject: Re: File::Find is slower than using recursion!?
Message-Id: <vhj4d01prchl9e@corp.supernews.com>
From: "Benjamin Goldberg" <ben.goldberg@hotpop.com>
Subject: Re: File::Find is slower than using recursion!?
> Steve Allan wrote:
> >
> > It could also be that my sense that recursion is
> > inherently slow is outdated and just not true in Perl.
>
> Recursion is most certainly *not* inherently slow. I can't think of a
> time when it was... at least, not in perl.
>
<A lot of other stuff snipped>
Recursion was slow in Pascal as implemented on old Apple IIe's. I think the
issue was the overhead requried to push another function onto the stack.
It's been years though so I could have that wrong. But it seems to me in my
old HS Comp Sci classes we liked recursion for its simplicty and elegance,
but disliked it for its inefficiency in speed and memory consumption.
...but that truely was a different era (as is punctuated by the mention of
old Apple IIe's).
------------------------------
Date: Sat, 19 Jul 2003 21:58:45 GMT
From: "Joe Henderson" <joecool118@nospam.hotmail.com>
Subject: IP Conversion..Sending to Subroutine..
Message-Id: <pajSa.130497$Ho4.755649@news.easynews.com>
All,
When i can to send the dec value of an ip add to a sub it doesn't work..
Is there any othe way i can do this w/o substring it..?
Or does ne1 have a better way...
###############
my $ip = "10.10.1.1";
my @octet = split(/\./, $ip); #Like to remove this garbage.., Just send the
whole string..
my $dec = &decimal(@octet);
my $dec1 = substr($dec, 0, 5); #Like to remove this garbage..
my $dec2 = substr($dec, 5, 5); #Like to remove this garbage..
my $ip = &ip($dec1, $dec2);
sub decimal
{
my @octet = @_;
my $oct1 = $octet[0];
my $oct2 = $octet[1];
my $oct3 = $octet[2];
my $oct4 = $octet[3];
my $dec1 = $oct1 * (256**3);
my $dec2 = $oct2 * (256**2);
my $dec3 = $oct3 * 256;
my $dec4 = $oct4;
my $decimal = $dec1 + $dec2 + $dec3 + $dec4;
return $decimal;
}
sub ip
{
my @dec = @_;
my $dec1 = $dec[0];
my $dec2 = $dec[1];
my $decimal = "$dec1$dec2"; #join back together
$decimal =~s/^\s+//; #strip all leading whitespace
$decimal =~s/\s+$//; #strip all trailing whitespace
$oct1 = ($decimal / 256**3);
@num = split(/\./, $oct1);
$oct1 = $num[0];
$dec1 = ($oct1 * 256**3);
$decimal = $decimal - $dec1;
if($decimal >= 256**2)
{
$oct2 = ($decimal / 256**2);
@num = split(/\./, $oct2);
$oct2 = $num[0];
$dec2 = ($oct2 * 256**2);
$decimal = $decimal - $dec2;
}
if($decimal >= 256)
{
$oct3 = ($decimal / 256);
@num = split(/\./, $oct3);
$oct3 = $num[0];
$dec3 = $oct3 * 256;
$decimal = $decimal - $dec3;
}
$oct4 = $decimal;
$oct4 = $decimal;
if($oct1 < 1) { $oct1 = 0; }
if($oct2 < 1) { $oct2 = 0; }
if($oct3 < 1) { $oct3 = 0; }
if($oct4 < 1) { $oct4 = 0; }
$ip = "$oct1.$oct2.$oct3.$oct4";
return $ip;
}
###############
TIA,
Joe
------------------------------
Date: Sat, 19 Jul 2003 21:27:22 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: prime ??
Message-Id: <p96jhv879h5qgjsqsuu4ku2ibc5ok1e63f@4ax.com>
On Fri, 18 Jul 2003 18:26:59 +0530, Thens <thens@nospam.com> wrote:
>>perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'
>
> This prints 1 which is not a prime !!
But this is a venial sin for 1 is (generally) not considered a prime
mostly for a technical reason: to avoid saying 'a prime different from
1' every here and there...
Michele
--
# This prints: Just another Perl hacker,
seek DATA,15,0 and print q... <DATA>;
__END__
------------------------------
Date: Sat, 19 Jul 2003 18:43:16 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Read the contents of a text file into an HTML page
Message-Id: <3F199125.8070904@rochester.rr.com>
Dutch3001 wrote:
...
> I was wondering if this was possible... without cgi or perl or complex
------------------------------------------^^^^^^^--------^^^^
Why are you asking your question here then? This is a newsgroup to
discuss Perl.
...
--
Bob Walton
------------------------------
Date: Sat, 19 Jul 2003 18:10:09 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: s there a module to acess Micorsoft Access datafiles?
Message-Id: <20030719140754.20141656.jwillmore@cyberia.com>
>
> If you have access to a Win32 computer:
>
> 1. "Start + Settings + Control Panel" and look for "ODBC Data
> Sources(32bit)".
> 2. Open it and go to the "System DSN" tab.
> 3. Add a System Data Source with the Microsoft Access Driver
> (*.mdb), giving it the name of the Access file you wish to use.
>
> Now you should be able to use DBI::ODBC to make a connection to the
> Win32 box that has the Access file on it.
From a FreeBSD box to a Windows box using this method?
Have you tried this?
Does it work?
I'm thinking you may have missread the OP. He wants to connect TO a
WIN32 box FROM FreeBSD. Can not be done as you indicated. If it has,
please let me know.
Jim
------------------------------
Date: Sat, 19 Jul 2003 15:17:11 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: s there a module to acess Micorsoft Access datafiles?
Message-Id: <bfcdun$vsg$1@slb9.atl.mindspring.net>
"James Willmore" <jwillmore@cyberia.com> wrote in message
news:20030719140754.20141656.jwillmore@cyberia.com...
> >
> > If you have access to a Win32 computer:
> >
> > 1. "Start + Settings + Control Panel" and look for "ODBC Data
> > Sources(32bit)".
> > 2. Open it and go to the "System DSN" tab.
> > 3. Add a System Data Source with the Microsoft Access Driver
> > (*.mdb), giving it the name of the Access file you wish to use.
> >
> > Now you should be able to use DBI::ODBC to make a connection to the
> > Win32 box that has the Access file on it.
>
> From a FreeBSD box to a Windows box using this method?
> Have you tried this?
No. I don't have a FreeBSD box. I can try it from a Linux box; but i thought
I'd leave a little work for the OP to do. He will learn something from the
exercise.
> Does it work?
>
IIRC, works fine on this Win32 system, as I had set it up several times.
It's working in a CGI environment (IndigoPerl) on this Win32 system; so
access from FreeBSD, if I had it, should work. It *does* work from other
Win32, as well as Linux buxes on this network.
> I'm thinking you may have missread the OP. He wants to connect TO a
> WIN32 box FROM FreeBSD. Can not be done as you indicated. If it has,
> please let me know.
>
No. I understand what the OP is seeking. AFAIK, a System DSN would work.
Have you proved your claim that it "can not be done as ... indicated"? Why
don't you try it with *your* FreeBSD system and I'll try it with Linux? I'll
post the results of my tests.
Must go now, as severe T-storms are brewing in the area. My TPPWS must be
activated to protect the computers on my LAN.
Regards.
Bill Segraves
------------------------------
Date: Sat, 19 Jul 2003 12:26:31 -0600
From: NeoSadist <neosad1st@charter.net>
Subject: Re: sinfo script, xchat, slackware
Message-Id: <vhj39fa3id9ucd@corp.supernews.com>
A. Sinan Unur wrote:
>
> Do you get an error "Undefined subroutine &main::cat called at c.pl" for
> the line above? I think you need to use the backtick operator here. Or,
> you could just open the file and read from it.
No, I get no error, just that the output is not correct, as I said in my
post.
>
> Since I do nothave access to a Linux system, I copied the contents you
> gave to a local file called meminfo, and used the following script:
>
>
This didn't work. I tried incorporating it into the script, and got weird
results. See, it adds all info that it gains to a $final string.
Let me again post the script, and the contents of the file it is reading for
that subprogram:
sub mem {
if (@resources){
} else {
@resources = cat("/proc/meminfo");
}
$sysname = qx|uname -r|;
if (substr($sysname,0,3) eq "2.4" || substr($sysname,0,3) eq "2.2"){
@mem = split/\s+/,(grep{/Mem:/}@resources)[0];
$memused = sprintf ("%.1f",($mem[2] - $mem[5] - $mem[6])/1030010);
$memtotal = sprintf ("%.1f",($mem[1]/1030010));
$memper = sprintf ("%.f",($memused/$memtotal)*100);
} elsif (substr($sysname,0,3) eq "2.5" || substr($sysname,0,3) eq "2.6") {
@memt = split/\s+/,(grep{/MemTotal:/}@resources)[0];
@memf = split/\s+/,(grep{/MemFree:/}@resources)[0];
@memb = split/\s+/,(grep{/Buffers:/}@resources)[0];
@memc = split/\s+/,(grep{/Cached:/}@resources)[0];
$memused = sprintf ("%.1f",($memt[1] - $memf[1] - $memb[1] -
$memc[1])/1024);
$memtotal = sprintf ("%.1f",($memt[1]/1024));
$memper = sprintf ("%.f",($memused/$memtotal)*100);
}
$final = ("$final$c1 Mem usage:$c2 $memused/$memtotal MB ($memper%) |");
}
IGNORE THE $C1 AND $C2 REFERENCES IN THE STRING: THEY'RE PART OF A USER
INPUT METHOD TO CHANGE COLORS IN TEXT WHILE TYPING.
AND HERE'S THE FILE IT'S READING:
total: used: free: shared: buffers: cached:
Mem: 1025478656 326803456 698675200 0 64053248 96509952
Swap: 82214912 0 82214912
MemTotal: 1001444 kB
MemFree: 682300 kB
MemShared: 0 kB
Buffers: 62552 kB
Cached: 94248 kB
SwapCached: 0 kB
Active: 118368 kB
Inactive: 96540 kB
HighTotal: 98304 kB
HighFree: 1540 kB
LowTotal: 903140 kB
LowFree: 680760 kB
SwapTotal: 80288 kB
SwapFree: 80288 kB
ALTERNATELY, THE COMMAND IT CAN CALL TO GET SAME INFO IS "FREE", AND THE
OUTPUT OF THAT PROGRAM IS LIKE THIS:
total used free shared buffers cached
Mem: 1001444 321884 679560 0 62596 94252
-/+ buffers/cache: 165036 836408
Swap: 80288 0 80288
--
" ... and are endowed by their Creator
with certain unalienable rights ... "
NeoSadist
------------------------------
Date: Sat, 19 Jul 2003 18:37:22 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Taint Mode Newbie Help
Message-Id: <3F198FC2.8000308@rochester.rr.com>
sekdab wrote:
Note: Please don't top-post.
...
> It is fairly obvious that the $pass variable is the one being tainted.
> It is received from the user via a form and then passed to a shell.
> So, what I've been trying to do is untaint it. I've tried stuff
> like...
>
> $pass = $1;
>
> after the if logic. That takes away the taint within the backticks,
> but sets $pass to undefined. I'm utterly confused :-(. Thanks for
Regexp in question (from a snipped portion of the posting):
...
if ( $pass =~ /^[A-Za-z0-9]+$/ ) {
$pass = $1;
...
Your question was already answered by a previous responder a few hours
ago -- did you read his response? You neglected to place parenthesis
around the portion of the regexp which you wanted to capture in $1. The
mechanism is that the "$n" variables (like $1, $2, etc) get assigned to
whatever (...) groups are present in the regexp, in order. Since you
don't have any (...) groups, $1 is set to undef. If you tried that
exact same code without the taint option, it wouldn't work either, so
the idea that the problem has something to do with taint'ing is wrong.
Make it:
...
if ( $pass =~ /^([A-Za-z0-9]+)$/ ) {
$pass = $1;
...
and it should get past that hurdle at least.
...
HTH.
--
Bob Walton
------------------------------
Date: 19 Jul 2003 13:09:47 -0700
From: seldan@lore.cc (sekdab)
Subject: Re: Taint Mode Newbie Help
Message-Id: <4b21880f.0307191209.41d6027b@posting.google.com>
Thank you!!!!!!!!!!!
That worked perfectly. I have been going crazy trying to figure this
out, now I can run with taint mode :-).
Thanks again,
Tom
tiltonj@erols.com (Jay Tilton) wrote in message news:<3f192827.208495935@news.erols.com>...
> seldan@lore.cc (sekdab) wrote:
>
> : if ( $pass =~ /^[A-Za-z0-9]+$/ ) {
> : $pass = $1;
> # snip
> : }
>
> : I check to ensure that it is alphanumeric and then assign it to $1.
> : After which, I place it in the shell execution backticks. However,
> : both $1 and $pass are null now, and the execution fails.
>
> $1 does not get defined unless there is a set of capturing parentheses
> in the regex.
>
> if ( $pass =~ /^([A-Za-z0-9]+)$/ ) {
> $pass = $1;
> # snip
> }
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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 5242
***************************************