[30120] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1363 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 14 14:09:49 2008

Date: Fri, 14 Mar 2008 11:09:08 -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           Fri, 14 Mar 2008     Volume: 11 Number: 1363

Today's topics:
    Re: assigning array to a scalar variable <tadmc@seesig.invalid>
    Re: assigning array to a scalar variable <ben@morrow.me.uk>
    Re: assigning array to a scalar variable <jurgenex@hotmail.com>
    Re: command output <jameslockie@mail.com>
    Re: command output <jameslockie@mail.com>
    Re: command output <jameslockie@mail.com>
    Re: difference between $ and @ <tadmc@seesig.invalid>
    Re: difference between $ and @ <jurgenex@hotmail.com>
    Re: Faster file iteration <bugbear@trim_papermule.co.uk_trim>
    Re: My editfile.pl script <tadmc@seesig.invalid>
        Perl's installed module isn't recognized <ljames@apollo3.com>
    Re: Perl's installed module isn't recognized <smallpond@juno.com>
    Re: Perl's installed module isn't recognized <ben@morrow.me.uk>
    Re: Perl's installed module isn't recognized <ljames@apollo3.com>
        POE and SOAP <name@yahoo.com>
        P~(ptilde) 0.9 released, new scripting language with no <ptilderegex@gmail.com>
    Re: P~(ptilde) 0.9 released, new scripting language wit <bik.mido@tiscalinet.it>
    Re: Why is "$A::a" and "$a" diffrent ? <tadmc@seesig.invalid>
        XML::Parser::Style::Subs xhoster@gmail.com
    Re: XML::Parser::Style::Subs <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 14 Mar 2008 11:40:20 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: assigning array to a scalar variable
Message-Id: <slrnftkmdt.b4t.tadmc@tadmc30.sbcglobal.net>

Oliver Abram <oliver.abram@googlemail.com> wrote:
> venkatesh.naughty@gmail.com schrieb:
>> Hi all,
>> How to assign array variable to a scalar retaining the content of the
>> array in the scalar variable not number of elements ;
>> eg:
>> @array={"hi","venkatesh"};
>> $x=@array;
>> I dont want $x to store 2
>> instead to store hi venkatesh
>
>
> Or maybe this one:
>
>
> @array = qw (hi venkatesh whats up);
>
> foreach (@array)
> {
> 	$x .= "$_ ";
> }


That leaves an extra space character at the end of $x.

   $x = join ' ', @array;  # no trailing space


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Fri, 14 Mar 2008 11:38:38 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: assigning array to a scalar variable
Message-Id: <um4qa5-bm1.ln1@osiris.mauzo.dyndns.org>


Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
> venkatesh.naughty@gmail.com wrote:
> > How to assign array variable to a scalar retaining the content of the
> > array in the scalar variable not number of elements ;
> > eg:
> > @array={"hi","venkatesh"};
> > $x=@array;
> > I dont want $x to store 2
> > instead to store hi venkatesh
> 
>      $x = join ' ', %{ $array[0] };
> 
> If you rather mean that you have the array
> 
>      @array = ("hi","venkatesh");
> 
> you can simply do
> 
>      $x = "@array";

 ...but be careful about $". Either of

    {
        local $" = ' ';
        $x = "@array";
    }

or

    $x = join ' ', @array;

would be safer.

Ben



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

Date: Fri, 14 Mar 2008 13:16:21 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: assigning array to a scalar variable
Message-Id: <s2ukt3p3vimemaq8mk3huahc8r6nqmi72q@4ax.com>

venkatesh.naughty@gmail.com wrote:
>Hi all,
>How to assign array variable to a scalar retaining the content of the
>array in the scalar variable not number of elements ;
>eg:
>@array={"hi","venkatesh"};
>$x=@array;
>I dont want $x to store 2

Well, it doesn't. $x contains 1 because the only element in @array is the
reference to the anonymous hash {'hi' => 'venkatesh'}

>instead to store hi venkatesh

Do you mean the text 'hi venkatesh'?
Luckily Perl is smart enough to allow using join() on hashes, too. So you
can just join the key and value of the anonymous hash:
	
	print join (' ', %{$array[0]});

Jue



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

Date: Fri, 14 Mar 2008 06:59:21 -0700 (PDT)
From: jammer <jameslockie@mail.com>
Subject: Re: command output
Message-Id: <c5175cd4-c98e-4462-8aec-1bab0dae36a7@s19g2000prg.googlegroups.com>

