[17644] in Perl-Users-Digest
Perl-Users Digest, Issue: 5064 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 8 14:05:58 2000
Date: Fri, 8 Dec 2000 11:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976302314-v9-i5064@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 8 Dec 2000 Volume: 9 Number: 5064
Today's topics:
about call excutable program with system() <jingzx@sinaman.com>
Announce: Inside 1.00 - Listing installed modules <rootbeer@redcat.com>
ANNOUNCE: Lingua::Romana::Perligata 0.01 (Damian Conway)
Apache::HTTP and www-authenticate <dontspamme@awdang.com>
Re: behavior of open "+>>" (Tom Christiansen)
Re: Can this script be done in a one-liner <elijah@workspot.net>
Re: Chopping a newline off a string (Jon Bell)
Re: Chopping a newline off a string <jeffp@crusoe.net>
Re: Connecting to a Oracle 8i database via Perl (Abigail)
Re: Connecting to a Oracle 8i database via Perl <nospam.newton@gmx.li>
Re: Connecting to a Oracle 8i database via Perl (Abigail)
Re: default method (Chris Fedde)
Re: default method <joe+usenet@sunstarsys.com>
Re: default method (Rafael Garcia-Suarez)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 08 Dec 2000 12:11:23 +0800
From: jin zengxiang <jingzx@sinaman.com>
Subject: about call excutable program with system()
Message-Id: <3A305F6B.44C12775@sinaman.com>
Hi,there:
can you tell me that :
1. If I want to call MS Word from perl to open a file ,say ,"myfile.txt"
,how
can I achieve this ,I use system(" ......../word.exe myfile.txt"). but
what this
piece of code can do is just to open the MS Word for me ,while not open
the " myfile.txt".
2.if I want to call a dos executable program (say ,the name of the
program is dos.exe) to run a file "input.txt ",
so In dos command prompt ,I type in "dos.exe input.txt" .
but when I try to do this through perl:
************************
system("dos.exe input.txt") ;
************************
there is an error message says that Internal error .
what's wrong with it ?
Rgds,
Alan
------------------------------
Date: Fri, 8 Dec 2000 10:32:59 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Announce: Inside 1.00 - Listing installed modules
Message-Id: <t32ald8g80rna8@corp.supernews.com>
It often happens that folks need a list of the installed Perl modules.
There are several common ways to get such a list, but none of them works
all of the time. In particular, this is especially difficult to do when
you have limited access to the machine in question, such as when you have
nothing but FTP access to a webserver.
The program 'inside' solves this problem.
http://www.redcat.com/inside/
Here's the README file.
This program is available on CPAN:
http://www.cpan.org/authors/id/P/PH/PHOENIX/
To prepare this program for your system, use a variation on the standard
incantation:
perl Makefile.PL
make
make test # this may take a moment to complete
Then, install the file 'inside' as needed for a CGI program on your
system. See your local expert if you're not sure how to do that.
If you're unable to use the standard incantation, try running the
command 'perl inside.PL' instead. Or you may need to manually fix up the
file 'inside' for use as a CGI program on your system.
>From the embedded documentation:
NAME
Inside - Find out what's inside your Perl installation
DESCRIPTION
This program will try to report which Perl modules are available
on your machine, along with some other useful information.
Although it's especially made to be helpful to CGI programmers,
it may be of use to other Perl users as well.
Note that I've done more than a few weird things in this code in
order to make it work in some odd surroundings. The right thing
to do in general is to fix the broken environments, rather than
to work around them. But since the purpose of this program is to
diagnose some of those broken environments, I'm breaking the
rules. In short: Don't Do As This Code Does! Use the accepted
techniques, instead.
You should be able to run this program on nearly any machine
which has Perl, either as a CGI program or stand-alone, although
not under Apache/mod_perl's non-CGI environments, like
Apache::Registry or Apache::PerlRun. (The ordinary Apache CGI
environment is fine, whether mod_perl is installed or not.) The
only(?) thing which should need changing in the program text is
the location of perl in the #!-line, the first line of the
program. There's also a small Configuration section near the top
of the source, if you really need to have something to fiddle
with.
Of course, if you're installing this program on a webserver,
your local expert may need to help you to get it running. Don't
ask me to do it! :-)
FAQ
* I can't get it to work! What's wrong?
This program tries hard to work in any normal environment,
but it may be damaged or misinstalled. If you can run it in
a shell (as opposed to running it as a CGI program) you may
get more information about what is happening. Check the
perldiag manpage for the meaning of any diagnostic messages
from perl.
If you get an error about an "Illegal character", you
probably didn't use text mode ("ASCII mode") to transfer the
source from one machine to another. Try again, see the
perldiag manpage for more help, or ask your local expert.
If the error message says that "Setting locale failed",
check what the perllocale manpage tells you to do to fix
your setup.
If it seems to run and produces no output from the command
line, check that you didn't run the configuration program
'inside.PL' rather than the real program 'inside'.
If the error message in MacPerl complains that it "Can't
emulate -{symbol} on #! line", or if the program
mysteriously doesn't run at all, you probably didn't use
text mode ("ASCII mode") to transfer the source to the Mac.
Try again or ask your local expert.
When you're having trouble with a CGI program in Perl,
here's a handy troubleshooting guide to get you back on
track.
http://www.smithrenaud.com/public/troubleshooting_CGI.html
If you're running the most recent version of this program
and you're still stuck after using the CGI troubleshooting
guide (if appropriate), working with your local expert, and
thinking about it overnight, then you may try asking about
it in the newsgroup comp.lang.perl.modules or writing to me.
Don't send me this entire program or its output unless I ask
for it! If you've got something long you wish for me to see,
put it on the web and send me just the URL.
* Where can I get the most recent version of this program?
It should be available on CPAN.
http://www.cpan.org/authors/id/P/PH/PHOENIX/
* Why doesn't this program work with Apache/mod_perl?
It does. But this is a CGI program, and Apache::Registry and
similar modules don't really use CGI. They're a little
different, so as to give certain benefits to some programs.
This program couldn't use any of those benefits, even if it
could be made compatible with those modules. In particular,
it wouldn't run any faster, since nearly all of its time is
spent in doing I/O. And are you going to call this program
hundreds of times every second? I hope not!
Simply run this as a normal CGI program, and Apache/mod_perl
will be happy with it. If you're not sure how to do that on
your machine, check with your local expert.
* Why did you write this program?
There are other solutions to this problem. I didn't like
them. Finding the installed modules is actually a complex
problem. Most proposed solutions have a number of false
positives or false negatives (this one has both; see the
rest of this FAQ for details). Some proposed solutions use
obfuscated or incorrect code, or don't work on the web with
all standard web servers and browsers. This program also has
the advantage of this FAQ and (I hope) clear diagnostic
messages about problems it may encounter.
* Why can't I use module ____? This program says it's there.
This may be a "false positive".
This program can't tell whether a module is properly
installed. (The only way to do that is to load and test the
module. Figuring out how to test an arbitrary piece of code
for proper functioning is provably impossible, so I decided
not to try.)
Of course, maybe the module is properly installed, but
you're simply using it incorrectly. Stop doing that.
A proper module should be distributed with tests which you
can (and should) use before installing it. If your installed
modules won't pass the tests, you should almost certainly
(ask your administrator to) rebuild and reinstall that
module, ensuring this time that it does pass the tests.
One possible error is that you may have used the wrong
capitalization in the `use' declaration. Check the module's
documentation to see how to use it. Neither `use Cgi;' nor
`use cgi;' will properly start up the CGI module.
* Why doesn't this program find all of my modules?
This may be a "false negative".
The "missing" module is not installed (or not properly
installed) in one of the search directories. Those
directories are the ones from Perl's compiled-in @INC
variable (possibly modified by an environment variable) and
the extra directories whose names are included in the source
of this program.
You probably want to add your private module/library
directory to the @extra_dirs list, in the Configuration
section of this program. Also see what the Perl FAQ says
about keeping your own module/library directory.
* How can I include my own module/library directory?
Add them to the @extra_dirs list, in the Configuration
section. There is a similar question in the Perl FAQ, which
is worth reading.
* Can't I specify search directories with a web form?
No. For security reasons, the directory list must be hard-
coded.
* But I want my users to be able to specify their own directories!
Why? They can look in their own directories any time they
want, can't they? If they want to install their own copy of
this program, they can configure it to their needs.
If you still want this, you probably don't understand the
security implications.
* How can I find out about module dependencies?
Determining which modules are needed by which other modules
is far beyond the scope of this program.
There's no way to find module dependencies which always
works. But any good module should check for its own
dependencies at installation time. If you use the CPAN
module to install and upgrade modules, it can help you with
this.
Similarly, if a program needs a module which isn't supplied
with perl, this should be made clear in the program's README
file, or equivalent.
* How can I automate installing a bunch of modules?
Some folks want to find out which modules are installed so
as to automate installing those again on a new system, or
with a new version of Perl. This program isn't intended to
help with this. See the CPAN module's `autobundle' function,
instead.
* I copied some of your code to my own program, but...
Don't do that! I break lots of rules in this program,
because I have good reasons and I know what I'm doing. You
don't have good reasons, and you don't know what you're
doing. :-)
* Why does the version number for module ____ come out wrong?
For the same reason that so many version numbers are
"unknown".
* Why do so many modules show the version number as "unknown"?
There are several possible reasons. But if you don't have a
warning that gives another reason, it may be because the
module author hasn't included the version number in the
standard format. See the docs for ExtUtils::MakeMaker, in
the section on VERSION_FROM. But (for technical reasons)
this code can't be as smart as ExtUtils::MakeMaker, so it
will sometimes get the version number wrong or not get it at
all.
Technical note: Okay, if you must know. ExtUtils::MakeMaker
actually runs some of each module's code in order to
determine its version. That could be a security hole, if the
module might contain rogue code. I'm not going to take the
chance. Version numbers aren't that hard to find out on your
own.
If you're a module author and this program doesn't do as
well as ExtUtils::MakeMaker at determining your module's
version number, please cook up a fix. Preferably, to your
module, rather than to this program. :-)
* Why are so many programs listed as "Libraries"?
Your programs are using the file extension ".pl", which
means "Perl Library". On many systems, extensions for
programs aren't needed and shouldn't be used. If you must
have an extension on your program names, it's best to set up
your system to use ".plx", which means "Perl Executable",
then use that extension instead.
This seems to be a losing battle, since ActiveState (and
others?) strongly encourage the use of the wrong extension.
If you wish to keep some of these from showing up, add a
directory or file path to the @prune_dirs array (in the
Configuration section). Unless you have both libraries and
programs in the same directory (yet another reason for
different extensions!) you can simply list directory names
to exclude them and their contents. But listing a program
won't hurt you any, if you know it's not a library.
* Why does it take so long to run?
This program may take perhaps more than a minute to run,
depending upon your system's load, the number of modules
installed, and so on. It's gathering a lot of information
about your system! If you're installing it as a CGI program,
you may be able to make it work as an NPH-program. (This is
no faster, but it does produce some output sooner, for the
benefit of you impatient folks.) Set it up just like any
other CGI program, but make sure that the first four
characters of the file's name are "nph-", and it should work
automatically. If it doesn't make any difference, well, then
you just have to wait for the output, that's all.
* Why does it run faster after the first time?
Much of the overhead of running this program is I/O.
Probably your system has cached the information which it
read off of your filesystem. Try again after some time, and
it will be like the first time again.
* Why do the "modules found" messages at the top always differ?
There are some things man was not meant to know.
* Is there any way to configure this program to ____?
Sometimes folks want to turn part of the output on or off.
Maybe they want to put their own URL into the output. Maybe
they want to change something else.
Well, you probably can't. This program is more like a
stethoscope than an ultrasound machine. It doesn't have a
lot of dials and knobs.
See the intentionally-small "Configuration" section of the
program, though, if you really wish to tweak something.
Please, see the license and disclaimer before you change any
code.
* Why doesn't it find modules relative to the current directory?
When it's run over the web (that is, as a CGI program) this
program will ignore relative paths. (These are directory
paths which don't start with a slash, on Unix. On other
systems, there may be other kinds of relative paths, but all
relative paths start from the "current working directory".)
The current working directory is not part of the CGI
specification. Since a CGI program can't rely upon it, it
must always change to a non-relative directory before it can
safely use a relative path. (A future version of the CGI
spec may change this - but that won't help existing programs
and webservers.)
* But I use `chdir' before I load modules!
You probably aren't doing that correctly. If you do know
enough to do this correctly, I can instruct you no further
here.
Anyone else, just use absolute paths in @INC, and in the
@extra_dirs.
* Is this program vulnerable to any security problems?
Every program is. See the disclaimer elsewhere in the
documentation.
One possible problem, which is beyond the scope of this
program to fix, is a Denial of Service ("DoS") attack.
Briefly, this program takes time to run. If someone were to
set up other computers to call this program over the web as
frequently as possible, your webserver could become very
slow for all legitimate users. But this can happen, to some
extent, with any program that remote users can run - even
with your webserver itself.
If you worry about DoS attacks using this program, simply
disable it whenever you're not using it. On most Unix-type
webservers, that's easy to do by using chmod(1) to set the
permissions to 0. On some webservers, you may need to change
the name or remove the program entirely. See your local
expert for details. No, you can't enable or disable it over
the web - that would defeat the purpose, wouldn't it?
* Why don't you use warnings and 'use strict' and....?
Because this program is purposefully written in a way which
will work around various system (mis)configurations. And
actually, barring quirks in some future version of perl, I
am using warnings and 'use strict'. You just might not be
able to see how I'm doing it. :-)
* Why aren't you using taint checking?
This program shouldn't need that to be secure. A program
without taint checks can be secure, just as one with them
can be unsafe.
When taint checks aren't used, we may use Perl's eval()
function on a string from another module. Since we first
check that the module is owned and writable only by the
system administrator, this doesn't open up any new security
hole. (If your installed modules aren't safe, though, it
opens up that existing security hole. :-) That is to say,
this technique is no more insecure in general than using the
modules installed on your system.
If you wish to use taint checking, it can be enabled in the
usual way, by adding the '-T' option to the $# line at the
top of the program. Just know that when taint checks are
enabled, you may not be able to determine the version
numbers of some modules. Rarely, you may get incorrect
version numbers from a few modules.
* Why doesn't this work with perl4?
Do you remember when O. J. Simpson was known primarily as an
ex-football player who made TV commercials? Perl 4 is older
than that. Give it up. It's dead. Besides, such old perl
can't use modules anyway!
COPYRIGHT, DISCLAIMER, AND LICENSE
Copyright (C) 2000 by Tom Phoenix <rootbeer@redcat.com>.
THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
This program is free software; you can distribute it under the
same terms as Perl itself. I don't recommend modifying it or
distributing variant versions. In fact, I discourage modifying
it, unless you're sure you know what you're doing. And if you do
modify something, make sure that you've clearly labeled
whatever you've done. On the other hand, if you come up with a
cool or useful modification, let me know. And don't forget to
periodically check CPAN for updates.
http://www.cpan.org/authors/id/P/PH/PHOENIX/
Be cautious that, if you modify this code in any way, you do not
introduce security holes. Although I have, to the best of my
knowledge and ability, made this program as safe as is
practicable, it may have flaws which could cause undesirable
effects. Still, I don't think it's too bad: I run it myself.
AUTHOR
Tom Phoenix <rootbeer@redcat.com> with plenty of help from other
folks, including (in no particular order) "Tolkin, Steve"
<Steve.Tolkin@fmr.com>, Mark Lybrand <markyesme@home.com>, Eric
Cholet <cholet@logilune.com>, Drew Simonis
<care227@attglobal.net>, Tim Conrow <tim@ipac.caltech.edu>,
Richard Martin Woodward <RichardWoodward@hotmail.com>, JohnShep
<john@princenaseem.com>, Mike Solomon <mike.solomon@eps.ltd.uk>,
Anno Siegel <anno4000@lublin.zrz.TU-Berlin.DE>, Randall Woodman
<rwoodman@verio.net>, Ken MacFarlane <ksm@dca.net>, Philip
Newton <philip.newton@datenrevision.de>, and anyone whose name
I've accidentally omitted. It wouldn't have been possible
without all this help.
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 Dec 2000 07:15:22 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Lingua::Romana::Perligata 0.01
Message-Id: <t32all10jn9daa@corp.supernews.com>
Keywords: perl, module, release
==============================================================================
Release of version 0.01 of Lingua::Romana::Perligata
==============================================================================
NOMEN
Lingua::Romana::Perligata -- Perl in Latin
DESCRIPTIO
The Lingua::Romana::Perligata makes it makes it possible to write Perl
programs in Latin. (If you have to ask "Why?", then the answer probably
won't make any sense to you either.)
The linguistic principles behind Perligata are described in:
http://www.csse.monash.edu.au/~damian/papers/HTML/Perligata.html
The module is `use'd at the start of the program, and installs a filter
which allows the rest of the program to be written in (modified) Latin,
as described in the accompanying documentation.
EXEMPLUM
#! /usr/bin/perl -w
use Lingua::Romana::Perligata;
adnota Illud Cribrum Eratothenis
maximum tum val inquementum tum biguttam tum stadium egresso scribe.
vestibulo perlegementum da meo maximo.
maximum tum novumversum egresso scribe.
da II tum maximum conscribementa meis listis.
dum damentum nexto listis decapitamentum fac sic
lista sic hoc tum nextum recidementum cis vannementa da listis.
next tum biguttam tum stadium tum nextum tum novumversum
scribe egresso.
cis.
SCRIPTOR
Damian Conway (damian@conway.org)
IUS TRANSCRIBENDI
Copyright (c) 2000, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed and/or
modified under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html)
MUTATIONES IN EDITIO 0.01
Initial release.
ADITUS
Lingua::Romana::Perligata has been uploaded to the CPAN and is also
available from:
http://www.csse.monash.edu.au/~damian/CPAN/Lingua-Romana-Perligata.tar.gz
==============================================================================
------------------------------
Date: Fri, 8 Dec 2000 09:29:21 -0600
From: "LimboStar" <dontspamme@awdang.com>
Subject: Apache::HTTP and www-authenticate
Message-Id: <3a31094b@news.cc.umr.edu>
I posted this a few days ago and got no takers, so I'm posting again in
hopes that my recent spate of question answering has pleased the collective
of the newsgroup, and good fortune and happiness will rain down upon me. Or
an answer, at least.
I'm trying to simulate the behaviour of a password-protected directory using
perl. Specifically, I'm dealing with a cookie-based authentication scheme,
where the cookie contains a sessionid which resides in a database on the
server. If the user has not been given access to a certain page, I want to
throw a Status: 403, and pop up the generic dialog box (using
WWW-Authenticate: Basic realm="whatever") for them to enter their user name
and password.
All that is working fine. The problem is I have not been able to find a way
to retrieve the username and password sent by the user to the server. I
know that it's sent in the headers, but I don't know how to access it.
What is the method of accessing the headers of an HTTP request directly in
perl? Does Apache::HTTP have anything to do with it? If not, what module
do I need to use? Is there such a module?
The alternatives as I see them are using an HTML based method of getting the
username and password (which is not only inconvienent, but can be abused
easily and would create havoc in the way the site is configured), or hack
Apache to send the information as an environment variable to the perl script
(which strikes me as a lot like using a nuclear missle to light the barbecue
grill).
Is there any help for me?
--sjd;
------------------------------
Date: 8 Dec 2000 11:48:59 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: behavior of open "+>>"
Message-Id: <3a312d1b$1@cs.colorado.edu>
In article <90ph6p$p3n@netnews.hinet.net>,
John Lin <johnlin@chttl.com.tw> wrote:
>Dear all,
>
>I just wanted to test the behavior of open "+>>"
>stated in perlopentut, section "Mixing Reads and Writes". It says:
>
> "it will allow you to read at any point in the file,
> but all writes will always go to the end."
>
>The following is my testing program:
>
> open F,"+>>nonexist" or die $!;
> print F "hello 1\n";
> print F "hello 2\n";
> close F;
>
> open F,"+>>nonexist" or die $!;
> seek F,0,0;
> print my $line = <F>;
> print F "hello 3\n";
> print F "hello 4\n";
> close F;
STOP.
% man fopen
....
Reads and writes cannot be arbitrarily intermixed on
read/write streams. ANSI C requires that a file positioning
function intervene between output and input, unless an
input operation encounters end-of-file.
You have to know to ANSI C and Unix to use Perl correctly.
--tom
------------------------------
Date: 8 Dec 2000 18:50:21 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Can this script be done in a one-liner
Message-Id: <eli$0012081346@qz.little-neck.ny.us>
In comp.lang.perl.misc, Abigail <abigail@foad.org> wrote:
> On 7 Dec 2000 21:00:56 GMT, Eli the Bearded (elijah@workspot.net) wrote
> in comp.lang.perl.misc <URL:news:<eli$0012071547@qz.little-neck.ny.us>>:
> ++ Today I thought of this:
> ++ paste a.txt b.txt|sed -e 's/$/+p/'|dc
> Way too long!
> paste [ab].txt|tr "^I" +|bc
> with ^I een tab character.
Surely you know that this would save a byte:
paste [ab].txt|tr \^I +|bc
Elijah
------
notices that method (tr|bc) has the advantage of expanding to N files better
------------------------------
Date: Fri, 8 Dec 2000 16:03:04 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Chopping a newline off a string
Message-Id: <G59B94.64K@presby.edu>
Adam Levenstein <cleon42@my-deja.com> wrote:
>
>Essentially, $blah = "ralph\n"
>And I just want $blah = "ralph"
chomp $blah;
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
[ Help try to keep the Deja.com archive alive! Sign the petition at ]
[ http://www2.PetitionOnline.com/dejanews/petition.html ]
------------------------------
Date: Fri, 8 Dec 2000 11:06:34 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Chopping a newline off a string
Message-Id: <Pine.GSO.4.21.0012081106190.19543-100000@crusoe.crusoe.net>
[posted & mailed]
On Dec 8, Adam Levenstein said:
>What's the best way to shave the newline off the end of a string?
perldoc -f chomp
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: 8 Dec 2000 16:43:43 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Connecting to a Oracle 8i database via Perl
Message-Id: <slrn9323tv.luo.abigail@tsathoggua.rlyeh.net>
On Fri, 08 Dec 2000 14:57:05 +0100, Michael (mischay@gmx.de) wrote in comp.lang.perl.misc <URL: news:<3A30E8B1.5E694FAE@gmx.de>>:
++ > Just to be pendantic, there's no *need* to install those modules.
++ > They are *a* way to contact to an Oracle database, not the way.
++
++ Which one would you recommend?
Since I never work with Oracle, I've no preference.
Abigail
------------------------------
Date: Fri, 08 Dec 2000 18:08:26 +0100
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li>
Subject: Re: Connecting to a Oracle 8i database via Perl
Message-Id: <ab523t8klu4bjjkqelhmrc4imbktj3b2sj@4ax.com>
On 8 Dec 2000 16:43:43 GMT, abigail@foad.org (Abigail) wrote:
> On Fri, 08 Dec 2000 14:57:05 +0100, Michael (mischay@gmx.de) wrote in comp.lang.perl.misc <URL: news:<3A30E8B1.5E694FAE@gmx.de>>:
> ++ > Just to be pendantic, there's no *need* to install those modules.
> ++ > They are *a* way to contact to an Oracle database, not the way.
> ++
> ++ Which one would you recommend?
>
> Since I never work with Oracle, I've no preference.
Which method would you use to connect to a Sybase database with Perl?
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate
------------------------------
Date: 8 Dec 2000 17:52:26 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Connecting to a Oracle 8i database via Perl
Message-Id: <slrn9327uq.nl1.abigail@tsathoggua.rlyeh.net>
On Fri, 08 Dec 2000 18:08:26 +0100, Philip 'Yes, that's my address' Newton (nospam.newton@gmx.li) wrote in comp.lang.perl.misc <URL: news:<ab523t8klu4bjjkqelhmrc4imbktj3b2sj@4ax.com>>:
++ On 8 Dec 2000 16:43:43 GMT, abigail@foad.org (Abigail) wrote:
++
++ > On Fri, 08 Dec 2000 14:57:05 +0100, Michael (mischay@gmx.de) wrote in comp.lang.perl.misc <URL: news:<3A30E8B1.5E694FAE@gmx.de>>:
++ > ++ > Just to be pendantic, there's no *need* to install those modules.
++ > ++ > They are *a* way to contact to an Oracle database, not the way.
++ > ++
++ > ++ Which one would you recommend?
++ >
++ > Since I never work with Oracle, I've no preference.
++
++ Which method would you use to connect to a Sybase database with Perl?
Sybase::DBlib or Sybase::CTlib, depending on your preference.
Abigail
------------------------------
Date: Fri, 08 Dec 2000 16:19:23 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: default method
Message-Id: <fS7Y5.61$B9.173315584@news.frii.net>
In article <90qsds$hlk$1@nnrp1.deja.com>,
Steve Canfield <canfieldsteve@hotmail.com> wrote:
>Does Perl have such a thing as default object methods? I've searched all
>the docs I can find and they don't mention it, which probably means
>there's no such thing, but I thought I'd check with the 'rus here just
>in case.
>
>Here's what I mean. Let's say I've got a package called "MyPackage"
>which, among other things, has a sub named "new" for creating objects of
>that package (OK, actually returning blessed references, but they're
>*like* instantiations). The following code:
>
> my ($var);
> $var = MyPackage->new();
> print $var;
>
>produces output something like this:
>
> MyPackage=HASH(0x863f4c)
>
>What would be really useful and cool would be if when the object is
>referenced without any -> it would automatically know to return the
>output of some subroutine instead of itself. Is such a thing possible?
>
Not precicely what you are looking for but...
you could define print in your package. Alternately you can take on a
rubyism and define the to_s method for your class.
print $var->to_s;
--
This space intentionally left blank
------------------------------
Date: 08 Dec 2000 11:29:42 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: default method
Message-Id: <m3g0jykhah.fsf@mumonkan.sunstarsys.com>
Steve Canfield <canfieldsteve@hotmail.com> writes:
> Here's what I mean. Let's say I've got a package called "MyPackage"
> which, among other things, has a sub named "new" for creating objects of
> that package (OK, actually returning blessed references, but they're
> *like* instantiations). The following code:
>
> my ($var);
> $var = MyPackage->new();
> print $var;
>
> produces output something like this:
>
> MyPackage=HASH(0x863f4c)
>
> What would be really useful and cool would be if when the object is
> referenced without any -> it would automatically know to return the
> output of some subroutine instead of itself. Is such a thing possible?
>
Why not bless a coderef instead of a hashref?
--
Joe Schaefer
------------------------------
Date: Fri, 08 Dec 2000 16:39:12 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: default method
Message-Id: <slrn9323n9.jkq.rgarciasuarez@rafael.kazibao.net>
Chris Fedde wrote in comp.lang.perl.misc:
> In article <90qsds$hlk$1@nnrp1.deja.com>,
> Steve Canfield <canfieldsteve@hotmail.com> wrote:
> >
> >Here's what I mean. Let's say I've got a package called "MyPackage"
> >which, among other things, has a sub named "new" for creating objects of
> >that package (OK, actually returning blessed references, but they're
> >*like* instantiations). The following code:
> >
> > my ($var);
> > $var = MyPackage->new();
> > print $var;
> >
> >produces output something like this:
> >
> > MyPackage=HASH(0x863f4c)
> >
> >What would be really useful and cool would be if when the object is
> >referenced without any -> it would automatically know to return the
> >output of some subroutine instead of itself. Is such a thing possible?
>
> Not precicely what you are looking for but...
> you could define print in your package. Alternately you can take on a
> rubyism and define the to_s method for your class.
>
> print $var->to_s;
Or overload the "" operator. See the overload manpage for details. As an
example, the module CGI::Cookie overloads "".
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
use overload '""' => sub { print "Just another Perl hacker,\n" };
$_ = bless {}; print;
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 5064
**************************************