[24970] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 7220 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 7 18:07:01 2004

Date: Thu, 7 Oct 2004 15:05:10 -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           Thu, 7 Oct 2004     Volume: 10 Number: 7220

Today's topics:
    Re: -d file test using Active State PERL under Windows <bik.mido@tiscalinet.it>
        DBI selectall_hashref <jeff.gilbertson@gmail.com>
    Re: DBI selectall_hashref <mritty@gmail.com>
    Re: DBI selectall_hashref <nobull@mail.com>
    Re: DBI selectall_hashref <tadmc@augustmail.com>
    Re: GD::Graph - Can it create a stock chart <jarsonk@nospam.com>
    Re: How to prevent the removal of \ from pairs of \\? <bigal187@invalid.rx.eastcoasttfc.com>
    Re: How to prevent the removal of \ from pairs of \\? <abigail@abigail.nl>
    Re: Is PHP still slower than Perl? <tony@NOSPAM.demon.co.uk>
    Re: Is PHP still slower than Perl? <postmaster@castleamber.com>
        MIME Extract from Mail (giAndrea)
    Re: MIME Extract from Mail <nobull@mail.com>
    Re: MIME Extract from Mail <glex_nospam@qwest.invalid>
    Re: MIME Extract from Mail <tadmc@augustmail.com>
        query to join two tables in 2 different Oracle schema (Harry)
    Re: query to join two tables in 2 different Oracle sche <byskov@diku.dk>
    Re: Regex gurus question <shawn.corey@sympatico.ca>
    Re: Return top-N of Hashes - hash splice? (Charles DeRykus)
    Re: Running vi from Perl (DrStrangepork)
    Re: Running vi from Perl (DrStrangepork)
    Re: Running vi from Perl (Walter Roberson)
    Re: Running vi from Perl <ron.parker@povray.org>
    Re: Storable.pm size limit? <bik.mido@tiscalinet.it>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 07 Oct 2004 23:58:42 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: -d file test using Active State PERL under Windows
Message-Id: <tm3bm0pgbofk2g2hbm7e2v9ojsktcgn725@4ax.com>

On Thu, 7 Oct 2004 09:58:35 +1000, "Scott" <usenet739_yahoo_com_au>
wrote:

>I have this test script:
>
>my $dir = "C:/WINNT";
>opendir(DIR,$dir) || die("Cannot open directory $dir");

BTW: it may be sensible to include $! in the die() message. Also, I
*like* to put a \n at the end of it, but then often I get slapped for
it seems that people here have a tendency to prefer the more verbose
info given by the form you use yourself. 

>my @files = readdir DIR;
>closedir(DIR);
>
>foreach (@files) {
>   print "$_\n" if -d;  # -d -f -t -T -B
>}

As a side note you may be interested to know that this test script is
ridiculously verbose for what it does. If it's just a minimal example
of something else, then just fine! But to give you an idea, simple
one-liners like

  perl -le "print for grep -d, <*>"

or

  perl -le "-d and print for <*>"

would just do (almost) what your script does.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: 7 Oct 2004 09:56:48 -0700
From: "Jeff" <jeff.gilbertson@gmail.com>
Subject: DBI selectall_hashref
Message-Id: <1097168208.619457.52960@c13g2000cwb.googlegroups.com>

I'm having issues with selectall_hashref.  Here's my code:

===================

#!/usr/bin/perl

use DBI;
use Data::Dumper;

$ENV{'TDSPORT'}="1433";

# Set Login Information
$Server="xxxx.xxx.xxx";
$User="xxxxx";
$Pass="xxxxxx";

# Connect to database
$dbh=DBI->connect("dbi:Sybase:server=$Server",$User,$Pass) || die
"$DBI::errstr\n";

# Read from database
$SQL="
SELECT
CallID,PlannedDate,PlannedTime,Solution,Status,DevApprov,qaApprvl,whoApprvdDev,whoApprvdQA
FROM heat.Detail WHERE PlannedDate = '2004-10-06'
";
$Results = $dbh->selectall_hashref("$SQL","CallID");

# Disconnect from database
$dbh->disconnect;

__END__


Here's what Data::Dumper shows . . .