On Mar 13, 4:09 pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> jammer <jamesloc...@mail.com> wrote:
> >There is no output from this:
> >                `/usr/bin/ls -l "$backupDir/$backupName"`;
>
> Does that surprise you? It shouldn't.
>
> >This shows correct values:
> >                print "/usr/bin/ls -l $backupDir/$backupName";
>
> Whatever "correct values" is supposed to mean. It will print that given
> string with the two variables $backupDir and $backupName expanded. Did you=

> expect something else?
>
> Of course backticks to do something different then double quotes. Does tha=
t
> surprise you?
>
> What is your question/issue/...?
>
> jue

Printing $backupDir and $backupName show they are not empty.
I wanted to print the output of the ls -l.
I know how to do it now.


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

Date: Fri, 14 Mar 2008 07:56:15 -0700 (PDT)
From: jammer <jameslockie@mail.com>
Subject: Re: command output
Message-Id: <0336bc86-9bd0-4b0c-b7e0-c28fba8703f1@e23g2000prf.googlegroups.com>

On Mar 14, 9:59 am, jammer <jamesloc...@mail.com> wrote:
> On Mar 13, 4:09 pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
>
>
>
> > jammer <jamesloc...@mail.com> wrote:
> > >There is no output from this:
> > >                `/usr/bin/ls -l "$backupDir/$backupName"`;
>
> > Does that surprise you? It shouldn't.
>
> > >This shows correct values:
> > >                print "/usr/bin/ls -l $backupDir/$backupName";
>
> > Whatever "correct values" is supposed to mean. It will print that given
> > string with the two variables $backupDir and $backupName expanded. Did y=
ou
> > expect something else?
>
> > Of course backticks to do something different then double quotes. Does t=
hat
> > surprise you?
>
> > What is your question/issue/...?
>
> > jue
>
> Printing $backupDir and $backupName show they are not empty.
> I wanted to print the output of the ls -l.
> I know how to do it now.

I did print `/usr/bin/ls -l "$backupDir/$backupName"`;
It is truncating and printing the last character:
-rw-r--r--   1 owner      group    3858 Mar 14 10:47 /tmp/configs/
file.cog
It should print:
-rw-r--r--   1 owner      group    3858 Mar 14 10:47 /tmp/configs/
file.config


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

Date: Fri, 14 Mar 2008 08:05:22 -0700 (PDT)
From: jammer <jameslockie@mail.com>
Subject: Re: command output
Message-Id: <194cc2ca-dedc-449f-a226-3f92bb2de239@e6g2000prf.googlegroups.com>

On Mar 14, 10:56 am, jammer <jamesloc...@mail.com> wrote:
> On Mar 14, 9:59 am, jammer <jamesloc...@mail.com> wrote:
>
>
>
> > On Mar 13, 4:09 pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
>
> > > jammer <jamesloc...@mail.com> wrote:
> > > >There is no output from this:
> > > >                `/usr/bin/ls -l "$backupDir/$backupName"`;
>
> > > Does that surprise you? It shouldn't.
>
> > > >This shows correct values:
> > > >                print "/usr/bin/ls -l $backupDir/$backupName";
>
> > > Whatever "correct values" is supposed to mean. It will print that give=
n
> > > string with the two variables $backupDir and $backupName expanded. Did=
 you
> > > expect something else?
>
> > > Of course backticks to do something different then double quotes. Does=
 that
> > > surprise you?
>
> > > What is your question/issue/...?
>
> > > jue
>
> > Printing $backupDir and $backupName show they are not empty.
> > I wanted to print the output of the ls -l.
> > I know how to do it now.
>
> I did print `/usr/bin/ls -l "$backupDir/$backupName"`;
> It is truncating and printing the last character:
> -rw-r--r--   1 owner      group    3858 Mar 14 10:47 /tmp/configs/
> file.cog
> It should print:
> -rw-r--r--   1 owner      group    3858 Mar 14 10:47 /tmp/configs/
> file.config

It was my TERM truncating it, not Perl, no problem.


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

Date: Fri, 14 Mar 2008 11:40:21 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: difference between $ and @
Message-Id: <slrnftkmh6.b4t.tadmc@tadmc30.sbcglobal.net>

