[22913] in Perl-Users-Digest
Perl-Users Digest, Issue: 5133 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 25 09:05:48 2003
Date: Wed, 25 Jun 2003 06:05:14 -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 Wed, 25 Jun 2003 Volume: 10 Number: 5133
Today's topics:
Accessing constants from another package/file. <coo_t2-NO-LIKE-SPAM@yahoo.com>
Accessing constants from another package/file. <coo_t2-NO-LIKE-SPAM@yahoo.com>
Re: Accessing constants from another package/file. (Anno Siegel)
capturing streaming market data <mwarren@acm.org>
capturing streaming market data <mwarren@acm.org>
comparing rows in a multidimensional array <eudora@andromeda.stueker.net>
Re: comparing rows in a multidimensional array <emschwar@pobox.com>
Re: comparing rows in a multidimensional array (Jay Tilton)
Re: comparing rows in a multidimensional array <eudora@andromeda.stueker.net>
Re: comparing rows in a multidimensional array <eudora@andromeda.stueker.net>
comparing rows in a multidimensional array <eudora@andromeda.stueker.net>
Re: comparing rows in a multidimensional array <emschwar@pobox.com>
Re: comparing rows in a multidimensional array (Jay Tilton)
Re: comparing rows in a multidimensional array <eudora@andromeda.stueker.net>
Re: comparing rows in a multidimensional array <eudora@andromeda.stueker.net>
Re: Oracle CLOB using DBI <r_reidy@comcast.net>
Re: Oracle CLOB using DBI <eudora@andromeda.stueker.net>
Re: Oracle CLOB using DBI <eudora@andromeda.stueker.net>
Re: display Latin and Russian characters simultaneously (FMAS)
Re: display Latin and Russian characters simultaneously <flavell@mail.cern.ch>
Re: Oracle CLOB using DBI <r_reidy@comcast.net>
Re: Oracle CLOB using DBI <eudora@andromeda.stueker.net>
Re: Oracle CLOB using DBI <eudora@andromeda.stueker.net>
Perl -e `"dir a*.txt"` <yoketsl@singnet.com.sg>
Re: Perl -e `"dir a*.txt"` (Villy Kruse)
Re: perlio problem? redhat 9, perl 5.8.0 (gordon)
Re: Resource for Perl Newbies <mgjv@tradingpost.com.au>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 25 Jun 2003 01:11:33 GMT
From: ed <coo_t2-NO-LIKE-SPAM@yahoo.com>
Subject: Accessing constants from another package/file.
Message-Id: <q0thfv0mgqsbildn11pg75gqqkap9fh83u@4ax.com>
Hey all. I'm trying to use some constants that I have defined
using the "constant" module. I'm requiring the file into another package.
The package that uses the constant is used from "main".
The problem is that it isn't getting the value of the constant, it's
just using the string value of the constant name. Uh, don't know if that made
sense.
Example:
Below I want to refer to DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE
to get the error type, which should be the string "WRONG_PARAMETER_TYPE".
But it just gives me the string "DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE".
I've tried accessing it with and without the DE_Constanst:: prefix.
It doesn't work either way.
Right now I'm instantiating a LineFixer object from within the same file that
the LineFixer package is in. I do it at the bottom of the file after the closing
bracket for the "LineFixer" package, which I guess is assumed
to be "main".
Eventually LineFixer will reside in its own file and will get
'required' into the file where I want to use it.
Here's the relevant code:
#start myScript.pl
{ package LineFixer;
require 'ErrorManager.pl';
require 'DE_Constants.pl';
sub new
{
my $proto = shift;
my $class = ref($proto) || $proto;
my $this = {};
bless($this, $class);
$this->{pathToFileOrHandle} = shift;
$this->{isValidHandle} = 0;
$this->{FH} = undef;
$this->{fileContents} = undef;
$this->checkFileOrHandleArg();
return $this;
}
sub checkFileOrHandleArg
{
my $this = shift;
if ( $this->is_a_filehandle() )
{
$this->{isValidHandle} = 1;
return 1;
}
elsif ( $this->openFile() )
{ return 1;
}
else
{
$this->_createErrorObjOnce();
my $errorType = DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE;
my $errorMsg =
DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE.' in method LineFixer::new : '.
'You must pass either a filehandle or the valid path '.
'to a file to open for reading';
$this->{errorObj}->addToErrorList( {'type'=>$errorType, 'msg'=>$errorMsg} );
return 0;
}
}
etc........
} # end package "LineFixer"
$lineFixerObj = LineFixer->new('c:/temp/noname1');
$lineFixerObj->getFileContents();
$lineFixerObj->closeFile();
if ($lineFixerObj->hasErrors() )
{ print "it has errors!!\n";
$errorObj = $lineFixerObj->getErrorObj();
foreach my $errorArr (@{$errorObj->getErrors()})
{ print $errorArr->{'type'}."\n";
print $errorArr->{'msg'}."\n";
}
}
#end myScript.pl
#start DE_Constants.pl
{ package DE_Constants;
use constant DE_ERROR_WRONG_PARAMETER_TYPE => 'WRONG_PARAMETER_TYPE' ;
}
1;
#end DE_Constants.pl
------ Back to post --------
I can use the constant from inside "DE_Constants.pl".
By doing something like:
print DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE;
So I don't think the problem should be with the code that creates the constant.
Anyways, any help appreciated.
tia,
--ed
------------------------------
Date: Wed, 25 Jun 2003 01:11:33 GMT
From: ed <coo_t2-NO-LIKE-SPAM@yahoo.com>
Subject: Accessing constants from another package/file.
Message-Id: <q0thfv0mgqsbildn11pg75gqqkap9fh83u@4ax.com>
Hey all. I'm trying to use some constants that I have defined
using the "constant" module. I'm requiring the file into another package.
The package that uses the constant is used from "main".
The problem is that it isn't getting the value of the constant, it's
just using the string value of the constant name. Uh, don't know if that made
sense.
Example:
Below I want to refer to DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE
to get the error type, which should be the string "WRONG_PARAMETER_TYPE".
But it just gives me the string "DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE".
I've tried accessing it with and without the DE_Constanst:: prefix.
It doesn't work either way.
Right now I'm instantiating a LineFixer object from within the same file that
the LineFixer package is in. I do it at the bottom of the file after the closing
bracket for the "LineFixer" package, which I guess is assumed
to be "main".
Eventually LineFixer will reside in its own file and will get
'required' into the file where I want to use it.
Here's the relevant code:
#start myScript.pl
{ package LineFixer;
require 'ErrorManager.pl';
require 'DE_Constants.pl';
sub new
{
my $proto = shift;
my $class = ref($proto) || $proto;
my $this = {};
bless($this, $class);
$this->{pathToFileOrHandle} = shift;
$this->{isValidHandle} = 0;
$this->{FH} = undef;
$this->{fileContents} = undef;
$this->checkFileOrHandleArg();
return $this;
}
sub checkFileOrHandleArg
{
my $this = shift;
if ( $this->is_a_filehandle() )
{
$this->{isValidHandle} = 1;
return 1;
}
elsif ( $this->openFile() )
{ return 1;
}
else
{
$this->_createErrorObjOnce();
my $errorType = DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE;
my $errorMsg =
DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE.' in method LineFixer::new : '.
'You must pass either a filehandle or the valid path '.
'to a file to open for reading';
$this->{errorObj}->addToErrorList( {'type'=>$errorType, 'msg'=>$errorMsg} );
return 0;
}
}
etc........
} # end package "LineFixer"
$lineFixerObj = LineFixer->new('c:/temp/noname1');
$lineFixerObj->getFileContents();
$lineFixerObj->closeFile();
if ($lineFixerObj->hasErrors() )
{ print "it has errors!!\n";
$errorObj = $lineFixerObj->getErrorObj();
foreach my $errorArr (@{$errorObj->getErrors()})
{ print $errorArr->{'type'}."\n";
print $errorArr->{'msg'}."\n";
}
}
#end myScript.pl
#start DE_Constants.pl
{ package DE_Constants;
use constant DE_ERROR_WRONG_PARAMETER_TYPE => 'WRONG_PARAMETER_TYPE' ;
}
1;
#end DE_Constants.pl
------ Back to post --------
I can use the constant from inside "DE_Constants.pl".
By doing something like:
print DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE;
So I don't think the problem should be with the code that creates the constant.
Anyways, any help appreciated.
tia,
--ed
------------------------------
Date: 25 Jun 2003 08:37:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Accessing constants from another package/file.
Message-Id: <bdbn0f$sr$1@mamenchi.zrz.TU-Berlin.DE>
ed <coo_t2-NO-LIKE-SPAM@yahoo.com> wrote in comp.lang.perl.misc:
> Hey all. I'm trying to use some constants that I have defined
> using the "constant" module. I'm requiring the file into another package.
> The package that uses the constant is used from "main".
>
> The problem is that it isn't getting the value of the constant, it's
> just using the string value of the constant name. Uh, don't know if that made
> sense.
[...]
> Here's the relevant code:
>
> #start myScript.pl
> { package LineFixer;
>
> require 'ErrorManager.pl';
> require 'DE_Constants.pl';
Change 'require' to 'use' here. Also, switch on strictures and warnings.
With those Perl would have pointed out the problem.
[...]
> sub checkFileOrHandleArg
> {
> my $this = shift;
>
> if ( $this->is_a_filehandle() )
> {
> $this->{isValidHandle} = 1;
> return 1;
> }
> elsif ( $this->openFile() )
> { return 1;
> }
> else
> {
> $this->_createErrorObjOnce();
> my $errorType = DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE;
The sub definition is interpreted at compile time. The "require ..."
statement above, while earlier in the source code, is only executed
at run time, after the sub definition. So the interpreter doesn't know
yet that "DE_Constants::DE_ERROR_WRONG_PARAMETER_TYPE" is a constant
and reads it as a bareword. Without "strict subs" this results in
the bareword itself, which is what you are seeing.
Anno
------------------------------
Date: Tue, 24 Jun 2003 23:49:11 -0400
From: "Mark S. Warren" <mwarren@acm.org>
Subject: capturing streaming market data
Message-Id: <pan.2003.06.25.03.49.06.430289@acm.org>
There is a module Finance::Streamer that captures
realtime stock market data from Datek (now Ameritrade).
Does anyone know of similar code that will work with
Yahoo's MarketTracker and/or E*Trade's MarketCaster?
Thanks in advance.
------------------------------
Date: Tue, 24 Jun 2003 23:49:11 -0400
From: "Mark S. Warren" <mwarren@acm.org>
Subject: capturing streaming market data
Message-Id: <pan.2003.06.25.03.49.06.430289@acm.org>
There is a module Finance::Streamer that captures
realtime stock market data from Datek (now Ameritrade).
Does anyone know of similar code that will work with
Yahoo's MarketTracker and/or E*Trade's MarketCaster?
Thanks in advance.
------------------------------
Date: Wed, 25 Jun 2003 01:13:17 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: comparing rows in a multidimensional array
Message-Id: <68bddc5a3ed51d4ac5dee722f413fa41@free.teranews.com>
On 24 Jun 2003 13:13:58 -0700, r230sl55@yahoo.com (perl user) wrote:
>how can i compare rows (3 or more rows) in a multidiemensional array?
>they all contain numeric values, i need to find its similar values and
>unique values.
------------------------------
Date: 24 Jun 2003 17:21:31 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: comparing rows in a multidimensional array
Message-Id: <etofzlzrric.fsf@wormtongue.emschwar>
r230sl55@yahoo.com (perl user) writes:
> how can i compare rows (3 or more rows) in a multidiemensional array?
> they all contain numeric values, i need to find its similar values and
> unique values.
Um, how about, "Iterate through the rows, keeping track of similar and
unique values." On such a vague description of what you're trying to
do, I don't think anyone can give you more detailed help.
If you could show us what you've tried so far, and how what it does
differs from what you want it to do, we'd be able to give more
specific help.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Tue, 24 Jun 2003 23:27:20 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: comparing rows in a multidimensional array
Message-Id: <3ef8de03.256463670@news.erols.com>
r230sl55@yahoo.com (perl user) wrote:
: how can i compare rows (3 or more rows) in a multidiemensional array?
What do you mean by a "row?"
Alien terms like "row" and "column" must be defined before they can be
superimposed on Perl's "array of array references" scheme.
Comparing three or more anything is only a slight complication of
comparing two of anything.
: they all contain numeric values, i need to find its similar values and
: unique values.
See perlfaq4, "How do I compute the difference of two arrays? How do
I compute the intersection of two arrays?"
The Array::Compare module may be useful.
------------------------------
Date: Wed, 25 Jun 2003 01:13:39 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: Re: comparing rows in a multidimensional array
Message-Id: <fa038f335275f0bd06618ef38fe4527c@free.teranews.com>
On 24 Jun 2003 17:21:31 -0600, Eric Schwartz <emschwar@pobox.com>
wrote:
>r230sl55@yahoo.com (perl user) writes:
>> how can i compare rows (3 or more rows) in a multidiemensional array?
>> they all contain numeric values, i need to find its similar values and
>> unique values.
>
>Um, how about, "Iterate through the rows, keeping track of similar and
>unique values." On such a vague description of what you're trying to
>do, I don't think anyone can give you more detailed help.
>
>If you could show us what you've tried so far, and how what it does
>differs from what you want it to do, we'd be able to give more
>specific help.
>
>-=Eric
------------------------------
Date: Wed, 25 Jun 2003 01:13:44 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: Re: comparing rows in a multidimensional array
Message-Id: <59511cfa205d2957e547af28a8b8b6ce@free.teranews.com>
On Tue, 24 Jun 2003 23:27:20 GMT, tiltonj@erols.com (Jay Tilton)
wrote:
>r230sl55@yahoo.com (perl user) wrote:
>
>: how can i compare rows (3 or more rows) in a multidiemensional array?
>
>What do you mean by a "row?"
>
>Alien terms like "row" and "column" must be defined before they can be
>superimposed on Perl's "array of array references" scheme.
>
>Comparing three or more anything is only a slight complication of
>comparing two of anything.
>
>: they all contain numeric values, i need to find its similar values and
>: unique values.
>
>See perlfaq4, "How do I compute the difference of two arrays? How do
>I compute the intersection of two arrays?"
>
>The Array::Compare module may be useful.
------------------------------
Date: Wed, 25 Jun 2003 01:13:17 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: comparing rows in a multidimensional array
Message-Id: <68bddc5a3ed51d4ac5dee722f413fa41@free.teranews.com>
On 24 Jun 2003 13:13:58 -0700, r230sl55@yahoo.com (perl user) wrote:
>how can i compare rows (3 or more rows) in a multidiemensional array?
>they all contain numeric values, i need to find its similar values and
>unique values.
------------------------------
Date: 24 Jun 2003 17:21:31 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: comparing rows in a multidimensional array
Message-Id: <etofzlzrric.fsf@wormtongue.emschwar>
r230sl55@yahoo.com (perl user) writes:
> how can i compare rows (3 or more rows) in a multidiemensional array?
> they all contain numeric values, i need to find its similar values and
> unique values.
Um, how about, "Iterate through the rows, keeping track of similar and
unique values." On such a vague description of what you're trying to
do, I don't think anyone can give you more detailed help.
If you could show us what you've tried so far, and how what it does
differs from what you want it to do, we'd be able to give more
specific help.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Tue, 24 Jun 2003 23:27:20 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: comparing rows in a multidimensional array
Message-Id: <3ef8de03.256463670@news.erols.com>
r230sl55@yahoo.com (perl user) wrote:
: how can i compare rows (3 or more rows) in a multidiemensional array?
What do you mean by a "row?"
Alien terms like "row" and "column" must be defined before they can be
superimposed on Perl's "array of array references" scheme.
Comparing three or more anything is only a slight complication of
comparing two of anything.
: they all contain numeric values, i need to find its similar values and
: unique values.
See perlfaq4, "How do I compute the difference of two arrays? How do
I compute the intersection of two arrays?"
The Array::Compare module may be useful.
------------------------------
Date: Wed, 25 Jun 2003 01:13:39 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: Re: comparing rows in a multidimensional array
Message-Id: <fa038f335275f0bd06618ef38fe4527c@free.teranews.com>
On 24 Jun 2003 17:21:31 -0600, Eric Schwartz <emschwar@pobox.com>
wrote:
>r230sl55@yahoo.com (perl user) writes:
>> how can i compare rows (3 or more rows) in a multidiemensional array?
>> they all contain numeric values, i need to find its similar values and
>> unique values.
>
>Um, how about, "Iterate through the rows, keeping track of similar and
>unique values." On such a vague description of what you're trying to
>do, I don't think anyone can give you more detailed help.
>
>If you could show us what you've tried so far, and how what it does
>differs from what you want it to do, we'd be able to give more
>specific help.
>
>-=Eric
------------------------------
Date: Wed, 25 Jun 2003 01:13:44 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: Re: comparing rows in a multidimensional array
Message-Id: <59511cfa205d2957e547af28a8b8b6ce@free.teranews.com>
On Tue, 24 Jun 2003 23:27:20 GMT, tiltonj@erols.com (Jay Tilton)
wrote:
>r230sl55@yahoo.com (perl user) wrote:
>
>: how can i compare rows (3 or more rows) in a multidiemensional array?
>
>What do you mean by a "row?"
>
>Alien terms like "row" and "column" must be defined before they can be
>superimposed on Perl's "array of array references" scheme.
>
>Comparing three or more anything is only a slight complication of
>comparing two of anything.
>
>: they all contain numeric values, i need to find its similar values and
>: unique values.
>
>See perlfaq4, "How do I compute the difference of two arrays? How do
>I compute the intersection of two arrays?"
>
>The Array::Compare module may be useful.
------------------------------
Date: Tue, 24 Jun 2003 18:32:55 -0600
From: Ron Reidy <r_reidy@comcast.net>
Subject: Re: Oracle CLOB using DBI
Message-Id: <3EF8EDB7.4080701@comcast.net>
What error (if any) are you getting? Did you 'perldoc DBD::Oracle' and
look at the section entitled 'Handling LOBS'? Did you set
LongReadLen/LongTruncOK on the $dbh?
--
Ron Reidy
Oracle DBA
Ken Chesak wrote:
> Does someone have a working code sample of Perl/DBI returning a CLOB
> column from Oracle. Here is what I came up with, I counld not get
> ORA_CLOB to work.
>
> $sth1 = $dbh->prepare(q{
> BEGIN OPEN :cursor FOR
> SELECT dbms_lob.substr( comments, 30000, 1)
> FROM comments WHERE id_comment = 46;
> END;
> });
>
> $sth1->bind_param_inout(":cursor", \$sth2, 30000, { ora_type
> => ORA_RS
> ET } );
> $sth1->execute();
>
> while ( @row = $sth2->fetchrow ) {
> print "row = @row\n";
> }
>
> Thanks
--
Ron Reidy
Oracle DBA
------------------------------
Date: Wed, 25 Jun 2003 01:13:49 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: Re: Oracle CLOB using DBI
Message-Id: <7a3e0953645700eae863462c9321c142@free.teranews.com>
On 24 Jun 2003 13:55:40 -0700, datavector@hotmail.com (Ken Chesak)
wrote:
>Does someone have a working code sample of Perl/DBI returning a CLOB
>column from Oracle. Here is what I came up with, I counld not get
>ORA_CLOB to work.
>
>$sth1 = $dbh->prepare(q{
> BEGIN OPEN :cursor FOR
> SELECT dbms_lob.substr( comments, 30000, 1)
> FROM comments WHERE id_comment = 46;
> END;
> });
>
> $sth1->bind_param_inout(":cursor", \$sth2, 30000, { ora_type
>=> ORA_RS
>ET } );
> $sth1->execute();
>
> while ( @row = $sth2->fetchrow ) {
> print "row = @row\n";
> }
>
>Thanks
------------------------------
Date: Wed, 25 Jun 2003 01:13:54 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: Re: Oracle CLOB using DBI
Message-Id: <f6a9d4b3046ac6d58a160bba22202047@free.teranews.com>
On Tue, 24 Jun 2003 18:32:55 -0600, Ron Reidy <r_reidy@comcast.net>
wrote:
>What error (if any) are you getting? Did you 'perldoc DBD::Oracle' and
>look at the section entitled 'Handling LOBS'? Did you set
>LongReadLen/LongTruncOK on the $dbh?
>
>--
>Ron Reidy
>Oracle DBA
>
>Ken Chesak wrote:
>> Does someone have a working code sample of Perl/DBI returning a CLOB
>> column from Oracle. Here is what I came up with, I counld not get
>> ORA_CLOB to work.
>>
>> $sth1 = $dbh->prepare(q{
>> BEGIN OPEN :cursor FOR
>> SELECT dbms_lob.substr( comments, 30000, 1)
>> FROM comments WHERE id_comment = 46;
>> END;
>> });
>>
>> $sth1->bind_param_inout(":cursor", \$sth2, 30000, { ora_type
>> => ORA_RS
>> ET } );
>> $sth1->execute();
>>
>> while ( @row = $sth2->fetchrow ) {
>> print "row = @row\n";
>> }
>>
>> Thanks
------------------------------
Date: 25 Jun 2003 03:56:18 -0700
From: massion@gmx.de (FMAS)
Subject: Re: display Latin and Russian characters simultaneously
Message-Id: <f0b3f4c9.0306250256.79c3f46@posting.google.com>
Hi Alan,
Thank you for taking the time to reply to my query. I've tried to work
through your "requirements list" but it is just too difficult for me.
I am a novice at perl scripts and just do this on the top of many
other things to try to solve concrete problems.
My question was boiling down to: Is it possible to take strings with
different encodings (Latin + Cyrillic) from one text file which has
been saved in Unicode and put these strings in another file with a
perl script.
From your message I understand that this is not doable unless each
character is individually encoded.
I am of course looking for a "magic wand" like "use ucd;" but if this
is not possible, then I shall forget about the whole thing because I
cannot write sophisticated algorithms.
rgds
Francois
------------------------------
Date: Wed, 25 Jun 2003 13:44:05 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: display Latin and Russian characters simultaneously
Message-Id: <Pine.LNX.4.53.0306251324090.22782@lxplus072.cern.ch>
On Wed, Jun 25, FMAS inscribed on the eternal scroll:
> I am a novice at perl scripts and just do this on the top of many
> other things to try to solve concrete problems.
That's OK: everybody has to start somewhere.
Your problem, as I see it, is that you're not only confused about how
to program this in Perl, but you're also confused about what your
input is, and what your output ought to be. Each of these issues is,
at base, a simple one, with one or more straightforward solutions.
But you need to take a bit of time out to understand each of the
building components before you try to assemble them together into a
complete house...
> My question was boiling down to: Is it possible to take strings with
> different encodings (Latin + Cyrillic) from one text file which has
> been saved in Unicode
See, this question doesn't mean anything, unfortunately.
You don't have "different encodings" in the same text file.
Latin and Cyrillic aren't "encodings", they are character repertoires.
There are several different ways of encoding those repertoires.
Those characters, along with many thousands of other characters, are
included in Unicode. There's no such thing as "saved in Unicode":
Unicode is a concept, an assignment of characters to numerical code
points, but in order to actually save characters to a file you need to
decide on a representation. Could be an encoding of Unicode (utf-8,
utf-16LE or whatever you choose); or (in an HTML context) might be
using HTML's ampersand-notation e.g &#number; , whichever is
convenient or appropriate for the purpose - see for example my
"Checklist for HTML character coding"
http://ppewww.ph.gla.ac.uk/~flavell/charset/checklist.html
> and put these strings in another file with a perl script.
Certainly you can read a file which contains your characters, once you
know how they were encoded; and put them into a file in the same or
some other encoding of unicode. But look again at your original
posting: we really had no clear idea of what you wanted - because, I
suspect, you weren't yet in a position to formulate a coherent
question (as well as maybe getting stymied by your news posting
interface...). There's no harm in that - as I say, everyone has to
start somewhere - but it does show that you'd need a bit more study of
some introductory materials before it's possible to formulate a
coherent question. Meantime, we're just dancing around each other.
> From your message I understand that this is not doable unless each
> character is individually encoded.
Again we seem to be speaking mutually incomprehensible languages.
You cannot just toss different encodings into the same file and hope
for the result to make any sense.
> I am of course looking for a "magic wand" like "use ucd;" but if this
> is not possible, then I shall forget about the whole thing because I
> cannot write sophisticated algorithms.
None of this is "sophisticated": each step is simple, but my diagnosis
would have to be that you are trying to take too many steps at once,
and the result is then widespread confusion.
hope that helps a bit.
------------------------------
Date: Tue, 24 Jun 2003 18:32:55 -0600
From: Ron Reidy <r_reidy@comcast.net>
Subject: Re: Oracle CLOB using DBI
Message-Id: <3EF8EDB7.4080701@comcast.net>
What error (if any) are you getting? Did you 'perldoc DBD::Oracle' and
look at the section entitled 'Handling LOBS'? Did you set
LongReadLen/LongTruncOK on the $dbh?
--
Ron Reidy
Oracle DBA
Ken Chesak wrote:
> Does someone have a working code sample of Perl/DBI returning a CLOB
> column from Oracle. Here is what I came up with, I counld not get
> ORA_CLOB to work.
>
> $sth1 = $dbh->prepare(q{
> BEGIN OPEN :cursor FOR
> SELECT dbms_lob.substr( comments, 30000, 1)
> FROM comments WHERE id_comment = 46;
> END;
> });
>
> $sth1->bind_param_inout(":cursor", \$sth2, 30000, { ora_type
> => ORA_RS
> ET } );
> $sth1->execute();
>
> while ( @row = $sth2->fetchrow ) {
> print "row = @row\n";
> }
>
> Thanks
--
Ron Reidy
Oracle DBA
------------------------------
Date: Wed, 25 Jun 2003 01:13:49 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: Re: Oracle CLOB using DBI
Message-Id: <7a3e0953645700eae863462c9321c142@free.teranews.com>
On 24 Jun 2003 13:55:40 -0700, datavector@hotmail.com (Ken Chesak)
wrote:
>Does someone have a working code sample of Perl/DBI returning a CLOB
>column from Oracle. Here is what I came up with, I counld not get
>ORA_CLOB to work.
>
>$sth1 = $dbh->prepare(q{
> BEGIN OPEN :cursor FOR
> SELECT dbms_lob.substr( comments, 30000, 1)
> FROM comments WHERE id_comment = 46;
> END;
> });
>
> $sth1->bind_param_inout(":cursor", \$sth2, 30000, { ora_type
>=> ORA_RS
>ET } );
> $sth1->execute();
>
> while ( @row = $sth2->fetchrow ) {
> print "row = @row\n";
> }
>
>Thanks
------------------------------
Date: Wed, 25 Jun 2003 01:13:54 GMT
From: Markus Stueker <eudora@andromeda.stueker.net>
Subject: Re: Oracle CLOB using DBI
Message-Id: <f6a9d4b3046ac6d58a160bba22202047@free.teranews.com>
On Tue, 24 Jun 2003 18:32:55 -0600, Ron Reidy <r_reidy@comcast.net>
wrote:
>What error (if any) are you getting? Did you 'perldoc DBD::Oracle' and
>look at the section entitled 'Handling LOBS'? Did you set
>LongReadLen/LongTruncOK on the $dbh?
>
>--
>Ron Reidy
>Oracle DBA
>
>Ken Chesak wrote:
>> Does someone have a working code sample of Perl/DBI returning a CLOB
>> column from Oracle. Here is what I came up with, I counld not get
>> ORA_CLOB to work.
>>
>> $sth1 = $dbh->prepare(q{
>> BEGIN OPEN :cursor FOR
>> SELECT dbms_lob.substr( comments, 30000, 1)
>> FROM comments WHERE id_comment = 46;
>> END;
>> });
>>
>> $sth1->bind_param_inout(":cursor", \$sth2, 30000, { ora_type
>> => ORA_RS
>> ET } );
>> $sth1->execute();
>>
>> while ( @row = $sth2->fetchrow ) {
>> print "row = @row\n";
>> }
>>
>> Thanks
------------------------------
Date: Wed, 25 Jun 2003 10:55:37 +0800
From: "YOKETSL" <yoketsl@singnet.com.sg>
Subject: Perl -e `"dir a*.txt"`
Message-Id: <bdb23l$g7q$1@mawar.singnet.com.sg>
Hi!
I am using Activestate Perl 5.8.0 build 806 on Windows 98SE.
I tried this command at c: prompt on 2 notebooks and 1 desktop PC
Perl -e `"dir a*.bat"`
=> On IBM T30 notebook, I could get result as AUTOEXEC.BAT
=> But on Fujitsu S6010 notebook and Dell Optiplex 110, I got NIL return !
Could someone enlightent me ?
If I have files as ATX1.BAT, ATX2.BAT, ATX3.BAT
by issuing command, Perl -e `"dir a*.bat"`
in c: prompt, I will get the following
ATX1.BAT
ATX2.BAT
ATX3.BAT
Could I have perl oneliner to have the result as ATX1.BAT ATX2.BAT
ATX3.BAT ?
Thanks.
------------------------------
Date: 25 Jun 2003 07:48:31 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Perl -e `"dir a*.txt"`
Message-Id: <slrnbfikuf.1pi.vek@station02.ohout.pharmapartners.nl>
On Wed, 25 Jun 2003 10:55:37 +0800,
YOKETSL <yoketsl@singnet.com.sg> wrote:
>Hi!
>
>I am using Activestate Perl 5.8.0 build 806 on Windows 98SE.
>
>I tried this command at c: prompt on 2 notebooks and 1 desktop PC
>
> Perl -e `"dir a*.bat"`
>
Check the FAQ:
perldoc -q "Why don't perl one-liners work on my DOS/Mac/VMS system?"
Villy
------------------------------
Date: 25 Jun 2003 00:18:17 -0700
From: gordon@ockham.be (gordon)
Subject: Re: perlio problem? redhat 9, perl 5.8.0
Message-Id: <2369e2ad.0306242318.17c01c28@posting.google.com>
gordon@ockham.be (gordon) wrote in message news:<2369e2ad.0306240806.142022a9@posting.google.com>...
> To make the script work you can add a binmode F after the second file
> open, or you can change the [^\s]+ to [\S]+ or \S+. But the question
> is, why are either of these things necessary? I don't understand the
> fundamental cause of this problem and don't want to go through all the
> legacy scripts if I can help it.
As an update, I can run the legacy scripts without change with
LC_ALL=POSIX
in the environment. But I still don't understand why it's necessary
when I've some simple ASCII text (read: unchanged in UTF8 encoding vs
ASCII encoding) being read/written to a file, and matched against
[^\s].
Very mysterious. Any feedback much appreciated!
- gordon
------------------------------
Date: 24 Jun 2003 23:34:16 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Resource for Perl Newbies
Message-Id: <slrnbfhnvq.1ip.mgjv@verbruggen.comdyn.com.au>
On Mon, 23 Jun 2003 15:40:21 -0500,
Anthony M. Saffer <anthony@nospam.safferconsulting.com> wrote:
> I just posted the complete hyperlinked "Teach yourself Perl in 21 days" at
> my website. You can view it at
> http://www.safferconsulting.com/perl-tut
1 - The book is not very good. It's full of errors and bad advice.
Also, it was published in 1996, which is in the early days of Perl
5. Hardly up to date.
2 - Did you get permission from Sams and/or David Till to publish this
on the Internet? Or, alternatively, did the people from "M/s.
LeafWriters (India) Pvt. Ltd." get the permission to grant you
copyright, and did they do so? If not, you should probably
contact them retrospectively.
Martien
--
|
Martien Verbruggen | Useful Statistic: 75% of the people make up
Trading Post Australia | 3/4 of the population.
|
------------------------------
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 5133
***************************************