$VAR1 = {
'00492613' => {
'CallID' => '00492613',
'PlannedTime' => ' ',
'Status' => '1 - Pending',
'PlannedDate' => '2004-10-06',
'DevApprov' => 'F',
'Solution' => 'test lead notification',
'whoApprvdQA' => ' ',
'qaApprvl' => 'F',
'whoApprvdDev' => ' '
},
};


=====================

Question one:    Where is the $VAR1 variable coming from?
Question two:    What happened to $Results?
Question three:  How do I reference the data (ie, in a print
statement)?

Thanks.



------------------------------

Date: Thu, 07 Oct 2004 17:11:50 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: DBI selectall_hashref
Message-Id: <qNe9d.3625$Ua.878@trndny01>

"Jeff" <jeff.gilbertson@gmail.com> wrote in message
news:1097168208.619457.52960@c13g2000cwb.googlegroups.com...
> Subject: DBI selectall_hashref

You do not seem to have a question about selectall_hashref.  You seem to
have questions about Data::Dumper.  Please try to put the subject of
your post in the Subject of your post.

> Here's what Data::Dumper shows . . .
>
> $VAR1 = {
> '00492613' => {
> 'CallID' => '00492613',
> 'PlannedTime' => ' ',
> 'Status' => '1 - Pending',
> 'PlannedDate' => '2004-10-06',
> 'DevApprov' => 'F',
> 'Solution' => 'test lead notification',
> 'whoApprvdQA' => ' ',
> 'qaApprvl' => 'F',
> 'whoApprvdDev' => ' '
> },
> };
>
> =====================
>
> Question one:    Where is the $VAR1 variable coming from?

Did you read perldoc Data::Dumper ?

> Question two:    What happened to $Results?

Did you read perldoc Data::Dumper ?

> Question three:  How do I reference the data (ie, in a print
> statement)?

$Results is a hash reference.  The hash it references contains one key,
the string '00492613'.  This key's value is a hash reference.

$Results is a hash reference
%$Results is the hash it refers to.
$$Results{'00492613'} is a reference to the 'inner' hash.
$Results->{'00492613'}is another way to write that
$Results->{'00492613'}->{'PlannedDate'} is the value '2004-10-06'.

I suggest you read one or more of the following documentations:
perldoc perlreftut
perldoc perllol
perldoc perldsc

Paul Lalli





------------------------------

Date: Thu, 07 Oct 2004 18:20:47 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: DBI selectall_hashref
Message-Id: <ck3tkv$4vt$1@sun3.bham.ac.uk>



Jeff wrote:

> I'm having issues with selectall_hashref.

No you are not.  Or maybe you are but all the questions you have posted 
here have nothing to do with selectall_hashref and are purely questions 
about references and Data::Dumper.  Partitioning your problem correctly 
is a very important skill to develeop.

> $Results = $dbh->selectall_hashref("$SQL","CallID");
> 
> # Disconnect from database
> $dbh->disconnect;

> Here's what Data::Dumper shows . . .
> 
> $VAR1 = {
> '00492613' => {
> 'CallID' => '00492613',
> 'PlannedTime' => ' ',
> 'Status' => '1 - Pending',
> 'PlannedDate' => '2004-10-06',
> 'DevApprov' => 'F',
> 'Solution' => 'test lead notification',
> 'whoApprvdQA' => ' ',
> 'qaApprvl' => 'F',
> 'whoApprvdDev' => ' '
> },
> };
> 
> 
> =====================
> 
> Question one:    Where is the $VAR1 variable coming from?

It is the default name Data::Dumper::Dumper will use for the first 
variable you pass it unless you tell it otherwise.

> Question two:    What happened to $Results?

At a guess you passed it as a argument to Data::Dumper::Dumper but for 
some reason you deleted the line in your code where you did this before 
posting.

> Question three:  How do I reference the data (ie, in a print
> statement)?

The use of references is covered in

perldoc perlreftut
perldoc perlref

Typically you'd do something like:

print $Results->{00492613}{Status};

Note:

You should always declare all variables as lexically scoped in the
smallest applicable lexical scope unless you have a positive reason to
do otherwise. BTW: this is not perculliar to Perl, it applies in all
programming languges - allowing that a language not having lexical
variables is a positive reason :-).

For Perl this means that most of the time the declaration of scalars
should be combined with the first assignment. BTW: this to is not
perculliar to Perl, it also applies in other programming languges
where assignment and declaration can be combined.