vimal <cool.vimalsmail@gmail.com> wrote:
> On Mar 14, 12:12 pm, Peter Makholm <pe...@makholm.net> wrote:
>> vimal <cool.vimalsm...@gmail.com> writes:
>> > i am new to perl. i just want to know the difference between @ and $
>> > prefixes for variables.
>>
>> http://search.cpan.org/~rgarcia/perl-5.10.0/pod/perldata.pod
>>
>> //Makholm
>
> Thats a cool one and now i got that.


If you had perl installed, then you already had that, as perl ships
and installs that document, along with a boatload of other docs.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Fri, 14 Mar 2008 13:50:12 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: difference between $ and @
Message-Id: <660lt3lr37lje62dlr63j9knng4i4oorub@4ax.com>

vimal <cool.vimalsmail@gmail.com> wrote:
>hi monks,

What does religious asceticism have to do with Perl? 

>i am new to perl. i just want to know the difference between @ and $
>prefixes for variables.

See the first page or so of perldoc perldata. It is a rather terse but
well-written introduction into that subject matter.

>when should i use $ and @ as prefix.

Use $ whenever you are talking about a single value aka scalar. Use @ when
you are talking about a collection of values which is indexed by consecutive
natural numbers.

>an example may be a little useful :)

perldoc perldata has numerous examples.

jue


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

Date: Fri, 14 Mar 2008 11:33:47 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Faster file iteration
Message-Id: <13tkolmcnfmkm4b@corp.supernews.com>

vijay@iavian.com wrote:
> On Mar 13, 9:23 pm, Jürgen Exner <jurge...@hotmail.com> wrote:
>> Give us a spec and maybe someone will be able to come up with a better
>> algorithm.
> 
> 
> the specs
> 
> We have two files. The first file,say 'one.txt', has data arranged in
> three columns, separated by semicolon. something like this:
> 
> 1234567;7654321;20080225
> 1234765;5464354;19821111
> 342312A;5464354;19990101
> ABC12;9876544;0
> I002222;ACD222;19991130
> .........
> 
> Note that the three columns are not of fixed length. The first two
> columns are of a maximum length 7 and can contain alpha-numerals.
> The third column is the date column (in YYYYMMDD format). It can also
> contain '0' or can be empty too.
> 
> The second file,say 'two.txt', also has three columns separated by
> spaces, something like:
> 
> serialno  fileno    date
> 123	1234567 20080315
> 2	2233442 20081130
> 311	1232231 20031221
> 44	1232123 19990831
> 23	2131312 20000101
> 132	5464354 19811111
> ......
> 
> The enitre file contains only numerals, from second line onwards. The
> first column length ranges from 1-3 numbers. Second column strictly is
> of 7 number length. Third column is the date column strictly in
> YYYYMMDD format.
> 
> Now, the requirement would be to add two additional columns in
> 'two.txt'. The fourth and fifth columns will be tab separated and
> labeled 'label4' and 'label5' respectively.
> 
> The values to be populated under 'label4' should be computed as
> follows:
> 
> Read the 7-digit number present in the second column (under fileno) of
> 'two.txt'. Compare the number with the alpha-numeric value present in
> the second column of the 'one.txt' file. on finding a perfect match,
> trigger a counter. Repeat the previous procedure for subsequent lines
> and increment the counter each time you find a match. The fourth
> column should then be populated with the final value in teh counter
> against the fileno, which is the number of exact matches you've found.
> If you've found no match, then just populate the entry with a
> '0' (zero). But, there is one condition which you need to take care of
> before populating-the date difference in each row should be less than
> or equal to 5yrs. to do this, you need to pick up the corresponding
> date from next to that fileno in 'two.txt'and also pick up the date
> next from the thrid column in 'one.txt', and take a diff. If the
> difference is more than 5 yrs, do not increment the counter. *NOTE:
> the date in file 'one.txt' is always greater(or later) than the
> corresponding date in 'two.txt'. The date ranges from 19900101 to
> 20041231 in file 'two.txt' and from 19750101 to 20011225in file
> 'one.txt'
> 
> In the above example, the new 'two.txt' will look something like
> 
> serialnumber	fileno  date	  label4
> 123		1234567 20080315  0
> 2		2233442 20081130  0
> 311		1232231 20031221  0
> 44		1232123 19990831  0
> 23		2131312 20000101  0
> 132		5464354 19811111  1
> 
> *Label5: We know that the date in 'one.txt' ends on 12/25/2001. For
> every matched file number in 'two.txt', pls do the following:
> 1. if the date in 'two.txt' is less than 12/25/2001, by 5 yrs or more,
> mark as 5 yrs.
> 2. if its between 12/25/2001 and 12/25/1996 mark the exact number in
> terms of number of years,months and days.
> 3. if its more than 12/25/2001 and till 31/12/2004, mark the exact
> number of years,months and days, but put a '-' (minus sign) in front
> of it.

