[12882] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 292 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 29 02:07:17 1999

Date: Wed, 28 Jul 1999 23:05: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           Wed, 28 Jul 1999     Volume: 9 Number: 292

Today's topics:
        Beginner group. <kejoki@netdoor.com>
    Re: Beginner group. <uri@sysarch.com>
    Re: Beginner needs help with a function (Abigail)
    Re: Book "Perl Annotated Archives" Good?Bad? <uri@sysarch.com>
    Re: DBM question <zeng@haas.Berkeley.EDU>
    Re: DBM question (Eric Bohlman)
    Re: Die process, Die! (Abigail)
    Re: Die process, Die! <uri@sysarch.com>
    Re: Getting Height and Width of GIF/JPEG in PERL? <uri@sysarch.com>
    Re: Getting Height and Width of GIF/JPEG in PERL? (Sean McAfee)
    Re: How to copy a file to another name ? (Abigail)
    Re: How to make a backup file ? (Abigail)
    Re: NEWSFLASH: Supremes rule anti-advert-ware illegal (Joseph Hertzlinger)
    Re: OOP question. (Damian Conway)
    Re: OOP question. <uri@sysarch.com>
        Perl Problem (Jimtaylor5)
    Re: Perl Problem (Eric Bohlman)
    Re: Perl Question (Abigail)
    Re: perl-DBI-mysql (Don Arbow)
    Re: Using perl with another language? (Cameron Laird)
    Re: Using perl with another language? (Martien Verbruggen)
        using sendmail in .pl <Christian.Hans@s3ag.de>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 29 Jul 1999 00:55:27 -0500
From: Kevin Kinnell <kejoki@netdoor.com>
Subject: Beginner group.
Message-Id: <379FECCF.15573B1A@netdoor.com>

I wish I hadn't whined about this, but the damage is done. :-)

It looks to me like the best solution is to create alt.perl.learning
and create the ``one room schoolhouse'' atmosphere there.  It may be
doomed, but it's worth a try.

I doubt that it would significantly cut the noise in clp.misc,
unfortunately.

--
Kevin Kinnell <kejoki@netdoor.com>


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

Date: 29 Jul 1999 01:59:30 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Beginner group.
Message-Id: <x7zp0gov25.fsf@home.sysarch.com>

>>>>> "KK" == Kevin Kinnell <kejoki@netdoor.com> writes:

  KK> I wish I hadn't whined about this, but the damage is done. :-) It
  KK> looks to me like the best solution is to create alt.perl.learning
  KK> and create the ``one room schoolhouse'' atmosphere there.  It may
  KK> be doomed, but it's worth a try.

what is wrong with alt.perl as it is? it's low volume, full of cargo
cult code which is just perfect to spoon feed the newbies and no
curmudgeons. let's call it the minor leagues and misc and moderated the
majors. when newbies realize they can't learn from each other and they
start flaming with rtfm and rtfaq, they can graduate to the to the bigs.

  KK> I doubt that it would significantly cut the noise in clp.misc,
  KK> unfortunately.

no it won't. :-(

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: 29 Jul 1999 00:11:44 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Beginner needs help with a function
Message-Id: <slrn7pvoji.eo5.abigail@alexandra.delanet.com>

Tony Irvine (Tony.Irvine@env.qld.gov.au) wrote on MMCLVIII September
MCMXCIII in <URL:news:379FC7F2.F8E84DA3@env.qld.gov.au>:
~~ John Imrie wrote:
~~ > One command method
~~ > $string =~ s/^c+(.*)c+$/$1/;
~~ > The Pilgrim
~~ 
~~ Better one command method
~~ $string =~ s/(?:^c+|c+$)//g;
~~ 
~~ It is still not as fast as the two step method but it is close.  I would
~~ still recommend using the two step because it is faster and clearer..
~~ but if you must use a single command... :)

But.... the original specification said *single* characters should be
removed, which rules out the use of c+. Furthermore, the impression was
made that only when the first and the last character were special, they
should be removed. Which rules out your |.