By following this convention you will be able to get maximum beniefit
out of putting "use strict" at the top of all your scripts.

Try to get into this habit now, do not wait for your failure to do so
to cause you the unecessary distress of wasting your own time and that
of other people.  The longer you leave it the harder you will find it
to adjust.  Worse still, if you leave it too long you may never adjust
and may mutate into a bitter and twisted troll.



------------------------------

Date: Thu, 7 Oct 2004 13:44:41 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: DBI selectall_hashref
Message-Id: <slrncmb3kp.b6m.tadmc@magna.augustmail.com>

Jeff <jeff.gilbertson@gmail.com> wrote:

> $Results = $dbh->selectall_hashref("$SQL","CallID");
                                     ^    ^
                                     ^    ^
   $Results = $dbh->selectall_hashref($SQL,"CallID");


See:

   perldoc -q vars

       What's wrong with always quoting "$vars"?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 7 Oct 2004 12:13:36 -0400
From: "Jarson" <jarsonk@nospam.com>
Subject: Re: GD::Graph - Can it create a stock chart
Message-Id: <SWd9d.31844$HO1.1289658@news20.bellglobal.com>

Your example is not a stock chart.  It is a line chart (although a very nice 
one, and I do want to know how you were able to get all the daily data yet 
only show monthly data titles and vertical lines).

A stock chart (again, perhaps not the most correct name) shows the 
high/low/close for each data point.

Jarson


"Gregory Toomey" <nospam@bigpond.com> wrote in message 
news:2sl464F1m4qf8U1@uni-berlin.de...
> Jarson wrote:
>
>> I would like to know if GD::Graph can be used to create a "Stock Chart".
>> This is a series of lines with three data points representing the
>> high/low/close. Perhaps there is a more correct name for this type of
>> chart,
>> but it is referred to this in MS Excel.  My application is NOT for
>> tracking stocks, and I will use it for the high/low/average for several
>> days.
>
> Yes. In fact many online charting applications use Perl.
>
> http://ipo-australia.com/scgi-bin/beta/graph.cgi?graph=XAO_year_550x350
> (This uses plain GD & is not in production yet).
>
> gtoomey 




------------------------------

Date: Thu, 7 Oct 2004 09:04:58 -0700
From: "187" <bigal187@invalid.rx.eastcoasttfc.com>
Subject: Re: How to prevent the removal of \ from pairs of \\?
Message-Id: <2sl7pdF1mbc3lU1@uni-berlin.de>

Bernie Cosell wrote:
> Uri Guttman <uri@stemsystems.com> wrote:
>
> } >>>>> "PL" == Paul Lalli <mritty@gmail.com> writes:
>
> }   PL> Note that I don't especially understand why this works.  Why
> would }   PL> single-quoted heredocs not work the same as 'normal'
> single-quoted }   PL> strings?
> }
> } because in single quoted strings \ is needed to escape ' and \. in
> } single quoted heredocs there is no need to escape anything as perl
> just } scans for the closing token. in normal double quoted heredocs,
> perl has } to scan for \ escapes like \n and \t so it must handle \\
> and it makes } that into just \.
>
> Why does that apply if you use 'q' with an explicit terminator?
> [which was, I thought, the original question.  Is there a need to
> scan for '\' if I'm doing:  q{stuff} ?

It still needs to scan, how else do you think you would escape the
closing token? :-)




------------------------------

Date: 07 Oct 2004 21:46:53 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: How to prevent the removal of \ from pairs of \\?
Message-Id: <slrncmbead.34g.abigail@alexandra.abigail.nl>

Tad McClellan (tadmc@augustmail.com) wrote on MMMMLV September MCMXCIII
in <URL:news:slrncmajk3.akq.tadmc@magna.augustmail.com>:
||  Bernie Cosell <bernie@fantasyfarm.com> wrote:
|| > Uri Guttman <uri@stemsystems.com> wrote:
|| > 
|| >} >>>>> "PL" == Paul Lalli <mritty@gmail.com> writes:
|| > 
|| > }   PL> Note that I don't especially understand why this works.  Why would
|| > }   PL> single-quoted heredocs not work the same as 'normal' single-quoted
|| > }   PL> strings?
|| > } 
|| > } because in single quoted strings \ is needed to escape ' and \. 
||  
||  
|| > Why does that apply if you use 'q' with an explicit terminator?  
||  
||  
||  For the same reason as when using single quotes, to escape the terminator.
||  
||  
|| > Is there a need to scan for '\' if
|| > I'm doing:  q{stuff} ?
||  
||  
||  Yes, as you might need a
||  
||     \}
||  
||  in there somewhere.