Generate two working data sets, both sorted by "fileno". Sorting
is a standard operation, either in Unix or Perl.

The bulk of your processing is now pretty much a "merge" operation.

The "working data" can be RAM or disc depending on your machine's
ram size.

If you require the ultimate "file two" to be in the same order it was
to being with, the working data for file 2 should have an additional
"original line numnber" field, and the final file 2 (after merging) should
be sorted by this field.

Overall performance is O(NlogN) + O(N) + O(NlogN) which is O(NlogN)
which is rather better than your present O(N^2)

  BugBear


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

Date: Fri, 14 Mar 2008 11:40:20 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: My editfile.pl script
Message-Id: <slrnftkm97.b4t.tadmc@tadmc30.sbcglobal.net>

Ignoramus17007 <ignoramus17007@NOSPAM.17007.invalid> wrote:


>   open( my $IN, $file )         || die "Cannot read from $file";


You should include the reason for the failure in your diag message.

It is also a good idea to put some sort of delimiter around the
filename so you can see whitespaces, if any:

   open( my $IN, $file ) || die "Cannot read from '$file'  $!";
                                                           ^^
                                                           ^^
-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Fri, 14 Mar 2008 07:59:23 -0700 (PDT)
From: "L. D. James" <ljames@apollo3.com>
Subject: Perl's installed module isn't recognized
Message-Id: <3253060a-d4fa-4718-a21b-df54f3c33c93@k13g2000hse.googlegroups.com>

Can someone tell me what's going wrong with my perl operation?  I
recently started over my Linux, Apache, Mysql, and Perl on a new hard
drive when I had a drive failure.  Everything on the system is freshly
installed.  At present everything works except for my scripts that
uses DBD::mysql.  I used cpan to install DBD::mysql.  It appears to be
installed okay, but still fail to work.

Please look at the information itemized below.

Thanks in advance for any suggestions or comments.


Simplest code to reproduce the error:

commandline: perl -MDBD::mysql -e 1
Can't load '/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBD/
mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.14: cannot
open shared object file: No such file or directory at /usr/local/lib/
perl5/5.10.0/i686-linux/DynaLoader.pm line 203.
 at -e line 0
Compilation failed in require.
BEGIN failed--compilation aborted.



Attempt to install/verify module via CPAN:

cpan[1]> install DBD::mysql
CPAN: Storable loaded ok (v2.18)
Going to read /root/.cpan/Metadata
  Database was generated on Fri, 14 Mar 2008 10:31:09 GMT
CPAN: YAML loaded ok (v0.65)
DBD::mysql is up to date (4.006).



Perl's Search Path:

commandline: perl -e "print qq(@INC)" | sed "s/ /\n/g"
/usr/local/lib/perl5/5.10.0/i686-linux
/usr/local/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/i686-linux
/usr/local/lib/perl5/site_perl/5.10.0
/usr/local/lib/perl5/site_perl/5.8.8
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl



Location of installed mysql files from the /usr/local/lib hierarchy:

commandline: find -name mysql\*
 ./site_perl/5.8.8/i686-linux/Bundle/DBD/mysql.pm
 ./site_perl/5.8.8/i686-linux/DBD/mysql
 ./site_perl/5.8.8/i686-linux/DBD/mysql.pm
 ./site_perl/5.8.8/i686-linux/auto/DBD/mysql
 ./site_perl/5.8.8/i686-linux/auto/DBD/mysql/mysql.bs
 ./site_perl/5.8.8/i686-linux/auto/DBD/mysql/mysql.so
 ./site_perl/5.8.8/CGI/Session/Driver/mysql.pm
 ./site_perl/5.10.0/i686-linux/Bundle/DBD/mysql.pm
 ./site_perl/5.10.0/i686-linux/DBD/mysql
 ./site_perl/5.10.0/i686-linux/DBD/mysql.pm
 ./site_perl/5.10.0/i686-linux/auto/DBD/mysql
 ./site_perl/5.10.0/i686-linux/auto/DBD/mysql/mysql.bs
 ./site_perl/5.10.0/i686-linux/auto/DBD/mysql/mysql.so
 ./site_perl/5.6.1/i686-linux/Bundle/DBD/mysql.pm
 ./site_perl/5.6.1/i686-linux/DBD/mysql
 ./site_perl/5.6.1/i686-linux/DBD/mysql.pod
 ./site_perl/5.6.1/i686-linux/DBD/mysql.pm
 ./site_perl/5.6.1/i686-linux/auto/DBD/mysql
 ./site_perl/5.6.1/i686-linux/auto/DBD/mysql/mysql.bs
 ./site_perl/5.6.1/i686-linux/auto/DBD/mysql/mysql.so

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames


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