~~ 
~~ Benchmark results for the interested.
~~ 
~~ Benchmark: timing 1000000 iterations of MyRegEx, OneRegEx, TwoRegEx...
~~    MyRegEx: 10 wallclock secs ( 9.94 usr +  0.00 sys =  9.94 CPU)
~~   OneRegEx: 18 wallclock secs (17.54 usr +  0.00 sys = 17.54 CPU)
~~   TwoRegEx:  8 wallclock secs ( 8.11 usr +  0.00 sys =  8.11 CPU)
~~ 


And here a benchmark which includes the substr variant I gave in
a previous posting:


#!/opt/perl/bin/perl -w

use strict;

use Benchmark;

timethese (1000000 , {
   NULL     => '$t = "ccfoocc"',
   MyRegEx  => '$t = "ccfoocc" ; $t =~ s/(?:^c+|c+$)//g;',
   OneRegEx => '$t = "ccfoocc" ; $t =~ s/^c*(.*?)c*$/$1/;',
   TwoRegEx => '$t = "ccfoocc" ; $t =~ s/^c+//; $t =~ s/c+$//;',
   Substr   => '$t = "ccfoocc" ; $t = (substr ($t,  0,  1) eq "c" &&
                                       substr ($t, -1,  1) eq "c") ?
                                       substr ($t,  1, -1) : $t'
});


Benchmark: timing 1000000 iterations of MyRegEx, NULL, OneRegEx, Substr, TwoRegEx...
   MyRegEx: 16 secs (14.35 usr  0.00 sys = 14.35 cpu)
      NULL:  1 secs ( 0.89 usr  0.00 sys =  0.89 cpu)
  OneRegEx: 41 secs (38.88 usr  0.00 sys = 38.88 cpu)
    Substr:  7 secs ( 5.71 usr  0.01 sys =  5.72 cpu)
  TwoRegEx: 10 secs ( 9.55 usr  0.00 sys =  9.55 cpu)



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 29 Jul 1999 01:18:25 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Book "Perl Annotated Archives" Good?Bad?
Message-Id: <x7emhsqbj2.fsf@home.sysarch.com>

>>>>> "GS" == Gregg Silk <greggsilk@aol.com> writes:

  GS> I see that Costco has "Perl Annotated Archives" by Martin Brown. I
  GS> looked pretty useful to me, but does anyone have opinions on its
  GS> accuracy and quality?  Gregg

from what i can find on the net (which you should have done yourself) i
can tell you very little. only one review at amazon, no code examples
and its publisher osborne/mcgraw-hill is not known for their computer
book quality especially in the perl world.

if it were any good, it would have been touted here and as it has been
published for over a year and i never heard of it, that lowers its
potential as a good perl book.

so my gut feeling is that is is worth buying for its fuel content or
chair stabilization ability.

next time i am at costco i will look for it and see what comes up (from
my stomach probably)

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Wed, 28 Jul 1999 22:27:12 -0700
From: Zeng <zeng@haas.Berkeley.EDU>
Subject: Re: DBM question
Message-Id: <Pine.SOL.4.05.9907282221300.6194-100000@haas.Berkeley.EDU>

> from perlfunc regarding function each:
> 
> "... If you add
>      or delete elements of a hash while you're iterating
>      over it, you may get entries skipped or duplicated,
>      so don't."

That is the problem. Thank you. Actually, this very example probably
illustrates the difference between Perl and other languages. Most
languages' compiler would prevent me from writing a 'delete' statement in
that loop using an 'each' function, or at least give me a warning. But
Perl, I feel, is too lax in this aspect. One of my earlier problems with
DBM is silimar. The compiler never complains until I spotted the problems 
from the results and felt they were not right. And take me enormoous time 
to fix it.> 
> I have found that Perl does a better job of doing what the manual says it
> should do than most other languages.  I have also found that what I
> intuitively feel a language should do has nothing to do with what the
> language actually does.




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

Date: 29 Jul 1999 05:55:03 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: DBM question
Message-Id: <7noqbn$5vo@dfw-ixnews4.ix.netcom.com>

Zeng (zeng@haas.Berkeley.EDU) wrote:
: That is the problem. Thank you. Actually, this very example probably
: illustrates the difference between Perl and other languages. Most
: languages' compiler would prevent me from writing a 'delete' statement in
: that loop using an 'each' function, or at least give me a warning. But
: Perl, I feel, is too lax in this aspect. One of my earlier problems with