Or a \{



Abigail
-- 
perl  -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
          for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
          print chr 0x$& and q
          qq}*excess********}'


------------------------------

Date: Thu, 7 Oct 2004 18:46:22 +0100
From: "Tony Marston" <tony@NOSPAM.demon.co.uk>
Subject: Re: Is PHP still slower than Perl?
Message-Id: <ck3vdf$2ea$1$830fa7b3@news.demon.co.uk>


"John Bokma" <postmaster@castleamber.com> wrote in message 
news:Xns957B5A956333Fcastleamber@130.133.1.4...
> "Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in
>> "John Bokma" <postmaster@castleamber.com> wrote in message
>
> [ snip ]
>
>>>> People should always be writing wrapper functions or classes to
>>>> handle db connections, to remove such stuff as addslashes()ing. Use
>>>> func_num_args() to find out the number of arguments passed to a php
>>>> function and func_get_arg([number]) to get the [number]th argument
>>>> passed. I've written such a function for myself.
>>>
>>> Yes, and everybody has to write wrapper functions. You get the point
>>> now, or do you want it spelled out?
>>
>> But different developers will write wrapper functions in different
>> ways. Whish one should I choose? Why?
>
> The one that solves your problem the most efficient.
>
> Imagine everybody writing wrapper functions all the time instead of
> doing real work...

Image using the wrong wrapper function. Besides, even if you do write your 
own wrapper function you only ever do so once. Then you re-use it, and 
re-use it, and re-use it.

>>> Yes, in Perl that is called DBI. You don't have to write it yourself.
>>
>> Yes, but what happens if I don't like the way it works?
>
> In that rare case you can write a wrapper, and make it available on
> CPAN.
>
>>> Programming shouldn't be about reinventing wheels, and worse
>>> reinventing bugs.
>>
>> But it is about reinventing wheels. A pram wheel is no good for a
>> sports car, so you have to invent one that works under those
>> circumstances.
>
> If you want to screw something in the wall, do you make your own custom
> screws or do you go to the hardware store?

If I want to fix something to a wall then a screw is not necessarily the 
only method. What about a nail or even glue? There are different possible 
fixings for different types of wall, so just because someone has invented 
one type of fixing does mean that it is the only type of fixing.

>> I have stopped using other people's solutions for the following
>> reasons: (a) There are too many solutions from too many people. The
>> people have various skill levels (from pathetic to passable), and the
>> solutions are tailored for specific purposes.
>
> With PHP, Perl or in general?

With PHP, UNIFACE, COBOL and a few other languages I have used in the past. 
I don't touch perl.

>> (b) It takes too much time to go though all the possible solutions to
>> find one that is applicable to the problem in hind. I find it much
>> quicker to use my decades of experience in devising my own solution.
>
> I use my decades of experience to select a library or module, or consult
> the right people. It has always saved me a lot of time and trouble.

When there are thousands of competing libraries out there, how do I know 
which is the right one? Should I spend weeks looking and comparing, or days 
in writing my own?

Who are the "right people"? I have come across too many people who class 
themselves as "experts" who turn out to be charlatans and quacks.

-- 
Tony Marston

http://www.tonymarston.net





------------------------------

Date: 7 Oct 2004 19:09:18 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Is PHP still slower than Perl?
Message-Id: <Xns957B8FFC770D4castleamber@130.133.1.4>

"Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in

> "John Bokma" <postmaster@castleamber.com> wrote in message 

[ snip ]

>> Imagine everybody writing wrapper functions all the time instead of
>> doing real work...
> 
> Image using the wrong wrapper function.

Yeah, I can. And I can even more imagine the same person writing his/her  
own "software"...

> Besides, even if you do write
> your own wrapper function you only ever do so once. Then you re-use
> it, and re-use it, and re-use it.

Yes, that is why there is CPAN. To re-use it. I understood that PHP has 
something along these lines too.