Date: Fri, 14 Mar 2008 08:22:24 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: Perl's installed module isn't recognized
Message-Id: <c7f8442f-776e-40a3-8cce-8b52bd70f7bf@2g2000hsn.googlegroups.com>

On Mar 14, 10:59 am, "L. D. James" <lja...@apollo3.com> wrote:
> Can someone tell me what's going wrong with my perl operation?  I
> recently started over my Linux, Apache, Mysql, and Perl on a new hard
> drive when I had a drive failure.  Everything on the system is freshly
> installed.  At present everything works except for my scripts that
> uses DBD::mysql.  I used cpan to install DBD::mysql.  It appears to be
> installed okay, but still fail to work.
>
> Please look at the information itemized below.
>
> Thanks in advance for any suggestions or comments.
>
> Simplest code to reproduce the error:
>
> commandline: perl -MDBD::mysql -e 1
> Can't load '/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBD/
> mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.14: cannot
> open shared object file: No such file or directory at /usr/local/lib/
> perl5/5.10.0/i686-linux/DynaLoader.pm line 203.
>  at -e line 0
> Compilation failed in require.
> BEGIN failed--compilation aborted.
>
> Attempt to install/verify module via CPAN:
>
> cpan[1]> install DBD::mysql
> CPAN: Storable loaded ok (v2.18)
> Going to read /root/.cpan/Metadata
>   Database was generated on Fri, 14 Mar 2008 10:31:09 GMT
> CPAN: YAML loaded ok (v0.65)
> DBD::mysql is up to date (4.006).
>
> Perl's Search Path:
>
> commandline: perl -e "print qq(@INC)" | sed "s/ /\n/g"
> /usr/local/lib/perl5/5.10.0/i686-linux
> /usr/local/lib/perl5/5.10.0
> /usr/local/lib/perl5/site_perl/5.10.0/i686-linux
> /usr/local/lib/perl5/site_perl/5.10.0
> /usr/local/lib/perl5/site_perl/5.8.8
> /usr/local/lib/perl5/site_perl/5.6.1
> /usr/local/lib/perl5/site_perl
>
> Location of installed mysql files from the /usr/local/lib hierarchy:
>
> commandline: find -name mysql\*
> ./site_perl/5.8.8/i686-linux/Bundle/DBD/mysql.pm
> ./site_perl/5.8.8/i686-linux/DBD/mysql
> ./site_perl/5.8.8/i686-linux/DBD/mysql.pm
> ./site_perl/5.8.8/i686-linux/auto/DBD/mysql
> ./site_perl/5.8.8/i686-linux/auto/DBD/mysql/mysql.bs
> ./site_perl/5.8.8/i686-linux/auto/DBD/mysql/mysql.so
> ./site_perl/5.8.8/CGI/Session/Driver/mysql.pm
> ./site_perl/5.10.0/i686-linux/Bundle/DBD/mysql.pm
> ./site_perl/5.10.0/i686-linux/DBD/mysql
> ./site_perl/5.10.0/i686-linux/DBD/mysql.pm
> ./site_perl/5.10.0/i686-linux/auto/DBD/mysql
> ./site_perl/5.10.0/i686-linux/auto/DBD/mysql/mysql.bs
> ./site_perl/5.10.0/i686-linux/auto/DBD/mysql/mysql.so
> ./site_perl/5.6.1/i686-linux/Bundle/DBD/mysql.pm
> ./site_perl/5.6.1/i686-linux/DBD/mysql
> ./site_perl/5.6.1/i686-linux/DBD/mysql.pod
> ./site_perl/5.6.1/i686-linux/DBD/mysql.pm
> ./site_perl/5.6.1/i686-linux/auto/DBD/mysql
> ./site_perl/5.6.1/i686-linux/auto/DBD/mysql/mysql.bs
> ./site_perl/5.6.1/i686-linux/auto/DBD/mysql/mysql.so
>
> -- L. James
>
> --
> L. D. James
> lja...@apollo3.comwww.apollo3.com/~ljames