delete() is a built-in function (operator), not a statement, and as such 
it would take some rather tricky code-flow analysis for the compiler to 
recognize that situation and issue a warning.  Come to think of it, it 
would have to do an awful lot of data-flow analysis as well: consider the 
following case:

$href=\%myhash;
while (($k,$v)=each %myhash) {
  if ($v<0) {
    delete $$href{$k};
  }
}

So any such checking would have to be done at run time, not compile time, 
which would likely slow things down unnecessarily.



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

Date: 29 Jul 1999 00:14:16 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Die process, Die!
Message-Id: <slrn7pvooa.eo5.abigail@alexandra.delanet.com>

JME (raceE@yahoo.com) wrote on MMCLVIII September MCMXCIII in
<URL:news:_QMn3.109$Ga2.8231@news.cwix.com>:
&& 
&& Any ideas why a script would hang after it seemingly completes?


Yeah, take a closer look at line 17.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 29 Jul 1999 01:43:57 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Die process, Die!
Message-Id: <x73dy8qaci.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@delanet.com> writes:

  A> JME (raceE@yahoo.com) wrote on MMCLVIII September MCMXCIII in
  A> <URL:news:_QMn3.109$Ga2.8231@news.cwix.com>:
  A> && 
  A> && Any ideas why a script would hang after it seemingly completes?

  A> Yeah, take a closer look at line 17.

boy, a lot of people seem to make mistakes on that line. maybe they
should make sure line 17 is always a comment or blank. sorta like hotels
don't have a 13th floor in the us.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: 29 Jul 1999 01:23:46 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Getting Height and Width of GIF/JPEG in PERL?
Message-Id: <x7aesgqba5.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@delanet.com> writes:

  A> Sean McAfee (mcafee@waits.facilities.med.umich.edu) wrote on MMCLVII
  A> September MCMXCIII in <URL:news:jFEn3.2866$nB.428994@news.itd.umich.edu>:
  A> !! In article <slrn7psv3n.3hu.abigail@alexandra.delanet.com>,
  A> !! Abigail <abigail@delanet.com> wrote:
  A> !! >Don't forget, when it comes to the web, the evil character is Netscape,
  A> !! >way more than MS.
  A> !! 
  A> !! *blink*
  A> !! 
  A> !! You don't say.

  A> Oh yes, I do. Let me say it again: the evilness of Jim Clark and Mark
  A> Andreessen far outweights the evilness of Bill Gates.

i appreciate your sentiments, but i don't agree. they may have ruined
the web, but uncle bill is trying to own the world and getting closer
eash second. i know who i would rather die a slow painful death.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Thu, 29 Jul 1999 05:50:59 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Getting Height and Width of GIF/JPEG in PERL?
Message-Id: <7ZRn3.3034$nB.451730@news.itd.umich.edu>

In article <slrn7pv624.4oo.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Sean McAfee (mcafee@waits.facilities.med.umich.edu) wrote on MMCLVII
>September MCMXCIII in <URL:news:jFEn3.2866$nB.428994@news.itd.umich.edu>:
>!! In article <slrn7psv3n.3hu.abigail@alexandra.delanet.com>,
>!! Abigail <abigail@delanet.com> wrote:
>!! >Don't forget, when it comes to the web, the evil character is Netscape,
>!! >way more than MS.

>!! *blink*
>!! You don't say.

>Oh yes, I do. Let me say it again: the evilness of Jim Clark and Mark
>Andreessen far outweights the evilness of Bill Gates.

Erp... I had a feeling the joke was too well-disguised even as I posted it.
Maybe I should have written "<blink>" instead.  But you're right; now that
I think about it, it's hard to imagine that even Microsoft could be evil
enough to create that monstrosity of a tag.

Did you ever see that document containing the list of new WebTV-specific
tags that made the rounds back when WebTV first came out?  Reading it caused
me to collapse to the ground, limbs twitching as every synapse in my brain
fired chaotically.  Well, almost.  The trauma has mercifully removed
most of my memories of the event, but I do recall that one of the tags
was <audioscope>.  And there was also the suggestion that it would be rude
of the rest of the Web not to cater to WebTV-ers' special needs.  *shudder*

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: 29 Jul 1999 00:20:23 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to copy a file to another name ?
Message-Id: <slrn7pvp3q.eo5.abigail@alexandra.delanet.com>

