[28937] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 181 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 28 14:10:04 2007

Date: Wed, 28 Feb 2007 11:09:06 -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           Wed, 28 Feb 2007     Volume: 11 Number: 181

Today's topics:
        Apache::DBI with mod_perl under load ebling.miss@gmail.com
    Re: Apache::DBI with mod_perl under load <brian.d.foy@gmail.com>
        Can't call method "Sql"... need help sudhih@gmail.com
    Re: Can't call method "Sql"... need help <manojkumargupta@gmail.com>
    Re: CGI:Session & MS SQLServer <benjamin.m.morley@gmail.com>
    Re: change chr(9) ? <noreply@gunnar.cc>
    Re: change chr(9) ? <ben@morrow.me.uk>
    Re: change chr(9) ? <spamtrap@dot-app.org>
    Re: decode a string to "Perl's internal form" without E <gypark@gmail.com>
        Howto:Perl connection to Oracle <edison@newpaltz.edu>
    Re: Howto:Perl connection to Oracle <brian.d.foy@gmail.com>
    Re: Howto:Perl connection to Oracle <ben@morrow.me.uk>
    Re: Howto:Perl connection to Oracle <greg.ferguson@icrossing.com>
    Re: LWP:Authen:NTLM <ayaz@dev.slash.null>
    Re: LWP:Authen:NTLM <rthompson414@gmail.com>
        Parent process unable to read messages from child proce <himagauri@gmail.com>
        Parent process unable to read messages from child proce <himagauri@gmail.com>
        perl & heredoc to create xml <lhradowy@gmail.com>
        Perl and MySQL <landemaine@gmail.com>
    Re: Perl and MySQL xhoster@gmail.com
    Re: Perl and MySQL <landemaine@gmail.com>
    Re: Perl and MySQL <spamtrap@dot-app.org>
    Re: perl bug with references <jue@monster-berlin.de>
        Rindex used to find end of a string <Paul.Lee.1971@googlemail.com>
    Re: Rindex used to find end of a string <ben@morrow.me.uk>
    Re: Uninstall a module? <tlundrigan@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 28 Feb 2007 04:29:32 -0800
From: ebling.miss@gmail.com
Subject: Apache::DBI with mod_perl under load
Message-Id: <1172665772.898404.146560@j27g2000cwj.googlegroups.com>

Hi all,

I am looking at using Apache::DBI in a high performance web
application.
This web application will be running under mod_perl 2.x and apache 2.x
on Fedora core 5.
The application will likely be supporting around 40 - 100 database
transactions a second to a mysql 5.x database .

A few colleagues have expressed their concerns over the stability of
Apache::DBI whilst using mod_perl, saying that they had frequent
crashes under high load.

Whilst i realise that this is a rather vague post / question - what is
your opinion on this particular module? i presumed it was considered
rather a standard for database access!
Are there any other modules that are worth trying out? Have any of you
experienced any quirks / problems when using Apache::DBI under high
load?

Many thanks for any of your thoughts!

Eb



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

Date: Wed, 28 Feb 2007 10:00:50 -0600
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: Apache::DBI with mod_perl under load
Message-Id: <280220071000504484%brian.d.foy@gmail.com>

In article <1172665772.898404.146560@j27g2000cwj.googlegroups.com>,
<ebling.miss@gmail.com> wrote:


> A few colleagues have expressed their concerns over the stability of
> Apache::DBI whilst using mod_perl, saying that they had frequent
> crashes under high load.

Are they sure they're talking about Apache::DBI and not just guessing
about what caused their problem?

The good thing is that you don't have to make a decision. You can turn
Apache::DBI on or off without changing the codebase. Stress test your
application with and without Apache::DBI and see what happens. :)

-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: 28 Feb 2007 03:13:16 -0800
From: sudhih@gmail.com
Subject: Can't call method "Sql"... need help
Message-Id: <1172661196.018456.176250@h3g2000cwc.googlegroups.com>

hello,

I have a problem CGI script. I am really sorry, this looks quite
big...