>> If you want to screw something in the wall, do you make your own
>> custom screws or do you go to the hardware store?
> 
> If I want to fix something to a wall then a screw is not necessarily
> the only method. What about a nail or even glue?

So you make your own nails, and brew you own glue. Probably dig your own 
metal, and herd your own cows.

> There are different
> possible fixings for different types of wall, so just because someone
> has invented one type of fixing does mean that it is the only type of
> fixing.

And hence, CPAN doesn't have one module called Screw.pm

>>> I have stopped using other people's solutions for the following
>>> reasons: (a) There are too many solutions from too many people. The
>>> people have various skill levels (from pathetic to passable), and
>>> the solutions are tailored for specific purposes.
>>
>> With PHP, Perl or in general?
> 
> With PHP, UNIFACE, COBOL and a few other languages I have used in the
> past. I don't touch perl.

That sounds like "I don't use glue, ever! Because I have experience with 
nails and screws, and hey, I make them myself"

>> I use my decades of experience to select a library or module, or
>> consult the right people. It has always saved me a lot of time and
>> trouble. 
> 
> When there are thousands of competing libraries out there,

Sure, there are thousands of competing modules on CPAN...
There are in total 7057 modules (  2004-10-07, http://cpan.org/ )
You really think that are 7057 similar and competing libraries?

> how do I know which is the right one?

Little research, asking. Some modules come with the "core" distribution 
of Perl. And sometimes you learn some new ones. Staying in touch with 
the languages you use is always important. You can't learn a language 
and it's important libraries in a weekend.

> Should I spend weeks looking and
> comparing, or days in writing my own?

Yep, days writing your own, and tweaking for each new project, bug 
fixing, and testing backwards compability. The looking needs only to be 
done once. Or you write the perfect library from scratch? 

> Who are the "right people"?

Read usenet, you learn fast. Also some right people in the Perl group 
recommend modules now and then.

> I have come across too many people who
> class themselves as "experts" who turn out to be charlatans and
> quacks. 

Yeah ;-)

-- 
John                               MexIT: http://johnbokma.com/mexit/
                           personal page:       http://johnbokma.com/
        Experienced programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html


------------------------------

Date: 7 Oct 2004 08:11:44 -0700
From: andrea.girardi@gmail.com (giAndrea)
Subject: MIME Extract from Mail
Message-Id: <bd8cfbe0.0410070711.117949ed@posting.google.com>

Hi 

How can I find a perl script to extract Body Text and Attach from a Mail file?

hi, Andrea


------------------------------

Date: Thu, 07 Oct 2004 19:35:05 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: MIME Extract from Mail
Message-Id: <ck428q$4m6$1@slavica.ukpost.com>

giAndrea wrote:

> How can I find a perl script to extract Body Text and Attach from a Mail file?

Modules to manipulate MIME messages can be found in the usual place (see 
   FAQ) using the obvious keywords.



------------------------------

Date: Thu, 07 Oct 2004 13:36:54 -0500
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: MIME Extract from Mail
Message-Id: <a1g9d.19$A6.37716@news.uswest.net>

giAndrea wrote:
> How can I find a perl script to extract Body Text and Attach from a Mail file?

By looking through available modules on CPAN:
   http://search.cpan.org/

By using CPAN or even Google, you'd have found an answer by now and 
already be working on your solution.


------------------------------

Date: Thu, 7 Oct 2004 13:46:15 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: MIME Extract from Mail
Message-Id: <slrncmb3nn.b6m.tadmc@magna.augustmail.com>

giAndrea <andrea.girardi@gmail.com> wrote:


> How can I find a perl script to extract Body Text and Attach from a Mail file?


You can use a "search engine" to find things. Did you try that?


Step 1) Write a Perl program to extract Body Text and Attach from a Mail file.

Step 2) Search the filesystem on the computer where you wrote it.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 07 Oct 2004 19:00:13 GMT
From: harryooopotter@hotmail.co_ (Harry)
Subject: query to join two tables in 2 different Oracle schema
Message-Id: <1ng9d.38959$N%.26178@edtnps84>

[x-post to c.l.p.m]

At my work we have an Oracle 9 database sitting on a W2K server.
Therre are two different schema, one for overall info and the other
just for storing reports.

schema A: a table "study" with study_id, etc.

schema B: a table "report" with study_id, etc.