Your perl is OK.  It needs to interface to the mysql library
which is part of mysql.
On my system, this is loaded by the mysql-libs rpm.

rpm -qf /usr/lib/mysql/libmysqlclient.so.15
mysql-libs-5.0.45-6.fc8
--S


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

Date: Fri, 14 Mar 2008 15:36:48 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Perl's installed module isn't recognized
Message-Id: <gliqa5-p3l.ln1@osiris.mauzo.dyndns.org>


Quoth "L. D. James" <ljames@apollo3.com>:
> 
> commandline: perl -MDBD::mysql -e 1
> Can't load '/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBD/
> mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.14: cannot
> open shared object file: No such file or directory at /usr/local/lib/
> perl5/5.10.0/i686-linux/DynaLoader.pm line 203.

Either you don't have the MySQL client libraries installed, or your
dynamic loader doesn't know how to find them. If they aren't installed,
install them; if they are, check your /etc/ld.so.conf and make sure
you've run ldconfig.

It's a little weird that CPAN let you install DBD::mysql, since
presumably its tests didn't pass: did CPAN run the tests and somehow
they passed, or did you have to force the install? Or did you install
using your system's package manager, and it failed to install the
required libraries first? Or did you install manually, and not run the
tests?

Ben



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

Date: Fri, 14 Mar 2008 09:13:54 -0700 (PDT)
From: "L. D. James" <ljames@apollo3.com>
Subject: Re: Perl's installed module isn't recognized
Message-Id: <cd65b63c-40a5-4185-b18d-a8d50586be40@n75g2000hsh.googlegroups.com>

On Mar 14, 11:22 am, smallpond <smallp...@juno.com> wrote:
> Your perl is OK.  It needs to interface to the mysql library
> which is part of mysql.
> On my system, this is loaded by the mysql-libs rpm.
>
> rpm -qf /usr/lib/mysql/libmysqlclient.so.15
> mysql-libs-5.0.45-6.fc8
> --S

Thanks guys.  I had pounder this problem for hours since yesterday.  I
couldn't figure it out.  You pointed me to the right direction.  I
reinstalled an older version of mysql 4.1.22, then my scripts started
working.  I installed the later version on top of the older version,
mysql 5.1.23 and it continues to work.

I see what causes the problem was, in the process of fixing a
different problem, I thought it we because of some compatibilities of
the newest mysql, so I downgraded.  When that didn't fix the problem
of the other program, I removed the downgrade and upgraded again.  I
guess somewhere down the line of having the older version installed,
the module had configured itself for that library.

Thank you kindly for your fast responses.

I'll experiment later with how to reconfigure the modules to use the
later version install.

When doing my file search I should have searched for libmysqlclient.so
\* rather than searching for mysql\*.  This would have showed me
libmysqlclient.so.16, which may have given me the clue to reinstall
the older version.  After the reinstall of the older version I have
both libmysqlclient.so.14 (which it looks for) and libmysqlclient.so.
16.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames


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

Date: Fri, 14 Mar 2008 13:56:03 +0100
From: Mpapec <name@yahoo.com>
Subject: POE and SOAP
Message-Id: <frdsn6$o0j$1@ss408.t-com.hr>


I want to build small soap server which should provide persistent DBI
statement handles. POE::Component::Server::SOAP handles one client at 
the time, so there is a lot of waiting for other clients.

I've tried to change perldoc example so the server wouldn't block, but 
now server doesn't respond at all. :)
http://search.cpan.org/~apocal/POE-Component-Server-SOAP-1.11/lib/POE/Component/Server/SOAP.pm



server
++++++
use strict;
use warnings;

use Data::Dumper;
use POE;
use POE::Component::Server::SOAP;

POE::Component::Server::SOAP->new(
         'ALIAS'         =>      'MySOAP',
         'ADDRESS'       =>      'localhost',
         'PORT'          =>      32080,
         'HOSTNAME'      =>      'MyHost.com',
);