Yeong Mo/Director Hana co. (factory@factory.co.kr) wrote on MMCLVIII
September MCMXCIII in <URL:news:7noeh8$5m2$1@news1.kornet.net>:
__ What is this ?
__ 
__ File::Copy

I give you 2 guesses. One before you read the man page, and
one after you read the man page.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 29 Jul 1999 00:23:42 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to make a backup file ?
Message-Id: <slrn7pvpa0.eo5.abigail@alexandra.delanet.com>

Yeong Mo/Director Hana co. (factory@factory.co.kr) wrote on MMCLVIII
September MCMXCIII in <URL:news:7noetf$6hh$1@news1.kornet.net>:
[] Hi,
[] 
[] There is a file named aaa.txt
[] 
[] Let's think there are directories information in aaa.txt file as following;
[] 01 | directory-a |.................
[] 02 | directory-b |.................
[] This directory fields are changed when I load other script.
[] 
[] Before aaa.txt file is changed, I want to have a backup file.

That's nice. Then you make one, right?

[] Finally, I want to compare two files of new aaa.txt and backup file, and
[] delete the old directory from my server which is not still there in new
[] aaa.txt file.
[] 
[] If someone has a solution for this, please let me know.

A solution? What is your problem? You've said what you want, so just do it.

Or perhaps the problem is that you have absolutely no clue how to start.
In that case, consider hiring someone who does have a clue.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 29 Jul 1999 05:18:43 GMT
From: jhertzli@ix.netcom.com (Joseph Hertzlinger)
Subject: Re: NEWSFLASH: Supremes rule anti-advert-ware illegal
Message-Id: <7noo7j$enu@dfw-ixnews6.ix.netcom.com>

On 28 Jul 1999 14:28:01 -0700, Tom Christiansen <tchrist@mox.perl.com>
wrote:

>Credits on the video listed the SAL.
>Their choice of the European anthem, Beethoven's Ninth Symphony, has
>led authorities to look in Europe for their homebase, as it is widely
>understood that Europe provides refuge to uncounted intellectuals,
>artists, anti-commercial socialist sympathizers, and other commie rats,
>all hiding from the righteous wrath of invasive American
>technoplutocracy.

It must be Switzerland. That sort of organization requires the right
to bear arms to be safe.

>Twenty-eight prominent American cyberbusiness leaders who spoke on
>condition of anonymity all felt that pursuing nuclear options against
>SAL would not be unjustified in defense of American national interests,
>and that collateral damages in Europe would be a small price to pay,
>especially now that their advertising revenues were guaranteed.

Clearly, we must acquire SDI weaponry.

Anybody for phasers?


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

Date: 29 Jul 1999 05:26:20 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: OOP question.
Message-Id: <7nools$sv5$1@towncrier.cc.monash.edu.au>

Uri Guttman <uri@sysarch.com> writes:

   > > Although I've used Perl for a while, I haven't done much OOP
   > > with it, so I'm trying to brush up. I came across an exercise
   > > that instructed me to create a class C that inherits from
   > > classes A and B in that order. The trick was, if a C object
   > > should have a particular value (in this case, instance variable
   > > "name" has value "blah") the order of inheritance should be
   > > reversed.

   > i don't think it can be done directly as you claim since the
   > inheritance search path @ISA is a class level variable.

That's right.

   > but why not create 2 subclasses with the two versions of @ISA.
   > then some constructor (dunno which class this is in) would check
   > the value and bless it into the class with the desired @ISA.

Uri is on the right track here. The idea is a variation on the 
letter/envelope idiom (see the Facade pattern in "Design Patterns",
Gamma et al.)

Of course, Perl make it much easier than C++...


	package C;

	@ISA = qw( A B );

	sub new
	{
		my ($class, %args) = @_;
		return AntiC->new(%args) if $args{name} eq 'blah';
		return bless(\%args, $class);
	}


	package AntiC;

	@ISA = qw( B A );

	sub new
	{
		my ($class, %args) = @_;
		return bless(\%args, $class);
	}


	package main;

	my $c1 = C->new(name=>'bar', rank=>'foo', serialnum=>00001);
	my $c2 = C->new(name=>'blah', rank=>'floo', serialnum=>00002);