I created a package pkg::fetch_history.pm and placed it in c:\Perl
\lib. Then I created a perl file to run from the commad promt. the
program executed well without fail. The code is as follows,

#!C:\Perl\bin\perl.exe
use pkg::fetch_history;

@dates = pkg::fetch_history::get_Dates();
foreach $d (@dates)
{	print "\n",$d;	}

the data base exists locally.

Then I created cgi script to populate the values into combo box, it
says

Can't call method "Sql" on an undefined value at C:/Perl/lib/pkg/
fetch_history.pm line 20.

I am not sure why is this. Below is the fetch_history.pm and
combobox.cgi script.

-----------------------------------------------------------------------------------------------
#!C:\Perl\bin\perl.exe

# this is fetch_history.pm

package pkg::fetch_history;
use strict;
use Win32::ODBC;

my $db = new Win32::ODBC('ServerStatistics');	#ODBC driver object
#if (!$db)
#{
#	print "Database could not be found\n";
#}

sub get_Dates
{
	my $q = "select distinct(build_date) from wdf_history order by
build_date";
	$db->Sql($q);
	my @dates;
	push(@dates, $db->Data()) while($db->FetchRow);

	return @dates;
}
---------------------------------------------------------------------
#!C:\Perl\bin\perl.exe

use CGI::Carp qw(fatalsToBrowser);
use CGI;
use pkg::fetch_history;

$cgi = new CGI;
print $cgi->header;

@dates = pkg::fetch_history::get_Dates();
print "here is the dates value",@dates;
print <<ENDHTML;
<html>
<head><title> Server statistics </title></head>
<body>
<select name="menu">
ENDHTML


		foreach my $d(@datest)
		{
print <<ENDHTML;
			<option value="$d" selected>(please select:)</option>
			<option value="$d">$d</option>
ENDHTML

		}
------------------------------------------------------------------



Am I wrong some where?


Thank you,
Regards,
kath.



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

Date: 28 Feb 2007 03:53:13 -0800
From: "perlguru" <manojkumargupta@gmail.com>
Subject: Re: Can't call method "Sql"... need help
Message-Id: <1172663593.349346.127500@q2g2000cwa.googlegroups.com>

On Feb 28, 4:13 pm, sud...@gmail.com wrote:
> hello,
>
> I have a problem CGI script. I am really sorry, this looks quite
> big...
>
> I created a package pkg::fetch_history.pm and placed it in c:\Perl
> \lib. Then I created a perl file to run from the commad promt. the
> program executed well without fail. The code is as follows,
>
> #!C:\Perl\bin\perl.exe
> use pkg::fetch_history;
>
> @dates = pkg::fetch_history::get_Dates();
> foreach $d (@dates)
> {       print "\n",$d;        }
>
> the data base exists locally.
>
> Then I created cgi script to populate the values into combo box, it
> says
>
> Can't call method "Sql" on an undefined value at C:/Perl/lib/pkg/
> fetch_history.pm line 20.
>
> I am not sure why is this. Below is the fetch_history.pm and
> combobox.cgi script.
>
> -----------------------------------------------------------------------------------------------
> #!C:\Perl\bin\perl.exe
>
> # this is fetch_history.pm
>
> package pkg::fetch_history;
> use strict;
> use Win32::ODBC;
>
> my $db = new Win32::ODBC('ServerStatistics');   #ODBC driver object
> #if (!$db)
> #{
> #       print "Database could not be found\n";
> #}
>
> sub get_Dates
> {
>         my $q = "select distinct(build_date) from wdf_history order by
> build_date";
>         $db->Sql($q);
>         my @dates;
>         push(@dates, $db->Data()) while($db->FetchRow);
>
>         return @dates;}
>
> ---------------------------------------------------------------------
> #!C:\Perl\bin\perl.exe
>
> use CGI::Carp qw(fatalsToBrowser);
> use CGI;
> use pkg::fetch_history;
>
> $cgi = new CGI;
> print $cgi->header;
>
> @dates = pkg::fetch_history::get_Dates();
> print "here is the dates value",@dates;
> print <<ENDHTML;
> <html>
> <head><title> Server statistics </title></head>
> <body>
> <select name="menu">
> ENDHTML
>
>                 foreach my $d(@datest)
>                 {
> print <<ENDHTML;
>                         <option value="$d" selected>(please select:)</option>
>                         <option value="$d">$d</option>
> ENDHTML
>
>                 }
> ------------------------------------------------------------------
>
> Am I wrong some where?
>
> Thank you,
> Regards,
> kath.