How can I made a query, in SQL Plus (or PL/SQL, or Perl script)
that can join the table together?

pseduo code:
  
  select s.study_id, r.report_type
  from study s connected to schema A using userid xxx password yyy,
       report r connected to schema B using userid ppp password qqq
  where s.study_id = r.study_id

Is it doable?

TIA



------------------------------

Date: Thu, 7 Oct 2004 21:55:19 +0200
From: Klaus Byskov Pedersen <byskov@diku.dk>
To: Harry <harryooopotter@hotmail.co_>
Subject: Re: query to join two tables in 2 different Oracle schema
Message-Id: <Pine.LNX.4.58.0410072146170.16871@ask.diku.dk>

So you have two schema's A and B right? And in each there is a table that
you want to use in a join.
study is in schema A owned by some user, A_USER.
report is in schema B owned by some user, B_USER.

You have a user that you want to able to make this join. Lets call the
user ANDREW.

so in SQL-plus you grant ANDREW the right to select on both these tables.

log in as A_USER.

>grant select on A.study to ANDREW;

log in as B_USER

>grant select on B.report to ANDREW;

log in as ANDREW

>select s.study_id, r.repoty_type
>from A.study s, B.report r
>where s.study_id = r.study_id;

And that should be it!

If the tables are in different DATABASES (where you actually have to log
in) you might want to look at the CREATE DATABASE LINK command:

https://cwisdb.cc.kuleuven.ac.be/ora10doc/server.101/b10759/statements_5005.htm

Hope it helps you!

/Klaus

On Thu, 7 Oct 2004, Harry wrote:

//[x-post to c.l.p.m]
//
//At my work we have an Oracle 9 database sitting on a W2K server.
//Therre are two different schema, one for overall info and the other
//just for storing reports.
//
//schema A: a table "study" with study_id, etc.
//
//schema B: a table "report" with study_id, etc.
//
//How can I made a query, in SQL Plus (or PL/SQL, or Perl script)
//that can join the table together?
//
//pseduo code:
//
//  select s.study_id, r.report_type
//  from study s connected to schema A using userid xxx password yyy,
//       report r connected to schema B using userid ppp password qqq
//  where s.study_id = r.study_id
//
//Is it doable?
//
//TIA
//
//


------------------------------

Date: Thu, 07 Oct 2004 11:36:35 -0400
From: Shawn Corey <shawn.corey@sympatico.ca>
Subject: Re: Regex gurus question
Message-Id: <1nd9d.24959$jj2.1165776@news20.bellglobal.com>

John W. Krahn wrote:

> That will work fine if the OP's actual data is the same as the example 
> he presented ($test = "x12345";) however if the actual data looks 
> something like "x12345 y12345 z12345" then that will not produce a 
> correct result.
> 
> 
> John

But "x12345a" could also create problems. As I said, input validation 
would be done before processing. By this point in the program, $test 
will have valid data.

	--- Shawn


------------------------------

Date: Thu, 7 Oct 2004 19:32:27 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Return top-N of Hashes - hash splice?
Message-Id: <I58BM3.Jyz@news.boeing.com>

In article <1Xp7d.539$x65.53@trnddc06>,
Jürgen Exner <jurgenex@hotmail.com> wrote:
>Edward Wijaya wrote:
>> With this hashes:
>>
>> $hash = {
>>           '1-1' => 3,
>>           '2-3' => 2,
>>           '2-2' => 1,
>>           '1-2' => 6,
>>           '1-3' => 3
>>         };
>>
>> What's the best to retrieve the top-N hashes
>> from it. So, with N = 3 it will become:
>
>Hashes by definition don't have a (usable) sequence or order. Therefore your 
>request for the top n elements of a hash doesn't make any sense.
>
>If you want/need to preserve the sequence of elements then you picked the 
>wrong data structure.
>Use an array instead. And to get the first $n elements use an array slice
>    @foo = @bar[0..$n-1];
>

Or, possibly, use Tie::IxHash to preserve order:

my $tie = Tie::IxHash->new( '1-1'=>3, '2-3'=>2, '2-2'=>1,
                            '1-2'=>6, '1-3'=>3 );

print $tie->Keys($_),"=>",$tie->Values($_),"\n" for 0..2;


--
Charles DeRykus


------------------------------