Now $c1 is a C, whilst $c2 is an AntiC.


Damian


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

Date: 29 Jul 1999 01:40:24 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: OOP question.
Message-Id: <x77lnkqaif.fsf@home.sysarch.com>

>>>>> "DC" == Damian Conway <damian@cs.monash.edu.au> writes:

  DC> 	package main;

  DC> 	my $c1 = C->new(name=>'bar', rank=>'foo', serialnum=>00001);
  DC> 	my $c2 = C->new(name=>'blah', rank=>'floo', serialnum=>00002);

  DC> Now $c1 is a C, whilst $c2 is an AntiC.

see, i told you he could do it.

:-)

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: 29 Jul 1999 05:13:26 GMT
From: jimtaylor5@aol.com (Jimtaylor5)
Subject: Perl Problem
Message-Id: <19990729011326.28108.00003777@ng-fh1.aol.com>

my perl program works flawlessly until it gets to this line. Then it says
bareword
problem. What is wrong with this line. I can't find anything wrong with it.

   foreach $line (@lines) {
   
      if ($line =~ /&lt;!--Next Record--&gt;&lt;font face=\"verdana\"
size=1&gt;(.*)&lt;/font&gt;/) {
	     push(@ENTRIES,$1);
      }
   }


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

Date: 29 Jul 1999 05:34:19 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl Problem
Message-Id: <7nop4r$5vo@dfw-ixnews4.ix.netcom.com>

Jimtaylor5 (jimtaylor5@aol.com) wrote:
: my perl program works flawlessly until it gets to this line. Then it says
: bareword
: problem. What is wrong with this line. I can't find anything wrong with it.
: 
:    foreach $line (@lines) {
:    
:       if ($line =~ /&lt;!--Next Record--&gt;&lt;font face=\"verdana\"
: size=1&gt;(.*)&lt;/font&gt;/) {
                    ^
Either escape that slash or (better) pick a regex delimiter character 
that doesn't appear literally in your regex.


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

Date: 29 Jul 1999 00:26:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl Question
Message-Id: <slrn7pvpft.eo5.abigail@alexandra.delanet.com>

kaz@eudoramail.com (kaz@eudoramail.com) wrote on MMCLVIII September
MCMXCIII in <URL:news:7noa5j$omv$1@nnrp1.deja.com>:
** Please someone tell me the difference between ".*" and ".*?"


"?"


Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 28 Jul 1999 21:58:08 -0700
From: donarb@nwlink.com (Don Arbow)
Subject: Re: perl-DBI-mysql
Message-Id: <donarb-2807992158080001@ip230.usw3.rb1.bel.nwlink.com>

In article <7ndhm3$e53@dfw-ixnews13.ix.netcom.com>, ebohlman@netcom.com
(Eric Bohlman) wrote:

: Klaus Oberecker (klaus.oberecker@gmx.at) wrote:
: : I´m trying to load images with a perl/dbi script into a mySQL-db. - I´ve
: : wrote a small test-skript:
: : 
: : ----
: : test.pl
: : ----
: : use DBI;
: : $dbh=DBI->connect("DBI:mysql:mydb",'xxxxxx','yyyyyy');
: : 
: : local (*FH);
: :
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)=
: : stat('xxxx.jpg');
: : open FH, 'xxxx.jpg';
: : $retval = read FH, $img_str, $size;
: : $picture=\$img_str;
: 
: $picture is a *reference* to a scalar holding the binary image data.
: 
: : 
: : $my_sql_statement="INSERT INTO tablename (uid,vorname, nachname,
: : bildtyp, pict) VALUES (0,'Prename','Surename',0,$picture)";
: 
: Interpolating a reference like $picture into a double-quoted string 
: stringifies it.  You have *not* inserted the binary image data into your 
: statement.
: 
:  : $sth = $dbh->prepare($my_sql_statement);
: : $rv=$sth->execute($bild);
: : $dbh->disconnect; 
: : ----
: : 
: : ... but I always get this error-message:
: : 
: : DBD::mysql::st execute failed: You have an error in your SQL syntax near
: : '(0x812542c))' at line 1 at test.pl line
: : 12. 
: 
: That's what a stringified reference looks like.