If this script runs fine from command prompt, ..... then I think you
should check with permission.
I see that you are not catching error at the time of opening
connection to database.
While executing script from web, it executes with lower permission,
and it may not be allowed to connect to database.

Try catching error at the time of opening connection to database...




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

Date: 28 Feb 2007 08:44:52 -0800
From: "Ben_Morley" <benjamin.m.morley@gmail.com>
Subject: Re: CGI:Session & MS SQLServer
Message-Id: <1172681092.651620.20120@a75g2000cwd.googlegroups.com>

In case anyone else is struggling with this, the problem has to do
with a DBI error related to truncating a SQL Server TEXT field type.
You need to set a couple of statement handle parameters like so:

$sth->{LongTruncOk} = 1;   #
$sth->{LongReadLen} = 500;   # WHERE 500 IS THE LENGTH TO TRUNCATE AT
-- DEFAULT IS 80 CHARACTERS



On Feb 21, 2:04 pm, "Ben_Morley" <benjamin.m.mor...@gmail.com> wrote:
> Hi All,
>
> I've been running an application for some time that usesCGI::Session
> and it's MySQL Driver.  However, I'd like to make the application
> database portable and I'm unable to get it to work correctly with
> SQLServer2005.
>
> I have written a dummy driver called "mssql" based on the default DBI
> driver.  It creates thesessionin the SQLServer2005 database, but I'm
> never able to access that livesession.
>
> Any thoughts?  Anyone have a driver built for SQLServer?  Any success
> at all?  Thanks in advance!




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

Date: Wed, 28 Feb 2007 17:54:52 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: change chr(9) ?
Message-Id: <54lqbqF21ebi0U1@mid.individual.net>

Abigail wrote:
> max wrote:
> !!  I have txt file with chr(9) in text, how to change chr(9) - horizontal tab
> !!  to chr(32)"space"
> 
> I'd use 'tr'. But that isn't Perl.

Why do you say that 'tr' is not Perl?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Wed, 28 Feb 2007 17:40:44 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: change chr(9) ?
Message-Id: <sdrgb4-1aa.ln1@osiris.mauzo.dyndns.org>


Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
> Abigail wrote:
> > max wrote:
> > !!  I have txt file with chr(9) in text, how to change chr(9) - horizontal tab
> > !!  to chr(32)"space"
> > 
> > I'd use 'tr'. But that isn't Perl.
> 
> Why do you say that 'tr' is not Perl?

Because Abigail was referring to the tr(1) Unix utility, which is not
Perl. Perl derives its tr/// operator from the tr(1) utility.

Ben

-- 
        I must not fear. Fear is the mind-killer. I will face my fear and
        I will let it pass through me. When the fear is gone there will be 
        nothing. Only I will remain.
ben@morrow.me.uk                                          Frank Herbert, 'Dune'


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

Date: Wed, 28 Feb 2007 13:06:37 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: change chr(9) ?
Message-Id: <m2tzx6p36a.fsf@local.wv-www.com>

Gunnar Hjalmarsson <noreply@gunnar.cc> writes:

> Abigail wrote:
>> max wrote:
>> !!  I have txt file with chr(9) in text, how to change chr(9) - horizontal
>> !!  tab to chr(32)"space"
>>
>> I'd use 'tr'. But that isn't Perl.
>
> Why do you say that 'tr' is not Perl?