POE::Session->create(
     inline_states =>      {
             _start        =>      \&setup_service,
             _stop         =>      \&shutdown_service,
             Sum_Things    =>      \&do_sum,

             task_result => \&handle_task_result,
             task_done   => \&handle_task_done,
             task_debug  => \&handle_task_debug,
     },
);

$poe_kernel->run;
exit 0;

sub setup_service {
         my $kernel = $_[KERNEL];
         $kernel->alias_set( 'MyServer' );
         $kernel->post( 'MySOAP', 'ADDMETHOD', 'MyServer', 'Sum_Things' );
}
sub shutdown_service {
         $_[KERNEL]->post( 'MySOAP', 'DELMETHOD', 'MyServer', 
'Sum_Things' );
}


sub do_sum {

     my $response = $_[ARG0];
     my $params = $response->soapbody;

     use POE qw(Wheel::Run Filter::Reference);
     my $task = POE::Wheel::Run->new(
         Program      => sub { do_stuff($response, $params) },
         StdoutFilter => POE::Filter::Reference->new(),
         StdoutEvent  => "task_result",
         StderrEvent  => "task_debug",
         CloseEvent   => "task_done",
     );
}



sub do_stuff {
     binmode(STDOUT);    # Required for this to work on MSWin32
     my ($response, $params) = @_;

     my $filter = POE::Filter::Reference->new();
     # console output
     my $output = $filter->put( [ $response ] );
     print @$output;

     # soap client output
     $response->content(
       [
         { res => $_[HEAP]{i}++ },
       ]
     );
     $_[KERNEL]->post( 'MySOAP', 'DONE', $response );

}

sub handle_task_result {
     my $result = $_[ARG0];
     print Dumper $result;
}

# Catch and display information from the child's STDERR.  This was
# useful for debugging since the child's warnings and errors were not
# being displayed otherwise.
sub handle_task_debug {
     my $result = $_[ARG0];
     print "Debug: $result\n";
}

# The task is done.  Delete the child wheel, and try to start a new
# task to take its place.
sub handle_task_done {
#     my ( $kernel, $heap, $task_id ) = @_[ KERNEL, HEAP, ARG0 ];
#     delete $heap->{task}->{$task_id};
#     $kernel->yield("next_task");
}




client
++++++
use Data::Dumper;
use SOAP::Lite;
my $client = SOAP::Lite
         -> uri('http://localhost:32080/')
         -> proxy('http://localhost:32080/?session=MyServer');
my $response = $client->Sum_Things(  {
                 'FOO'   =>      'bax',
                 'Hello' =>      'World!',
         }
             );

print Dumper $response->result;


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

Date: Fri, 14 Mar 2008 07:27:38 -0700 (PDT)
From: ptilderegex <ptilderegex@gmail.com>
Subject: P~(ptilde) 0.9 released, new scripting language with novel regex
Message-Id: <059caf0a-65e4-44da-bb38-7c159a99dc8f@m3g2000hsc.googlegroups.com>

P~ (pronounced "ptilde") is a new Java friendly scripting language.
The principle reason for creating it was to offer a new and more
powerful approach to creating regular expressions. Unlike all other
regex engines, P~ does not use the Perl-compatible metacharacter
syntax, instead using algebraic syntax for regex composition. This
decision opens the door to more powerful side-effects than even
possible in Perl, but preserving the readability and maintainability
of P~ regexes. In other regex engines, your regular expressions become
hard to read as the difficulty of the problem increases. Not so in P~.

While P~ makes it easy to grapple with matching and transformation
problems that are hard for even Perl programmers, its basic grammar is
Java-like, more so than even Groovy. This means that Java programmers
can quickly learn the basic grammar forms.

P~ is also Java friendly because you can import Java classes within
your scripts, and use their public apis just like in your Java code.
All you have to do is make sure that when you launch the Ptilde
scripting application, you include the appropriate Java libraries (jar
files) in the classpath.

Finally, P~ is Java friendly because its engine is a Java library.
Thus, if a Java programmer has a tough matching or transformation
problem, solve it first with a P~ script, using the standalone
application shell and the novel P~ regex grammars; then make this
script available to your Java application as either a file or a
resource, and easily invoke it from your Java class. You are allowed
to pass arguments and return a result from a scriptlet.