You should have provided an answer in addition to pointing out what's wrong.

The insert statement should read:

$my_sql_statement="INSERT INTO tablename (uid,vorname, nachname,
bildtyp, pict) VALUES (0,'Prename','Surename',0,$$picture)";

Note: a double '$' dereferences the reference to return the original data.

Don

-- 
Don Arbow
donarb@nwlink.com


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

Date: 29 Jul 1999 05:13:06 GMT
From: claird@starbase.neosoft.com (Cameron Laird)
Subject: Re: Using perl with another language?
Message-Id: <C6829573B170B091.500B6BA0B0688491.73E204C0F7A2BEDC@lp.airnews.net>


In article <379EA1DD.522247E4@rohan.sdsu.edu>,
George hart  <hart@rohan.sdsu.edu> wrote:
>
>
>Hi
>
>I am a beginning programmer who would like some advice using perl
>combined with other languages.  Right now I have a project in C that
>deals with some heavy text manipulation which is easy in Perl but a
>disaster in C.   I am tempted to do a few system calls to Perl in my C
>program but I cannot help to wonder: (1) is this considered good
>programming?  (2) Are there serious perfomance issues?  (3) Is there a
>standard way to intermix programming languages?
			.
			.
			.
(1) There are people who scorn such an approach.  I don't.  In
    fact, I argue for it, in, for example, <URL:
    http://www.sunworld.com/swol-07-1999/swol-07-regex.html#2>.
(2) Yes.  Sure.  Like many serious matters, they can be managed.
(3) Too many.  There are too many standard approaches.  Along
    with the perlembed documentation already recommended to you,
    you might want to examine <URL:http://www.swig.org/>.
-- 

Cameron Laird           http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com      +1 281 996 8546 FAX


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

Date: Thu, 29 Jul 1999 05:17:46 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Using perl with another language?
Message-Id: <_tRn3.121$tY.9528@nsw.nnrp.telstra.net>

In article <379EA1DD.522247E4@rohan.sdsu.edu>,
	George hart <hart@rohan.sdsu.edu> writes:

> I am a beginning programmer who would like some advice using perl
> combined with other languages.  Right now I have a project in C that

Hmm. If you're a beginning programmer, a small warning is probably in
place: Making languages cooperate is never for the faint of heart.
Making programs cooperate is easier.

> deals with some heavy text manipulation which is easy in Perl but a
> disaster in C.   I am tempted to do a few system calls to Perl in my C

I don't think 'system call' means what you think it means. :)

You mean run an external perl program with the C system(3) function,
right?

> program but I cannot help to wonder: (1) is this considered good
> programming?  (2) Are there serious perfomance issues?  (3) Is there a
> standard way to intermix programming languages?

(1) depends on whether there are better methods available, and how
hard it would be to do it another way. I normally tend to avoid
spawning other processes if I can do it in any other way.

(2) Maybe. forking and execing another process, especially via a
shell, is quite expensive on the CPU. Sometimes, however it is easier
to just fork and exec another program, set up some ipc, and do it that
way. It only becomes troublesome if you need to do it very often.

(3) For Perl and C: yes.

# man perlembed
NAME
     perlembed - how to embed perl in your C program

# man perlxs
NAME
     perlxs - XS language reference manual

DESCRIPTION
     Introduction

     XS is a language used to create an extension interface
     between Perl and some C library which one wishes to use with
     Perl.

# man perlcall
is also useful

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd.       | but mean your mother.
NSW, Australia                      | 


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

Date: Thu, 29 Jul 1999 07:54:46 +0200
From: "Christian Hans" <Christian.Hans@s3ag.de>
Subject: using sendmail in .pl
Message-Id: <7noq8l$33g$1@news.vossnet.de>

Hi,

I user a sendmail in a perl script, and it works well, but know I want to
add a BCC recipient ... what is the syntax ?

print MAIL "BCC: name\@domain.com";

doesn't work :(

need help

thanx

--
Christian Hans
Christian.Hans@s3ag.de
www.DerChris.de / www.PartySzene.de




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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V9 Issue 292
*************************************


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