I think Abigail was speaking of the 'tr' command-line tool, not the Perl
operator of the same name.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: 28 Feb 2007 09:08:01 -0800
From: "Raymundo" <gypark@gmail.com>
Subject: Re: decode a string to "Perl's internal form" without Encode module?
Message-Id: <1172682481.030074.153010@s48g2000cws.googlegroups.com>

Hmm... I have seen a web-hosting server in which Perl 5.6 was
installed and there wasn't Encode module. :-D

Anyway, thanks to your advices.

Raymundo at South Korea


On 2=BF=F928=C0=CF, =BF=C0=C8=C47=BD=C334=BA=D0, Ben Morrow <b...@morrow.me=
 .uk> wrote:
> Quoth anno4...@radom.zrz.tu-berlin.de:
>
>
>
>
>
> > Raymundo <gyp...@gmail.com> wrote in comp.lang.perl.misc:
> > > Hello,
>
> > > At first, I'm sorry that I'm not good at English. :-)
>
> > > There is a string which is encoded with UTF-8, EUC-KR(Korean), EUC-JP,
> > > or any other encoding scheme.
>
> > > I want to decode it so that it become a string in "Perl's internal
> > > form" (that is, unicode form.. is it so called "utf8"?).
>
> > > For example,
> > > $octets =3D "=A1=C6=A2=AE=A9=F8=A8=A3";        # 2 Korean characters,=
 sequence of 6 Bytes
> > > according to UTF-8
> > > $string  =3D "\x{AC00}\x{B098}";   # 2 Unicode characters. I want to =
get
> > > this from $octets
>
> > > It can be done easily using Encode module:
> > > use Encode qw(decode);
>
> > > $string =3D decode("UTF-8", $octets);
>
> > > My question is, if I don't have Encode module in my server and I have
>
> > You have the Encode module, it is part of every complete Perl
> > installation.
>
> ...from 5.8 onwards. If you are stuck with 5.6, you should be aware that
> that version of Perl did not handle Unicode at all internally, and you
> really ought to upgrade.
>
> Ben



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

Date: Wed, 28 Feb 2007 09:52:43 -0500
From: Bill <edison@newpaltz.edu>
Subject: Howto:Perl connection to Oracle
Message-Id: <12ub5jesa82cg26@corp.supernews.com>

Anything out there that's well documented and half way easy to learn, 
maybe even with some examples?

thanks in advance-
Bill



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

Date: Wed, 28 Feb 2007 10:02:08 -0600
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: Howto:Perl connection to Oracle
Message-Id: <280220071002089159%brian.d.foy@gmail.com>

In article <12ub5jesa82cg26@corp.supernews.com>, Bill
<edison@newpaltz.edu> wrote:

> Anything out there that's well documented and half way easy to learn, 
> maybe even with some examples?

There's the DBI module, which even has a book about it: "Programming
the Perl DBI"

http://search.cpan.org/dist/DBI/

-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: Wed, 28 Feb 2007 15:56:13 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Howto:Perl connection to Oracle
Message-Id: <t9lgb4-2k9.ln1@osiris.mauzo.dyndns.org>


Quoth Bill <edison@newpaltz.edu>:
> Anything out there that's well documented and half way easy to learn, 
> maybe even with some examples?

You want to use DBI and DBD::Oracle. Go to http://search.cpan.org and
search for them.

Ben

-- 
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based 
on the strictest morality.  [Samuel Butler, paraphrased]       ben@morrow.me.uk


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

Date: 28 Feb 2007 08:17:35 -0800
From: "gf" <greg.ferguson@icrossing.com>
Subject: Re: Howto:Perl connection to Oracle
Message-Id: <1172679455.665048.50810@k78g2000cwa.googlegroups.com>

On Feb 28, 7:52 am, Bill <edi...@newpaltz.edu> wrote:
> Anything out there that's well documented and half way easy to learn,
> maybe even with some examples?
>
> thanks in advance-
> Bill

 the DBI is not that hard to use. Getting the connection going is the