If this sounds interesting, take a look at the home page for the
documentation, which is found at http://www.ptilde.com. Start with the
Tutorial which will guide you through first the basic grammar of
Ptilde and then through the regex grammar forms.


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

Date: Fri, 14 Mar 2008 17:46:26 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: P~(ptilde) 0.9 released, new scripting language with novel regex
Message-Id: <gsalt3du5cks80359l9u1tm8tcn8d6gb4b@4ax.com>

On Fri, 14 Mar 2008 07:27:38 -0700 (PDT), ptilderegex
<ptilderegex@gmail.com> wrote:

>Unlike all other
>regex engines, P~ does not use the Perl-compatible metacharacter
                        ^^^
                        ^^^
>syntax, instead using algebraic syntax for regex composition.
[...]
>problems that are hard for even Perl programmers, its basic grammar is
>Java-like, more so than even Groovy. This means that Java programmers
 ^^^^^^^^^
 ^^^^^^^^^

So why do you think it may be of interest *here*?!?


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: Fri, 14 Mar 2008 11:40:20 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Why is "$A::a" and "$a" diffrent ?
Message-Id: <slrnftkog6.b4t.tadmc@tadmc30.sbcglobal.net>

jh3an <jh3ang@gmail.com> wrote:
> The following code doesn't make any sense, does it ?
> {
> package A;
> my $a = 3;
> if( ! ($a == $A::a) ){print "not equal\n"}
> }
>
> #output will be:
> not equal
>
> Why ? I think $A::a equals $a.


   "Coping with Scoping":

      http://perl.plover.com/FAQs/Namespaces.html


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: 14 Mar 2008 17:12:32 GMT
From: xhoster@gmail.com
Subject: XML::Parser::Style::Subs
Message-Id: <20080314131233.956$Tl@newsreader.com>

The code in XML::Parser::Style::Subs seems to be quite slow in some
situations, and also it silently eats any errors that might occur in
the call backs.

sub Start {
  no strict 'refs';
  my $expat = shift;
  my $tag = shift;
  my $sub = $expat->{Pkg} . "::$tag";
  eval { &$sub($expat, $tag, @_) };
}

I've replaced it for my purposes with:

sub Start {
  no strict 'refs';
  my $sub = $_[0]->{Pkg} . "::$_[1]";
  return unless defined &$sub;
  &$sub(@_);
}

The sub End was also modified analogously.)

This is faster and propagates errors as expected.  But it probably doesn't
work for AutoLoaded callbacks.  I don't care about that for my current
purposes, but for the sake of general improvement, is there a way to
arrange for the code to be faster and propagate errors while still working
for AutoLoad?

Thanks,

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Fri, 14 Mar 2008 17:42:13 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: XML::Parser::Style::Subs
Message-Id: <l0qqa5-v3b1.ln1@osiris.mauzo.dyndns.org>


Quoth xhoster@gmail.com:
> The code in XML::Parser::Style::Subs seems to be quite slow in some
> situations, and also it silently eats any errors that might occur in
> the call backs.
> 
> sub Start {
>   no strict 'refs';
>   my $expat = shift;
>   my $tag = shift;
>   my $sub = $expat->{Pkg} . "::$tag";
>   eval { &$sub($expat, $tag, @_) };
> }
> 
> I've replaced it for my purposes with:
> 
> sub Start {
>   no strict 'refs';
>   my $sub = $_[0]->{Pkg} . "::$_[1]";
>   return unless defined &$sub;
>   &$sub(@_);
> }
> 
> The sub End was also modified analogously.)
> 
> This is faster and propagates errors as expected.  But it probably doesn't
> work for AutoLoaded callbacks.  I don't care about that for my current
> purposes, but for the sake of general improvement, is there a way to
> arrange for the code to be faster and propagate errors while still working
> for AutoLoad?

You ought to be able to use $_[0]->{Pkg}->can($_[1]) instead of defined
&$sub: packages which use AUTOLOAD ought to provide a corresponding
->can. Any that actually use AutoLoader will.

Of course, now you've replaced an eval BLOCK with a method call, which
is probably slower :). TBH, I don't think AutoLoader is much used now
(the benefits are arguable), and a package using AUTOLOAD for clever
tricks would be better off using the XML::Parser interface directly.

The right answer is to stop grubbing around in the symbol table and
write XML::Parser::Style::Hashref, which takes a hashref with the same
keys as the subs in ::Subs.

Ben



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

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


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