[29907] in Perl-Users-Digest
Perl-Users Digest, Issue: 1150 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 3 03:25:18 2008
Date: Thu, 3 Jan 2008 00:25:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 3 Jan 2008 Volume: 11 Number: 1150
Today's topics:
Creating a feedback form in html <knelson22@gmail.com>
Re: Creating a feedback form in html <ivan@0x4849.net>
Re: Creating a feedback form in html <knelson22@gmail.com>
Re: Creating a feedback form in html <tzz@lifelogs.com>
Re: FAQ 5.16 Is there a leak/bug in glob()? <brian.d.foy@gmail.com>
Re: FAQ 6.4 I put a regular expression into $/ but it d <ben@morrow.me.uk>
Re: FAQ 6.4 I put a regular expression into $/ but it d <brian.d.foy@gmail.com>
Re: FileHandle messes up Oracle connection <simon.chao@fmr.com>
Free Templates <ajauctionpro@gmail.com>
Re: How Do I Locate a value in a text file and evaluate <simon.chao@fmr.com>
Re: How Do I Locate a value in a text file and evaluate <jurgenex@hotmail.com>
How Do I Locate a value in a text file and evaluate it <karinwalike@comcast.net>
Re: How Do I Locate a value in a text file and evaluate <someone@example.com>
Re: How to call stored procedure using DBIx? <smallpond@juno.com>
Re: How to call stored procedure using DBIx? <tonywinslow1986@gmail.com>
Re: How to call stored procedure using DBIx? <smallpond@juno.com>
Re: How to call stored procedure using DBIx? <smallpond@juno.com>
Re: How to call stored procedure using DBIx? <tonywinslow1986@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 27 Dec 2007 15:02:31 -0800 (PST)
From: Karl <knelson22@gmail.com>
Subject: Creating a feedback form in html
Message-Id: <b951a6d2-c00a-468c-9fa2-7f90bf06dcee@c4g2000hsg.googlegroups.com>
Hi, I need to create a feedback form in a webpage I am making so
that
users can fill in text and simply hit send, and the text will be
mailed. I know there are probably lots of ways to do this, I have
been using java for 10 years so I know it could be done that way, but
I want to do it the main way that it is done on the internet today.
I
understand this is probly done with a perl script and cgi. If you
guys could give me your feedback on the most common way this is done
I
would appreciate it thanks
Karl
------------------------------
Date: Thu, 27 Dec 2007 18:37:22 -0800 (PST)
From: Ivan Novick <ivan@0x4849.net>
Subject: Re: Creating a feedback form in html
Message-Id: <e631e602-9372-42ce-b4d7-e6967ae6a4b3@f53g2000hsg.googlegroups.com>
On Dec 27, 3:02 pm, Karl <knelso...@gmail.com> wrote:
> Hi, I need to create a feedback form in a webpage I am making so
> that
> users can fill in text and simply hit send, and the text will be
> mailed. I know there are probably lots of ways to do this, I have
> been using java for 10 years so I know it could be done that way, but
> I want to do it the main way that it is done on the internet today.
> I
> understand this is probly done with a perl script and cgi. If you
> guys could give me your feedback on the most common way this is done
Yes I am a perl user, but honestly i would just try PHP in your
scenario... http://www.w3schools.com/php/php_forms.asp
If you really want to use perl, which is fair enough, than try reading
here: http://perldoc.perl.org/CGI.html
Regards,
Ivan Novick
http://www.0x4849.net
------------------------------
Date: Thu, 27 Dec 2007 21:47:00 -0800 (PST)
From: Karl <knelson22@gmail.com>
Subject: Re: Creating a feedback form in html
Message-Id: <dfb154ae-0d64-44fd-ae9e-162c8504f484@c4g2000hsg.googlegroups.com>
On Dec 27, 6:37=A0pm, Ivan Novick <i...@0x4849.net> wrote:
> On Dec 27, 3:02 pm, Karl <knelso...@gmail.com> wrote:
>
> > Hi, =A0I need to create a feedback form in a webpage I am making so
> > that
> > users can fill in text and simply hit send, and the text will be
> > mailed. =A0I know there are probably lots of ways to do this, I have
> > been using java for 10 years so I know it could be done that way, but
> > I want to do it the main way that it is done on the internet today.
> > I
> > understand this is probly done with a perl script and cgi. =A0If you
> > guys could give me your feedback on the most common way this is done
>
> Yes I am a perl user, but honestly i would just try PHP in your
> scenario...http://www.w3schools.com/php/php_forms.asp
>
> If you really want to use perl, which is fair enough, than try reading
> here:http://perldoc.perl.org/CGI.html
>
> Regards,
> Ivan Novickhttp://www.0x4849.net
Thanks man ya Im definatly usin php found it was much better
------------------------------
Date: Fri, 28 Dec 2007 11:57:02 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Creating a feedback form in html
Message-Id: <86ve6izor5.fsf@lifelogs.com>
On Thu, 27 Dec 2007 18:37:22 -0800 (PST) Ivan Novick <ivan@0x4849.net> wrote:
IN> On Dec 27, 3:02 pm, Karl <knelso...@gmail.com> wrote:
>> Hi, I need to create a feedback form in a webpage I am making so that
>> users can fill in text and simply hit send, and the text will be
>> mailed. I know there are probably lots of ways to do this, I have
>> been using java for 10 years so I know it could be done that way, but
>> I want to do it the main way that it is done on the internet today.
>> I understand this is probly done with a perl script and cgi. If you
>> guys could give me your feedback on the most common way this is done
IN> Yes I am a perl user, but honestly i would just try PHP in your
IN> scenario... http://www.w3schools.com/php/php_forms.asp
IN> If you really want to use perl, which is fair enough, than try reading
IN> here: http://perldoc.perl.org/CGI.html
I think CGI::FormBuilder is a very good way to do this and gets close to
what PHP can do (surpassing it in some ways). Whether you prefer PHP or
Perl is up to you.
Ted
------------------------------
Date: Thu, 27 Dec 2007 16:06:21 -0800
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 5.16 Is there a leak/bug in glob()?
Message-Id: <271220071606217440%brian.d.foy@gmail.com>
In article
<5fe6496b-8de5-4806-a106-8a42603b4d20@d21g2000prf.googlegroups.com>,
Todd <xueweizhong@gmail.com> wrote:
> > 5.16: Is there a leak/bug in glob()?
> >
> >
> > Due to the current implementation on some operating systems, when you
> > use the glob() function or its angle-bracket alias in a scalar context,
> > you may cause a memory leak and/or unpredictable behavior. It's best
> > therefore to use glob() only in list context.
>
> It's still buggy in list context, see below. I filed this bug to p5p
> weeks ago.
>
> This works fine:
>
> #! /bin/perl
> $"=','; print join ',', glob "aaaa{@{[q{01}..q{05}]}}cccc"
> __END__
>
> aaaa01cccc,aaaa02cccc,aaaa03cccc,aaaa04cccc,aaaa05cccc
> After make the range bigger enough, the bug occurs:
>
> #! /bin/perl
> $"=','; print join ',', glob "aaaa{@{[q{001}..q{999}]}}cccc"
> __END__
> aaaa
This has already been explained, I think. It's a MAXPATHLEN limitation
that perl takes from your system.
http://groups.google.com/group/perl.perl5.porters/browse_thread/thread/2
40e1011be62ec5d/7e1b6958749ec3a9?lnk=st&q=glob+todd+perl#7e1b6958749ec3a
9
These ranges work:
perl -le '$"=q|,|; print glob "aaaa{@{[q{000}..q{253}]}}cccc"'
perl -le '$"=q|,|; print glob "aaaa{@{[q{500}..q{753}]}}cccc"'
That is, until I shift the window, which doesn't work:
perl -le '$"=q|,|; print glob "aaaa{@{[q{1500}..q{753}]}}cccc"'
Then I try printing the length of the values I get back from glob. On
my machine, going past the upper bounds just gives back 'aaa'.
perl -le '$"=","; print length join "", glob
"aaaa{@{[q{000}..q{253}]}}cccc"'
2286
$ perl -le '$"=q|,|; print length join "", glob
"aaaa{@{[q{1000}..q{1202}]}}cccc"'
2233
It's not related to strictly related to total length though, because
shortening it doesn't let me extend the range that much (by one!):
perl -le '$"=q|,|; print length join "", glob
"a{@{[q{1000}..q{1203}]}}c"'
1224
perl -le '$"=q|,|; print length join "", glob
"a{@{[q{1000}..q{1204}]}}c"'
1
------------------------------
Date: Thu, 27 Dec 2007 21:35:11 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: FAQ 6.4 I put a regular expression into $/ but it didn't work. What's wrong?
Message-Id: <fdid45-6j6.ln1@osiris.mauzo.dyndns.org>
Quoth PerlFAQ Server <brian@stonehenge.com>:
>
> 6.4: I put a regular expression into $/ but it didn't work. What's wrong?
>
> Up to Perl 5.8.0, $/ has to be a string. This may change in 5.10, but
> don't get your hopes up. Until then, you can use these examples if you
s/8/10/; s/10/12/;
:)
Ben
------------------------------
Date: Thu, 27 Dec 2007 16:07:32 -0800
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 6.4 I put a regular expression into $/ but it didn't work. What's wrong?
Message-Id: <271220071607321732%brian.d.foy@gmail.com>
In article <fdid45-6j6.ln1@osiris.mauzo.dyndns.org>, Ben Morrow
<ben@morrow.me.uk> wrote:
> Quoth PerlFAQ Server <brian@stonehenge.com>:
> >
> > 6.4: I put a regular expression into $/ but it didn't work. What's wrong?
> >
> > Up to Perl 5.8.0, $/ has to be a string. This may change in 5.10, but
> > don't get your hopes up. Until then, you can use these examples if you
>
> s/8/10/; s/10/12/;
I think we've gone through the faq to change all the 5.8s to 5.10s and
so on. I haven't refreshed the copy the PerlFAQ server is using,
though.
I'll look at perlfaq6 to check this one again.
Thanks, :)
------------------------------
Date: Wed, 26 Dec 2007 07:39:37 -0800 (PST)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: FileHandle messes up Oracle connection
Message-Id: <ca304a81-e8a8-4893-8954-bb61c6907eeb@21g2000hsj.googlegroups.com>
On Dec 21, 6:28=A0pm, smallpond <smallp...@juno.com> wrote:
> On Dec 21, 5:45 pm, Uri Guttman <u...@stemsystems.com> wrote:
>
>
>
> > >>>>> "s" =3D=3D smallpond =A0<smallp...@juno.com> writes:
>
> > =A0 s> On Dec 21, 1:40 pm, nolo contendere <simon.c...@fmr.com> wrote:
> > =A0 >> I had a simple script which connected to an Oracle DB, and when I=
> > =A0 >> ported the subs to a larger script, I got the following error:
> > =A0 >> DBI
> > =A0 >> connect('database=3DFFOSD1;sid=3DFFOSD1;host=3Dfosappdaldev2;port=
=3D1521','FFOSPOCDBO',...)
> > =A0 >> failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME env var, NLS
> > =A0 >> settings, permissions, etc. at ./FFOS_CmpDriver.NEW.pl line 661
> > =A0 >> bash-2.03$ echo $ORACLE_HOME
> > =A0 >> /ffosbasedir/common/oracle/iclient10_2
>
> > =A0 >> I copied the head of my larger script, along with the sub to conn=
ect
> > =A0 >> to Oracle and still got the error. So I pruned various pieces of =
code
> > =A0 >> and discovered that commenting out 'use FileHandle;' allowed my
> > =A0 >> connection to succeed.
>
> > could you show the offending code?
#!/usr/bin/perl
use strict; use warnings;
use DBI;
use FileHandle;
my $dbh =3D get_dbh();
my $sql =3D <<"END_SQL";
--select table_name from user_tables
select * from SUPPLIER
END_SQL
my $sth =3D $dbh->prepare( $sql );
$sth->execute;
$sth->dump_results();
##=3D=3D=3D=3D=3D
## subs
##=3D=3D=3D=3D=3D
sub get_dbh {
##------------------------------------------------------------------
## Connect to Database, and return a database handle
##
## INPUTS: 1) Database SID
## 2) Database User
## 3) Database Password
##
## OUTPUTS: 1) Database Handle object
##
my $dsn =3D "DBI:Oracle:database=3DXXXX;sid=3DXXXX;host=3DXXXX;port=3DXX=
XX";
my %attr =3D ( RaiseError =3D> 1, PrintError =3D> 1, LongReadLen =3D>
2000 );
my $dbh =3D DBI->connect($dsn, 'XXXX', 'XXXX', \%attr)
or die "Unable to connect to $ENV{GPS_DBNAME}\n" .
"SQL Err: $DBI::err\nSQL Errstr: $DBI::errstr";
return $dbh;
}
##=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This works when I comment out 'use FileHandle;'.
If I leave it in, I get:
bash-2.03$ ./oracle_test.pl
DBI
connect('database=3DFFOSD1;sid=3DFFOSD1;host=3Dfosappdaldev2;port=3D1521','F=
FOSPOCDBO',...)
failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME env var, NLS
settings, permissions, etc. at ./oracle_test.pl line 75
------------------------------
Date: Wed, 26 Dec 2007 04:16:21 -0800 (PST)
From: "ajauctionpro@gmail.com" <ajauctionpro@gmail.com>
Subject: Free Templates
Message-Id: <ffc19349-861a-482c-afd3-8e75f0c031cf@b40g2000prf.googlegroups.com>
AJ HYIP Templates is ready-to-use. We have become famous for our
unique, fully internet-ready pre-made website templates, Flash
templates, Photoshop designs. All of our products are user-friendly,
easily customized and available in Photoshop (psd), HTML and Flash
(fla) format.
Sources: http://www.ajhyip.com/templates.php
------------------------------
Date: Fri, 28 Dec 2007 11:16:38 -0800 (PST)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: How Do I Locate a value in a text file and evaluate it and then write out that line based on the value?
Message-Id: <23adbbf4-f663-4fa9-a723-15ab8e8b8d2d@i3g2000hsf.googlegroups.com>
On Dec 28, 2:06=A0pm, "John W. Krahn" <some...@example.com> wrote:
> kwalike57 wrote:
>
> > I need to use Perl to read through log output from a df -k command on
> > a Unix server, for each line in the log where the value for %Used is
> > greater than 60% I need to write that line of the log out to another
> > text file. =A0The header %Used is located on the line above the actual
> > value, like this:
>
> > %Used
> > 60%
>
> > How would I capture and evaluate only the %Used value and no other
> > values in that line?
>
> > The 60% occurs first in the value line followed by a percent value for
> > inodes used.
>
> open my $ph, '-|', 'df', '-k' or die "Cannot open pipe from 'df' $!";
>
> <$ph> =3D~ /%used?\b|\bused?%/i and my $pos =3D $-[0];
>
> /\A.{$pos}\s*(\d+)/ && $1 > 60 && print while <$ph>;
>
> close $ph or warn $! ? "Error closing 'df' pipe: $!"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 : "Exit status $? from 'df'";
>
That's pretty nifty (no sarcasm intended). However, have you tried
it?
I don't get what I expect. Perhaps the issues are on my end though...
bash-2.03$ ./df.pl
df: cannot statvfs /foswbdmmk1/install: Permission denied
df: cannot statvfs /foswbdmmk1/admin: Permission denied
df: cannot statvfs /foswbdmmk1/was: Permission denied
df: cannot statvfs /foswbdmmk1/stag: Permission denied
df: cannot statvfs /foswbdmmk1/prev: Permission denied
df: cannot statvfs /foswbdmmk1/log: Permission denied
df: cannot statvfs /foswbdmmk1/ihs: Permission deniedUse of
uninitialized value in concatenation (.) or string at ./df.pl line 10,
<$ph> line 2.
df: cannot statvfs /foswbdmmk1/app: Permission denied
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 3.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 4.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 5.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 6.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 7.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 8.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 9.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 10.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 11.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 12.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 13.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 14.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 15.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 16.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 17.
Use of uninitialized value in concatenation (.) or string at ./df.pl
line 10, <$ph> line 18.
------------------------------
Date: Fri, 28 Dec 2007 18:48:42 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How Do I Locate a value in a text file and evaluate it and then write out that line based on the value?
Message-Id: <6pgan3lp1ulbacnev6gjj3g9hd9mv9nt4n@4ax.com>
On kwalike57 <karinwalike@comcast.net> wrote:
>I need to use Perl to read through log output from a df -k command on
>a Unix server, for each line in the log where the value for %Used is
>greater than 60% I need to write that line of the log out to another
>text file. The header %Used is located on the line above the actual
>value, like this:
>
>%Used
>60%
Where's the problem? Loop through the file using a standard while(){}.
When you find a line with a content that is eq()ual to '%Used' then read the
next line and check if the value is > 60.
>How would I capture and evaluate only the %Used value and no other
>values in that line?
That depends on what that line actually contains.
Standard answer: if you know the separator between values, then use split(),
if you know the value then use m/(...)/.
It is impossible to give more detailed suggestions without seeing the actual
data.
>The 60% occurs first in the value line followed by a percent value for
>inodes used.
That is nice, but a vague verbal description of the data can only result in
a vague verbal description of the algorithm.
jue
------------------------------
Date: Fri, 28 Dec 2007 10:11:33 -0800 (PST)
From: kwalike57 <karinwalike@comcast.net>
Subject: How Do I Locate a value in a text file and evaluate it and then write out that line based on the value?
Message-Id: <61dafd5e-aeb9-4eb8-bfde-714e77f69d21@l6g2000prm.googlegroups.com>
Hello.
I need to use Perl to read through log output from a df -k command on
a Unix server, for each line in the log where the value for %Used is
greater than 60% I need to write that line of the log out to another
text file. The header %Used is located on the line above the actual
value, like this:
%Used
60%
How would I capture and evaluate only the %Used value and no other
values in that line?
The 60% occurs first in the value line followed by a percent value for
inodes used.
Thanks for your help.
Karin Walike
------------------------------
Date: Fri, 28 Dec 2007 19:06:56 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: How Do I Locate a value in a text file and evaluate it and then write out that line based on the value?
Message-Id: <kPbdj.23046$wy2.17015@edtnps90>
kwalike57 wrote:
>
> I need to use Perl to read through log output from a df -k command on
> a Unix server, for each line in the log where the value for %Used is
> greater than 60% I need to write that line of the log out to another
> text file. The header %Used is located on the line above the actual
> value, like this:
>
> %Used
> 60%
>
> How would I capture and evaluate only the %Used value and no other
> values in that line?
>
> The 60% occurs first in the value line followed by a percent value for
> inodes used.
open my $ph, '-|', 'df', '-k' or die "Cannot open pipe from 'df' $!";
<$ph> =~ /%used?\b|\bused?%/i and my $pos = $-[0];
/\A.{$pos}\s*(\d+)/ && $1 > 60 && print while <$ph>;
close $ph or warn $! ? "Error closing 'df' pipe: $!"
: "Exit status $? from 'df'";
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: Fri, 28 Dec 2007 07:41:02 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: How to call stored procedure using DBIx?
Message-Id: <a6aff5e2-e764-4c62-b51e-c5f05629679f@a35g2000prf.googlegroups.com>
On Dec 28, 9:58 am, Tony Winslow <tonywinslow1...@gmail.com> wrote:
> Peter Scott wrote:
> > On Fri, 28 Dec 2007 21:19:06 +0800, Tony Winslow wrote:
> >> I've stored procedures defined in my database schema, and I need to call
> >> them in my code.
> >> The arbitrary-sql approach won't help since it writes sql statements in
> >> source code to act as stored procedures. So could I do that in DBIx?
>
> > DBIx::What? In DBI, with a DBD::Oracle driver, I call stored procedures
> > with a database handle thus:
>
> > $dbh->do( "Begin somepackage.someprocedure; End;" );
>
> > It's picky about the semicolons.
>
> The env: Catalyst, DBIx::Class, MySQL
> If I can get a $dbh from what I already have from DBIx::Class, the
> problem can be solved. Yet I can figure out a way to get it.
DBI is the generic database interface. To connect to MySQL you
need the DBD::mysql module.
http://search.cpan.org/~capttofu/DBD-mysql-4.006/lib/DBD/mysql.pm
--S
------------------------------
Date: Fri, 28 Dec 2007 23:51:56 +0800
From: Tony Winslow <tonywinslow1986@gmail.com>
Subject: Re: How to call stored procedure using DBIx?
Message-Id: <fl3an0$fhd$1@news.cn99.com>
smallpond wrote:
> On Dec 28, 9:58 am, Tony Winslow <tonywinslow1...@gmail.com> wrote:
>> Peter Scott wrote:
>>> On Fri, 28 Dec 2007 21:19:06 +0800, Tony Winslow wrote:
>>>> I've stored procedures defined in my database schema, and I need to call
>>>> them in my code.
>>>> The arbitrary-sql approach won't help since it writes sql statements in
>>>> source code to act as stored procedures. So could I do that in DBIx?
>>> DBIx::What? In DBI, with a DBD::Oracle driver, I call stored procedures
>>> with a database handle thus:
>>> $dbh->do( "Begin somepackage.someprocedure; End;" );
>>> It's picky about the semicolons.
>> The env: Catalyst, DBIx::Class, MySQL
>> If I can get a $dbh from what I already have from DBIx::Class, the
>> problem can be solved. Yet I can figure out a way to get it.
>
> DBI is the generic database interface. To connect to MySQL you
> need the DBD::mysql module.
> http://search.cpan.org/~capttofu/DBD-mysql-4.006/lib/DBD/mysql.pm
>
> --S
Of course, I've installed it.
I can connect to MySQL using DBIx::Class, and it runs smoothly.
Yet I don't know how to call my stored procedures directly using
the the API provided by DBIx::Class rather than that of DBI.
------------------------------
Date: Fri, 28 Dec 2007 08:10:49 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: How to call stored procedure using DBIx?
Message-Id: <be96a35e-2f9f-4835-b4bc-14f8a4551b38@d4g2000prg.googlegroups.com>
On Dec 28, 10:51 am, Tony Winslow <tonywinslow1...@gmail.com> wrote:
> smallpond wrote:
> > On Dec 28, 9:58 am, Tony Winslow <tonywinslow1...@gmail.com> wrote:
> >> Peter Scott wrote:
> >>> On Fri, 28 Dec 2007 21:19:06 +0800, Tony Winslow wrote:
> >>>> I've stored procedures defined in my database schema, and I need to call
> >>>> them in my code.
> >>>> The arbitrary-sql approach won't help since it writes sql statements in
> >>>> source code to act as stored procedures. So could I do that in DBIx?
> >>> DBIx::What? In DBI, with a DBD::Oracle driver, I call stored procedures
> >>> with a database handle thus:
> >>> $dbh->do( "Begin somepackage.someprocedure; End;" );
> >>> It's picky about the semicolons.
> >> The env: Catalyst, DBIx::Class, MySQL
> >> If I can get a $dbh from what I already have from DBIx::Class, the
> >> problem can be solved. Yet I can figure out a way to get it.
>
> > DBI is the generic database interface. To connect to MySQL you
> > need the DBD::mysql module.
> >http://search.cpan.org/~capttofu/DBD-mysql-4.006/lib/DBD/mysql.pm
>
> > --S
>
> Of course, I've installed it.
> I can connect to MySQL using DBIx::Class, and it runs smoothly.
> Yet I don't know how to call my stored procedures directly using
> the the API provided by DBIx::Class rather than that of DBI.
Sorry. My mistake. You might try emailing the author directly.
There is some kind of hook for adding your own data accessors;
maybe that can be used.
--S
------------------------------
Date: Fri, 28 Dec 2007 08:16:12 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: How to call stored procedure using DBIx?
Message-Id: <a162332d-9e19-4991-81f6-28375ea62b9b@q77g2000hsh.googlegroups.com>
On Dec 28, 10:51 am, Tony Winslow <tonywinslow1...@gmail.com> wrote:
> smallpond wrote:
> > On Dec 28, 9:58 am, Tony Winslow <tonywinslow1...@gmail.com> wrote:
> >> Peter Scott wrote:
> >>> On Fri, 28 Dec 2007 21:19:06 +0800, Tony Winslow wrote:
> >>>> I've stored procedures defined in my database schema, and I need to call
> >>>> them in my code.
> >>>> The arbitrary-sql approach won't help since it writes sql statements in
> >>>> source code to act as stored procedures. So could I do that in DBIx?
> >>> DBIx::What? In DBI, with a DBD::Oracle driver, I call stored procedures
> >>> with a database handle thus:
> >>> $dbh->do( "Begin somepackage.someprocedure; End;" );
> >>> It's picky about the semicolons.
> >> The env: Catalyst, DBIx::Class, MySQL
> >> If I can get a $dbh from what I already have from DBIx::Class, the
> >> problem can be solved. Yet I can figure out a way to get it.
>
> > DBI is the generic database interface. To connect to MySQL you
> > need the DBD::mysql module.
> >http://search.cpan.org/~capttofu/DBD-mysql-4.006/lib/DBD/mysql.pm
>
> > --S
>
> Of course, I've installed it.
> I can connect to MySQL using DBIx::Class, and it runs smoothly.
> Yet I don't know how to call my stored procedures directly using
> the the API provided by DBIx::Class rather than that of DBI.
Oh. I found this:
http://www.perlmonks.org/?node_id=625709
------------------------------
Date: Sat, 29 Dec 2007 12:27:55 +0800
From: Tony Winslow <tonywinslow1986@gmail.com>
Subject: Re: How to call stored procedure using DBIx?
Message-Id: <fl4n0n$6qa$1@news.cn99.com>
smallpond wrote:
> On Dec 28, 10:51 am, Tony Winslow <tonywinslow1...@gmail.com> wrote:
>> smallpond wrote:
>>> On Dec 28, 9:58 am, Tony Winslow <tonywinslow1...@gmail.com> wrote:
>>>> Peter Scott wrote:
>>>>> On Fri, 28 Dec 2007 21:19:06 +0800, Tony Winslow wrote:
>>>>>> I've stored procedures defined in my database schema, and I need to call
>>>>>> them in my code.
>>>>>> The arbitrary-sql approach won't help since it writes sql statements in
>>>>>> source code to act as stored procedures. So could I do that in DBIx?
>>>>> DBIx::What? In DBI, with a DBD::Oracle driver, I call stored procedures
>>>>> with a database handle thus:
>>>>> $dbh->do( "Begin somepackage.someprocedure; End;" );
>>>>> It's picky about the semicolons.
>>>> The env: Catalyst, DBIx::Class, MySQL
>>>> If I can get a $dbh from what I already have from DBIx::Class, the
>>>> problem can be solved. Yet I can figure out a way to get it.
>>> DBI is the generic database interface. To connect to MySQL you
>>> need the DBD::mysql module.
>>> http://search.cpan.org/~capttofu/DBD-mysql-4.006/lib/DBD/mysql.pm
>>> --S
>> Of course, I've installed it.
>> I can connect to MySQL using DBIx::Class, and it runs smoothly.
>> Yet I don't know how to call my stored procedures directly using
>> the the API provided by DBIx::Class rather than that of DBI.
>
> Oh. I found this:
> http://www.perlmonks.org/?node_id=625709
Yes, I've read the Cookbook carefully. Yet the situation mentioned
is different from mine:
1. It is not stored procedure. It is only some plain SQL, or arbitrary
SQL as it says.
2. In my stored procedure, the parameter passed in is an output
parameter, while in the example input ones.
Anyway, thank you for your help!
------------------------------
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 V11 Issue 1150
***************************************