first step and requires that you have the appropriate Oracle drivers
on the machine hosting the code, then getting the right settings to
plug into the DSN. You'll need the database name, the host name, the
port you're connecting to, the user ID and password, and to decide
whether you're going to let the DBI handle your error handling,
reporting and whether it should commit automatically.

Then, based on your application's needs, you'll want to get familiar
with do(), prepare(), execute() and selectrow_array() routines.

The DBI docs are pretty good and are mirrored in the "Programming the
Perl DBI" book from O'Reilly. I prefer the online docs at
http://search.cpan.org/~timb/DBI/DBI.pm though I regularly make a mess
of my monitor's screen highlighting sections and writing notes. :-)



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

Date: Wed, 28 Feb 2007 19:27:14 +0500
From: Ayaz Ahmed Khan <ayaz@dev.slash.null>
Subject: Re: LWP:Authen:NTLM
Message-Id: <pan.2007.02.28.14.27.12.70181@dev.slash.null>

"Ron T." typed:

> I've been looking up on how to use this module, following all the
> documentation and cookbooks related to it, and I'm not really sure why
> I can't get through.  The credentials() function is vaguely described
> and I can't really find much info on this.

Have you tried it? Getting LWP::Authen::Ntlm to work is tricky. I use the
following in production code to authenticate with IIS with NTLM
authentication enabled:

    my $ip = '192.168.1.1';
    my $port = '443';
    # This generally works. If you have domain set up to something else,
    # use that, of course.
    my $domain = "workgroup";
    my $user = 'user';
    my $pass = 'pass';
    my $useragent = new LWP::UserAgent(keep_alive => 1);
    $useragent->credentials("$ip:$port", '', "$domain\\$user", "$pass");

It will help massively if you enable debugging with:

	use LWP::Debug qw(+);

-- 
Ayaz Ahmed Khan

A witty saying proves nothing, but saying something pointless gets
people's attention.



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

Date: 28 Feb 2007 08:14:25 -0800
From: "Ron T." <rthompson414@gmail.com>
Subject: Re: LWP:Authen:NTLM
Message-Id: <1172679265.084298.136770@8g2000cwh.googlegroups.com>

On Feb 28, 9:27 am, Ayaz Ahmed Khan <a...@dev.slash.null> wrote:
> "Ron T." typed:
>
> > I've been looking up on how to use this module, following all the
> > documentation and cookbooks related to it, and I'm not really sure why
> > I can't get through.  The credentials() function is vaguely described
> > and I can't really find much info on this.
>
> Have you tried it? Getting LWP::Authen::Ntlm to work is tricky. I use the
> following in production code to authenticate with IIS with NTLM
> authentication enabled:
>
>     my $ip = '192.168.1.1';
>     my $port = '443';
>     # This generally works. If you have domain set up to something else,
>     # use that, of course.
>     my $domain = "workgroup";
>     my $user = 'user';
>     my $pass = 'pass';
>     my $useragent = new LWP::UserAgent(keep_alive => 1);
>     $useragent->credentials("$ip:$port", '', "$domain\\$user", "$pass");
>
> It will help massively if you enable debugging with:
>
>         use LWP::Debug qw(+);
>
> --
> Ayaz Ahmed Khan
>
> A witty saying proves nothing, but saying something pointless gets
> people's attention.

Well I gave it a shot, but it's seemingly hopeless.  I'm getting the
feeling this kind of method will never work with SharePoint.

If there's a way I'm not sure, it only returns "Unauthorized" for a
response to my requests.



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

Date: 28 Feb 2007 09:38:42 -0800
From: "Gauri" <himagauri@gmail.com>
Subject: Parent process unable to read messages from child process
Message-Id: <1172684322.166672.151530@t69g2000cwt.googlegroups.com>

Hello,

I've a process which is supposed to do the following:
1.A Parent process has to fork to create fixed number of child
processes. (This fixed number changes each time my code runs.)
2. Each child computes certain values and writes these values on to a
pipe.
3. The parent should read each of these values from pipe output of all
children and store them in a global variable to be used later in the
process.