Date: 7 Oct 2004 13:34:25 -0700
From: rickKasten@gmail.com (DrStrangepork)
Subject: Re: Running vi from Perl
Message-Id: <a4cf4e10.0410071234.5ed87d88@posting.google.com>

I did not post my code, because I thought it was a simple answer, and
because my code won't help, but I'll give it anyway:

`p4 protect`;   or   system "p4 protect";

Both versions have the same problem.  In Win32, it launches Notepad. 
In Linux, it launches vi and I get the warning I noted.


------------------------------

Date: 7 Oct 2004 13:49:29 -0700
From: rickKasten@gmail.com (DrStrangepork)
Subject: Re: Running vi from Perl
Message-Id: <a4cf4e10.0410071249.68034a9@posting.google.com>

rickKasten@gmail.com (DrStrangepork) wrote in message news:<a4cf4e10.0410061323.789d8f39@posting.google.com>...
> I wrote a script from which I sometimes launch a system command.  In
> Win32, this system call launches Notepad, but in Linux it must launch
> vi.  It does, but I get a warning "Vim: Warning: Output is not to a
> terminal".  vi is there, because the commands work (like :q exits and
> I am returned to my perl script), but like the warning says, no
> output.  How can I resolve this problem?

I figured it out.  The proper code is

  system "p4 protect";

Thanks!


------------------------------

Date: 7 Oct 2004 21:42:03 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Running vi from Perl
Message-Id: <ck4d7b$fnc$1@canopus.cc.umanitoba.ca>

In article <a4cf4e10.0410071234.5ed87d88@posting.google.com>,
DrStrangepork <rickKasten@gmail.com> wrote:
:I did not post my code, because I thought it was a simple answer, and
:because my code won't help, but I'll give it anyway:

:`p4 protect`;   or   system "p4 protect";

:Both versions have the same problem.  In Win32, it launches Notepad. 
:In Linux, it launches vi and I get the warning I noted.

Then your problem is in assuming that stdin and stdout are connected
to your terminal (or that there is a controlling terminal at all.)

I would suggest that at the very least, you change the linux 'p4'
script to be closer to

  #!/bin/sh
  [ $# -eq 0 ] && echo "Syntax: $0 filename" >&2 && exit 1
  /usr/bin/vi "$@" 1>&0 2>&1

That is, send the stdout (file descriptor #1) to the location of stdin
(file descriptor #0), and send stderr (file descriptor #2) to the same
place as stdout (file descriptor #1).
-- 
Inevitably, someone will flame me about this .signature.


------------------------------

Date: Thu, 7 Oct 2004 16:56:30 -0500
From: Ron Parker <ron.parker@povray.org>
Subject: Re: Running vi from Perl
Message-Id: <slrncmbese.np6.ron.parker@mail.parkrrrr.com>

On 7 Oct 2004 21:42:03 GMT, Walter Roberson wrote:
> I would suggest that at the very least, you change the linux 'p4'
> script to be closer to
> 
>   #!/bin/sh
>   [ $# -eq 0 ] && echo "Syntax: $0 filename" >&2 && exit 1
>   /usr/bin/vi "$@" 1>&0 2>&1

If 'p4' is what I think it is, it's not a script:

$ p4

    Perforce -- the Fast Software Configuration Management System.

    p4 is Perforce's client tool for the command line.  Try:
    [...]

$ file `which p4`
/usr/bin/p4: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically 
   linked (uses shared libs), stripped

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


------------------------------

Date: Thu, 07 Oct 2004 23:58:41 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Storable.pm size limit?
Message-Id: <a43bm09vle686vn0vp923kf8sfl5k2t0sk@4ax.com>

On Wed, 6 Oct 2004 14:52:41 +0000 (UTC), KKramsch
<karlUNDERSCOREkramsch@yahooPERIODcom.invalid> wrote:

>  perl -MStorable -e '$h = retrieve "mongo"; printf "%d\n", scalar keys %$h'

Just a minor side note:

  perl -MStorable -e '$h = retrieve "mongo"; print scalar keys %$h'

or even

  perl -MStorable -e 'print scalar keys %{retrieve "mongo"}'

the (main) point being that (as 'Perl' neq 'C') most times a simple
print() would do, instead of a prinf().


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 7220
***************************************


home help back first fref pref prev next nref lref last post