Fork work correct, Child processes compute the correct value, however
Parent is unable to read output of all children. For e.g. when 3
children are created, one child completes execution first, and parent
is able to read it's value. The other two processes complete 20
seconds later and exit immediately one after the other. The parent is
unable to read the values of the 2nd and 3rd child.

I want the parent to be able to read the values of all the children
immediately after they exit.
Can some one help me fix the problem?

Here is my script:

use IO::Select;
use IO::File;

my $selectpipe = new IO::Select;

for ($splitnum = 1; $splitnum <= $numparts; $splitnum++) { #$numparts
changes each time.
      pipe($uncompread, $uncompwrite) or die "Cannot pipe: $!";
      my $pid = fork();
      die "fork: $!" unless defined $pid;
      if ($pid){#parent
          push (@childs, $pid);
          close $uncompwrite;
          $selectpipe->add($uncompread);
      } else { #child
          close $uncompread;
          $uncompwrite->autoflush(1);

         # compute the following arrays:
         # $uncompfile[$splitnum],
         # $uncompsize[$splitnum],
         # $uncompcksum[$splitnum]
         # and store the above values in the array: $uncomp[$splitnum
- 1] as follows:

          $uncomp[$splitnum - 1] = "$uncompfile[$splitnum]
$uncompsize[$splitnum] $uncompcksum[$splitnum]";
          print $uncompwrite $uncomp[$splitnum - 1];

           exit;
       }
}

# In the following part I'm trying to store the @uncomp() array above
in the @filedetail() array.
# The number of elements in @filedetail() array should be equal to
$numparts above.
# This is the part which causes error. I'm unable to read all elements
in the @uncomp() array
# above. After the first element in the @uncomp() array is read, the
process exits. Can
# somebody please help?

$count = 0;
while(1){
   foreach my $client ($selectpipe->can_read) {
        $filedetail[$count] = <$uncompclient>;
        $count++;
   }
}
close $uncompread;
close $uncompwrite;

foreach(@childs){
    waitpid($_,0);
}

I'm using Perl version 5.8.5 on OS-Red Hat Linux.

-Thanks,
Regards,
Gauri



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

Date: 28 Feb 2007 09:38:35 -0800
From: "Gauri" <himagauri@gmail.com>
Subject: Parent process unable to read messages from child process
Message-Id: <1172684315.912033.9410@z35g2000cwz.googlegroups.com>

Hello,

I've a process which is supposed to do the following:
1.A Parent process has to fork to create fixed number of child
processes. (This fixed number changes each time my code runs.)
2. Each child computes certain values and writes these values on to a
pipe.
3. The parent should read each of these values from pipe output of all
children and store them in a global variable to be used later in the
process.

Fork work correct, Child processes compute the correct value, however
Parent is unable to read output of all children. For e.g. when 3
children are created, one child completes execution first, and parent
is able to read it's value. The other two processes complete 20
seconds later and exit immediately one after the other. The parent is
unable to read the values of the 2nd and 3rd child.

I want the parent to be able to read the values of all the children
immediately after they exit.
Can some one help me fix the problem?

Here is my script:

use IO::Select;
use IO::File;

my $selectpipe = new IO::Select;

for ($splitnum = 1; $splitnum <= $numparts; $splitnum++) { #$numparts
changes each time.
      pipe($uncompread, $uncompwrite) or die "Cannot pipe: $!";
      my $pid = fork();
      die "fork: $!" unless defined $pid;
      if ($pid){#parent
          push (@childs, $pid);
          close $uncompwrite;
          $selectpipe->add($uncompread);
      } else { #child
          close $uncompread;
          $uncompwrite->autoflush(1);

         # compute the following arrays:
         # $uncompfile[$splitnum],
         # $uncompsize[$splitnum],
         # $uncompcksum[$splitnum]
         # and store the above values in the array: $uncomp[$splitnum
- 1] as follows:

          $uncomp[$splitnum - 1] = "$uncompfile[$splitnum]
$uncompsize[$splitnum] $uncompcksum[$splitnum]";
          print $uncompwrite $uncomp[$splitnum - 1];

           exit;
       }
}

# In the following part I'm trying to store the @uncomp() array above
in the @filedetail() array.
# The number of elements in @filedetail() array should be equal to
$numparts above.
# This is the part which causes error. I'm unable to read all elements
in the @uncomp() array
# above. After the first element in the @uncomp() array is read, the
process exits. Can
# somebody please help?

$count = 0;
while(1){
   foreach my $client ($selectpipe->can_read) {
        $filedetail[$count] = <$uncompclient>;
        $count++;
   }
}
close $uncompread;
close $uncompwrite;

foreach(@childs){
    waitpid($_,0);
}

I'm using Perl version 5.8.5 on OS-Red Hat Linux.

-Thanks,
Regards,
Gauri



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

Date: 28 Feb 2007 07:42:14 -0800
From: "LHradowy" <lhradowy@gmail.com>
Subject: perl & heredoc to create xml
Message-Id: <1172677334.810626.213200@h3g2000cwc.googlegroups.com>

I have a perl script that runs a sql query to a temp file, what I need
to do is take that temp file and pull data to make an xml file.
So there are 1000 lines in this file, so I would need 1000 xml files.
I can get the sql to work...
But, I need to input the account information into an XML, where the
ticket number is.

my $fin_tck = "/home/fin_tck";
chdir ("$fin_tck");

my $tempFile = "$fin_tck/fin.tmp.$$";

my $command = <<EOF;
sqlplus -s $oraUser/$oraPass\@$ENV{'ORACLE_SID'} <<EOR>$tempFile
set heading off
set termout off
set linesize 807
set space 0
set wrap off
set feedback off
set pagesize 7010
SELECT tn||','||ticket_number||','||rcd
FROM vt_table
quit
EOF
system($command);

chomp( my $date = `date '+%Y%B%d%H'` );
open( TEMP, "$tempFile" );

while (<TEMP>) {
chomp;
s/\s+/,/g; # remove trailing whitespace
my($tn,$account,$related) = split(",", $_);
print OUT <<EOF;

<?xml version="1.0" encoding="ISO-8859-1"?><External2AC
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespac
eSchemaLocation="ext2ac.xsd">
<TroubleTicket action="finalize" type="ticket">
<KeyInfo>
<TicketNumber>$account</TicketNumber>
</External2AC>
EOF
}

close OUT, AC_OUT;
close TEMP;
unlink($tempFile);



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

Date: 28 Feb 2007 09:44:08 -0800
From: "Charles A. Landemaine" <landemaine@gmail.com>
Subject: Perl and MySQL
Message-Id: <1172684648.037069.115240@q2g2000cwa.googlegroups.com>

I have a MySQL table that is used to store comments on my blog. I just
found out it's filled with spam. The table itself is 2 GB big, with
more than half a million spam backlinks. I haven't found much material
on how to interact between Perl and MySQL. What I'd like to do is do a
simple Perl script that opens the DB table, goes through all rows and
deletes all those which contain "<a href". I'll have to do that during
the night, not to disrupt the server. How could I do that?
Thanks,



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

Date: 28 Feb 2007 17:48:42 GMT
From: xhoster@gmail.com
Subject: Re: Perl and MySQL
Message-Id: <20070228125354.142$lS@newsreader.com>

"Charles A. Landemaine" <landemaine@gmail.com> wrote:
> I have a MySQL table that is used to store comments on my blog. I just
> found out it's filled with spam. The table itself is 2 GB big, with
> more than half a million spam backlinks. I haven't found much material
> on how to interact between Perl and MySQL. What I'd like to do is do a
> simple Perl script that opens the DB table, goes through all rows and
> deletes all those which contain "<a href". I'll have to do that during
> the night, not to disrupt the server. How could I do that?
> Thanks,

I don't know why you would do this in Perl rather from the mysql client,
but anyway I'd use DBI and DBD::mysql

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 28 Feb 2007 09:57:55 -0800
From: "Charles A. Landemaine" <landemaine@gmail.com>
Subject: Re: Perl and MySQL
Message-Id: <1172685475.340165.290460@s48g2000cws.googlegroups.com>

Thanks, yeah, maybe it's actually a little faster using the mysql
command.



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

Date: Wed, 28 Feb 2007 13:19:28 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Perl and MySQL
Message-Id: <m2k5y2p2kv.fsf@local.wv-www.com>

"Charles A. Landemaine" <landemaine@gmail.com> writes:

> I haven't found much material
> on how to interact between Perl and MySQL.

Then you haven't looked very hard. There are many books on the subject,
not to mention countless web pages.

> What I'd like to do is do a
> simple Perl script that opens the DB table, goes through all rows and
> deletes all those which contain "<a href". I'll have to do that during
> the night, not to disrupt the server. How could I do that?

What makes you think you need a Perl script to submit a single SQL query?

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: 28 Feb 2007 03:19:46 -0800
From: "Thomas J." <jue@monster-berlin.de>
Subject: Re: perl bug with references
Message-Id: <1172661586.141774.93380@a75g2000cwd.googlegroups.com>

On 28 Feb., 03:13, "dt" <p...@cheapbooks.com> wrote:
> I found an odd behavior.
>
> when I have a reference, let's say it is an array, it seems to pad the
> value differently in perl 5.6 vs 5.8:
>
> this worked in perl 5.8 but not perl 5.6:
>
> $ref =~ /^ARRAY/;
>
> for 5.6, I had to change to =~ /^\s*ARRAY/;
>

I have same results with perl 5.6.

perldoc -f ref

hope that helps,

Thomas



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

Date: 28 Feb 2007 09:34:24 -0800
From: "Paul.Lee.1971" <Paul.Lee.1971@googlemail.com>
Subject: Rindex used to find end of a string
Message-Id: <1172684064.677005.58400@8g2000cwh.googlegroups.com>

Hi all,
I have a sequence of strings, for instance
"Hello, World                     "
"My First Perl Test    "
"Exit(0)                                  "

- as you can see, the strings are all different lengths. Is there a
way to use rindex to find out the last non-whitespace character in the
string? I'd like to be able to use a general function to return
"Hello, World", "My First Perl Test" and "Exit(0).

Thanks in advance

Paul



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

Date: Wed, 28 Feb 2007 17:44:48 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Rindex used to find end of a string
Message-Id: <glrgb4-1aa.ln1@osiris.mauzo.dyndns.org>


Quoth "Paul.Lee.1971" <Paul.Lee.1971@googlemail.com>:
> Hi all,
> I have a sequence of strings, for instance
> "Hello, World                     "
> "My First Perl Test    "
> "Exit(0)                                  "
> 
> - as you can see, the strings are all different lengths. Is there a
> way to use rindex to find out the last non-whitespace character in the
> string?

Not easily. For a task like this you want a regex. The index of the last
non-whitespace character in a string $str can be found with

    $str =~ /(\s*)$/ && length($str) - length($1) - 1;

 ...

> I'd like to be able to use a general function to return
> "Hello, World", "My First Perl Test" and "Exit(0).

 ...but if you just want to remove it you'd be better off doing that in
one step:

    $str =~ s/\s*$//;

You need to read up on basic Perl operations: I would recommend you get
a good book.

Ben

-- 
Raise your hand if you're invulnerable.
                                                         [ben@morrow.me.uk]


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

Date: 28 Feb 2007 06:40:17 -0800
From: "Tracey" <tlundrigan@gmail.com>
Subject: Re: Uninstall a module?
Message-Id: <1172673612.865236.191540@p10g2000cwp.googlegroups.com>

Hi guys,

Thanks for all your replies.  I can't say exactly how this was fixed,
but my resident Linux guru fixed it very quickly and easily.  It was
something along the lines of pointing Linux back to the original Perl
installation.  Wish I could be more descriptive, but I did want to let
you know the problem is solved.

Tracey



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

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


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