[17206] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4618 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 14 18:05:30 2000

Date: Sat, 14 Oct 2000 15:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971561110-v9-i4618@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 14 Oct 2000     Volume: 9 Number: 4618

Today's topics:
    Re: [Q] "pass along" in AUTOLOAD ? (Mark-Jason Dominus)
    Re: A Simpler perlish way <anders@wall.alweb.dk>
    Re: A Simpler perlish way <godzilla@stomp.stomp.tokyo>
    Re: A Simpler perlish way <anders@wall.alweb.dk>
    Re: A Simpler perlish way (Gwyn Judd)
    Re: A Simpler perlish way <anders@wall.alweb.dk>
    Re: A Simpler perlish way <godzilla@stomp.stomp.tokyo>
    Re: A Simpler perlish way <bkennedy@hmsonline.com>
    Re: A Simpler perlish way <bart.lateur@skynet.be>
    Re: A Simpler perlish way (Andrew Johnson)
    Re: A variable menage-a-trois? Too Strict! (Colin Watson)
    Re: Can't pipe from Perl to C (Mark-Jason Dominus)
    Re: Converting to thumbnails dtbaker_dejanews@my-deja.com
    Re: Newbie: Reading a COOKIE ?! <julien@stokkink.com>
        Perl & MySQL & Solaris <bas@appelo.nl>
    Re: Perl & MySQL & Solaris <jeff@vpservices.com>
    Re: Perl & MySQL & Solaris <bas@appelo.nl>
    Re: Perl & MySQL & Solaris <jeff@vpservices.com>
    Re: Perl - form interaction <anders@wall.alweb.dk>
    Re: Regex for matching e-mail addresses <bart.lateur@skynet.be>
    Re: run system command and return before completion (Mark-Jason Dominus)
    Re: run system command and return before completion (Mark-Jason Dominus)
    Re: split problem <mbudash@sonic.net>
    Re: split problem (Mark-Jason Dominus)
    Re: split problem <mbudash@sonic.net>
    Re: split problem <uri@sysarch.com>
        tips on installing Image::Magick ? dtbaker_dejanews@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 14 Oct 2000 18:12:22 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: [Q] "pass along" in AUTOLOAD ?
Message-Id: <39e8a206.4bb$1f6@news.op.net>
Keywords: carpenter, contemporary, phenol, tell

In article <8sa6q7$h7o$1@panix3.panix.com>, kj0  <kj0@mailcity.com> wrote:
>In particular, AUTOLOAD complains when DESTROY is called, for
>example, which is no good.  I want AUTOLOAD to detect calls such as
>these and pass them along to a parent class (e.g. UNIVERSAL).

I feel like we're not communicating, but I don't know how to be
clearer, so I am going to repeat myself.  

It does not make sense for AUTOLOAD to pass DESTROY calls to
UNIVERSAL, because *there is no* UNIVERSAL::DESTROY method.

If there *were* a UNIVERSAL::DESTROY method, your AUTOLOAD function
would not have been called.

I think what you really want is something like this:

        sub AUTOLOAD {
          my ($class, $function) = ($AUTOLOAD =~ /(.*)::(.*)/);

          # check if $function is a  valid accessor method for this class...
          # if so, handle appropriately...
          # if not, then:        

          if ($function =~ /^[A-Z]+$/) {  # All uppercase
            return;
          } else {
            die "No such method as $function in class $class...";
          }

        }

Here, if AUTOLOAD is invoked to handle a nonexistent DESTROY method,
it returns silently.

"Passing" the method call does not make sense, because there is
nowhere to pass it to.  If there were a DESTROY method to inherit
from, that method would have been called in the first place, instead
of AUTOLOAD. AUTOLOAD is the handler of *last* resort.



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

Date: Sat, 14 Oct 2000 21:06:50 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: A Simpler perlish way
Message-Id: <2a2G5.1161$Tq1.88578@news010.worldonline.dk>

Godzilla! wrote:


> > "Don't reinvent the wheel"

> I am one of those who looks at a wheel and thinks,
> 
> "There is probably a better way to do this."

Because I actually have fun reading some of the more weird threads of this 
group, you didn't yet end up in my killfile.

The word of wisdom comes from the excellent book "Programming Perl" 
(O'Reilly's) which you may (??) have read.

CPAN has it's part in making perl such a great tool, since the possibility 
of finding code, applications, scripts or modules addressing most tasks 
you'd wish to solve using perl is a key to high productivity for many of us.

That said, I often write solutions myself, if I'm not happy with what I've 
got. However, like you I "look at the wheel" before moving on the the idear 
of improving, and that is the reason for my answer to a person who wishes 
to learn a "perlish" way of dooing things. Visiting CPAN is a very perlish 
thing...

-anders

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Sat, 14 Oct 2000 12:34:30 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: A Simpler perlish way
Message-Id: <39E8B546.79560498@stomp.stomp.tokyo>

Anders Lund pompously pontificated:
 
> Godzilla! wrote:

> > > "Don't reinvent the wheel"
 
> > I am one of those who looks at a wheel and thinks,

> > "There is probably a better way to do this."
 
> Because I actually have fun reading some of the more weird 
> threads of this group, you didn't yet end up in my killfile.


Oh gosh now, aren't you just an arrogant self-righteous
Deity of Perl? Oh please kind sir, oh please Your Great
Blowness, do not place me in thee killfile! My life shall
lie in ruination should you doom me to your dungeon of
killfile, oh Shirley this is true.

* slobbers, genuflects and farts *

Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: Sat, 14 Oct 2000 21:37:08 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: A Simpler perlish way
Message-Id: <rC2G5.1168$Tq1.89200@news010.worldonline.dk>

Godzilla! wrote:

> 
> Oh gosh now, aren't you just an arrogant self-righteous
> Deity of Perl? Oh please kind sir, oh please Your Great
> Blowness, do not place me in thee killfile! My life shall
> lie in ruination should you doom me to your dungeon of
> killfile, oh Shirley this is true.
> 
> * slobbers, genuflects and farts *

no, why take out the fun part..

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Sat, 14 Oct 2000 19:53:57 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: A Simpler perlish way
Message-Id: <slrn8uheef.ju.tjla@thislove.dyndns.org>

I was shocked! How could Anders Lund <anders@wall.alweb.dk>
say such a terrible thing:
>Godzilla! wrote:
>
>> > "Don't reinvent the wheel"
>
>> I am one of those who looks at a wheel and thinks,
>> 
>> "There is probably a better way to do this."
>
>Because I actually have fun reading some of the more weird threads of this 
>group, you didn't yet end up in my killfile.

hehe I only get to read such 'gems' as this when someone else replies to
her. Does anyone else have this vision of 'moron-zilla' showing off her
new invention, the square wheel and being puzzled when nobody else
thinks it's as great as she does?

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I expect people to expect Perl to do the right thing.
             -- Larry Wall in <199911192358.PAA24109@kiev.wall.org>


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

Date: Sat, 14 Oct 2000 21:56:06 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: A Simpler perlish way
Message-Id: <dU2G5.1177$Tq1.89640@news010.worldonline.dk>

Gwyn Judd wrote:
 
> Does anyone else have this vision of 'moron-zilla' showing off her
> new invention, the square wheel and being puzzled when nobody else
> thinks it's as great as she does?
> 
Yup, me. As I said, why take out the fun part..

-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Sat, 14 Oct 2000 13:04:48 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: A Simpler perlish way
Message-Id: <39E8BC60.FFAB7446@stomp.stomp.tokyo>

Gwyn Judd drooled:

> Anders Lund, His Great Blowness, spewed:
> > Godzilla! wrote with flair and style:

> > > "Don't reinvent the wheel"

> > > I am one of those who looks at a wheel and thinks,

> > > "There is probably a better way to do this."

> > Because I actually have fun reading some of the more weird threads of this
> > group, you didn't yet end up in my killfile.
 
> hehe I only get to read such 'gems' as this when someone else replies to
> her. Does anyone else have this vision of 'moron-zilla' showing off her
> new invention, the square wheel and being puzzled when nobody else
> thinks it's as great as she does?


Oh look! It's Francis and Frank!


* snaps her fingers *

Shucks, just when I thought I had this
Victoria - Victor thing down pat, a
worse act comes along.


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: Sat, 14 Oct 2000 20:05:17 GMT
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: A Simpler perlish way
Message-Id: <103G5.48026$td5.7224524@news1.rdc2.pa.home.com>


"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:39E89916.19837918@stomp.stomp.tokyo...

> To our better health and better piece of mind, intelligent people
> very often work at reinventing the wheel and, just as often are
> quite successful. This is commonly called progress.

Its only progress if its a better wheel - but how many better ways are there
get Julian dates?

> I am one of those who looks at a wheel and thinks,
>
> "There is probably a better way to do this."
>
>
> This is a better attitude than jumping into a rut
> and burying yourself with Cargo Cult ignorance.

It is unfair to say that using modules is cargo cult programming.  However,
there are occaisions where it makes a lot of sense to build your own version
of a module.  I would say this is when

A) You want/need a piece of functionality that is currently not implemented
on CPAN, or you want/need more advanced functionality over what is currently
present

B) You enjoy programming, and wish to experience the pleasure of programming
something cool even though it may or may not have been done before

Now I assume you put yourself in the category of B - that is, you enjoy
programming.  However, most posters here are trying to solve a specific
problem, and are not asking the question because they want advice in B.  To
them, using a pre-made and well documented CPAN solution is exactly what
they require.  They are not interested in duplicating or improving upon the
work of others, especially when the work of others is perfectly suited to
their own needs.  Using modules such as Time::Julian is no more or less
cargo cultish than using LWP or any modules bundled with Perl such as Fcntl.

--Ben Kennedy









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

Date: Sat, 14 Oct 2000 20:21:28 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: A Simpler perlish way
Message-Id: <49fhusk7mbm0ejsu395g8f99mgr6am2u8n@4ax.com>

Jody Fedor wrote:

>if ($yr%4 == 0) {$days[1] = 29} else {$days[1] = 28};

This rule is too simple. The proper rule is:

	if the year is divisible by 4
	   it's a leap year, unless
	     the year is divisible by 100,
	       then it's not a leap year, unless
	         the year is divisible by 400,
	           then it *is* a leap year

So 2000 is a leap year, but 1900 was not.

>Any Perl Guru pointers or a better way?

Well, you should discover localtime() in list context. No need to parse
the date string at all.

And divide the time number (e.g. time()) by (24*60*60) = 86400 (seconds
in a day), and the integer part of this result is the days since the
epoch, commonly Jan 1st 1970 (GMT).

-- 
	Bart.


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

Date: Sat, 14 Oct 2000 21:04:24 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: A Simpler perlish way
Message-Id: <sT3G5.16859$6O5.1502220@news1.rdc1.mb.home.com>

In article <103G5.48026$td5.7224524@news1.rdc2.pa.home.com>,
 Ben Kennedy <bkennedy@hmsonline.com> wrote:
> 
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
> news:39E89916.19837918@stomp.stomp.tokyo...
[snip]

> > This is a better attitude than jumping into a rut
> > and burying yourself with Cargo Cult ignorance.
> 
> It is unfair to say that using modules is cargo cult programming.

Indeed, not only is it unfair, it is simply incorrect.

Using a module is not cargo-cult programming -- to think so is a
misunderstanding of both the term 'cargo-cult' and programming.

Using a well tested module is not at all like emulating an airstrip
in an attempt to entice cargo planes to land -- rather, it is like
going to an actual air freight shipping company who know all the
protocols and ins and outs of shipping cargo by plane and arranging
through them to send or receive your shipments of goods.

Using a module in such a way stands in opposition to building your
own real airstrips, manufacturing your own real planes, training your
own pilots and cargo handlers, etc, etc,... ie, reinventing or
reimplementing the wheel. Neither using the module, nor building your
own from scratch has anything whatsoever to do with cargo cult
prorgramming.

In fact, godzilla stands as an excellent example of cargo culting.
The manner in which godzilla misuses the term 'cargo cult' itself
belies her lack of understanding of the term. It seems painfully
obvious that she has merely cargo-culted the term and has no idea why
it doesn't apply to the cases she continually applies it to.

regards,
andrew

-- 
Andrew L. Johnson   http://members.home.net/andrew-johnson/
      I drink to make other people interesting.
          -- George Jean Nathan


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

Date: 14 Oct 2000 19:55:18 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: A variable menage-a-trois? Too Strict!
Message-Id: <8sadn6$217$1@riva.ucam.org>

Michael Sattler <michael@GeekTimes.com> wrote:
>I would like to share a bunch of variables declarations between three 
>CGIs. For example,
>
>== start shared.pm ==
>  my $foo = 10 ;  # what I first tried
>  1;              # required of all packages                            
>
>== end shared.pm ==

my() declares a variable only within the current lexical scope, i.e. the
file. It won't be visible outside it. In order for it to be visible
anywhere else, you need to have a package declaration (e.g. 'package
shared;' - though note that you're better off using an initial uppercase
letter to avoid clashing with possible future pragmatic modules), and
leave out the my().

'perldoc perlmod' is the place to read about this.

>In each file I say 
>
>== start foo.pl ==
>  use strict ;      # bear Perl's full scrutiny
>  use diagnostics ; # scrutiny --> verbose diagnostics
>  use FileHandle ;  # use explicit FH creation/usage
>
>  use shared ;      # share declarations/definitions
>
>  print $foo ;
>== end foo.pl ==
>
>WHAT IS THE CANONICAL WAY TO SHARE DEFINITIONS AND DECLARATIONS between 
>several Perl files, be they .pl, .pm, or .cgi? I've been reading about 
>import(), and Exporter, but I have this sneaking suspicion that I've 
>missed some vital discussion about writing clean code which just shares 
>theory (definitions) and practice (constant declarations) between files?

As ever, there's more than one way to do it. You can go the full
Exporter route, which in your example would lead to the following code:

-- Shared.pm
package Shared;
use strict;
use Exporter;
use vars qw(@ISA @EXPORT_OK $foo);  # quieten 'strict vars'
@ISA = qw(Exporter);                # inherit Exporter's methods
@EXPORT_OK = qw($foo);              # export the symbol on request

$foo = 10;                          # that's $Shared::foo

1;  # previous statement returns true anyway, but good style
-- end Shared.pm

-- foo.pl
#! /usr/bin/perl -w
use strict;
use Shared qw($foo);   # import explicitly, due to @EXPORT_OK; @EXPORT
                       # wouldn't need the qw($foo), but @EXPORT_OK is
                       # recommended

print $foo; # now it's in our namespace, that is $main::foo
-- end foo.pl

Note the 'use vars'; it will solve your 'use strict vars' problem, or
you could say $Shared::foo everywhere instead (but that's unwieldy). In
Perl 5.6 and above you can use our() too, with somewhat different
semantics.

If it's for one-time use, you might not want to bother going the full
Exporter route and can just say 'print $Shared::foo;' in your main
program to access the variable without importing its symbol into your
namespace.

You can even play with the symbol table directly to import an individual
variable into your namespace, so that you can use it without a package
qualifier. Now your main code would look like this:

-- foo.pl
#! /usr/bin/perl -w
use strict;
use Shared;
*foo = \$Shared::foo;  # create a symbol table alias, see
                       # L<perldata/Typeglobs and Filehandles>
-- end foo.pl

The Exporter module does this internally to actually export the symbols.

Exporter is probably about as close as you get to "canonical", but you
may find it a bit over-the-top for casual use. YMMV.

-- 
Colin Watson                                     [cjw44@flatline.org.uk]
"She's always been touchy about her age - even though it's not
 the first time she's turned 40." - Frasier Crane on Maris


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

Date: Sat, 14 Oct 2000 19:15:04 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Can't pipe from Perl to C
Message-Id: <39e8b0b7.6f7$1c9@news.op.net>
Keywords: certiorari, liturgic, shamrock, workpiece


In article <CU5E5.4139$D81.153609@newsread2.prod.itd.earthlink.net>,
Michael <michaelr_41@hotmail.com> wrote:
>Here's some code...

The problem here seems to be that you are incredibly confused about
how pipes work.  The subject line is misleading, because I don't think
you would find it possible to pipe from any language to any other
language.

>open(MYPROG,"./testreturn somedata|");

This notation create a pipe.  MYPROG is a Perl filehandle attached to
the reading end of the pipe.  The *standard output* of testreturn is
attached to the writing end.  If you want testreturn to write data
into this pipe, testreturn will have to look like this:

      write (1,message, strlen(message)+1);        

Note the use of file descriptor 1, which is the standarf output.  

It would have been more normal to use this instead:

        puts(message);  # print a message to the standard output

The real problem here is in your C code, which makes no sense at all,
and is never going to do anything useful.

>main() {
>        int fifo[2];
>        char *message = "This comes from the called program";
>        char line[8];
>        if (pipe(fifo) == -1) {
>                fprintf(stderr,"Cannot create pipe\n");
>                exit (1);
>        }
>        read (fifo[0],line,8);
>        write (fifo[1],message, strlen(message)+1);        
>}

Here your program created a pipe, and tried to read from it.  But the
only program attached to this pipe is the one that created it!  What
your program has done is like picking up the receiver and talking into
the telephone, without dialing anyone else's number!  All it is going
to hear in the phone is its own words coming back to it.  Since it
hasn't said anything, it hears nothing.  

The C program is waiting forever at the 'read' line, because it is
listening on a pipe that is connected to its own mouth and to nowhere
else.  The Perl program is waiting on its own 'read' line, listening
on MYPROG, which is attached to the C program's standard output.  The
Perl program is waiting for the C program to say something, but it
never does this.

I keep wanting to fix your C code, but it is never going to work,
because you are trying to do two-directional communication, and pipes
don't do that (*).  You need two pipes, one for each direction. But to
get you started, I will suggest this:  

-- perl program

        #!/usr/bin/perl -w
        # test.pl - Trying to call a C program...

        print "Hello, world!\n";
        open(MYPROG,"./testreturn somedata|");
        print "testreturn says:\n";
        print <MYPROG>;
        close(MYPROG);

-- C program

        /* C program copyright 2000 Mark-Jason Dominus.
         * Unauthorized reproduction will be prosecuted to the 
         * fullest extent of the law. */
        #include <stdio.h>
        int main(int argc, char **argv) {
          char *message = (argc > 1 ? argv[1] 
                                    : "Old King Cole was a merry old soul");
          puts(message);
          putchar('\n');
          return 0;
        }

You didn't say what you were actually trying to accomplish, so I can't
offer any more detailed advice, except that you should get a book
about Unix systems programming and read it, and if you already have a
book, you should probably get rid of it.  The 'Advanced Programming in
the Unix Environment book by W. Richard Stevens is supposed to be
good.  I learned from 'Advanced Unix Programming' by Marc Rochkind and
found it excellent.

I also suggest that you take future questions to comp.unix.programmer,
at least until you understand pipes.

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

(*) Yes, of course I know that pipes can be made to do half-duplex
bidirectional communication.  This guy needs to figure out simplex
communication first.


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

Date: Sat, 14 Oct 2000 20:36:10 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: Converting to thumbnails
Message-Id: <8sag3q$4ju$1@nnrp1.deja.com>

good information... I need to do some similar work. I have used
Image::Size to get the size, but was needing to actually resample the
images as well.

I went and looked at the docs for this Image::ImageMagick , and I got a
little overwhelmed by the install requirements. It looks like you might
need both the perl lib and also a C++ development environment to
install? I would like to install both on my PC running win98 and install
to my UNIX domain online to use in some cgi. Is this going to be
possible without root privs on the remote server?

thanx,

Dan


In article <slrn8tkrci.b9n.mgjv@verbruggen.comdyn.com.au>,
  mgjv@tradingpost.com.au wrote:
> On Tue, 03 Oct 2000 23:19:46 GMT,
> 	apacheproblems@my-deja.com <apacheproblems@my-deja.com> wrote:
> > We would like a simple perl script that will take a gif or jpeg and
> > will reduce the size of the picture by N%. The code will be used
both
> > in real time and batch process. The script should be able to read
the
> > original size of the picture.  Any such scripts or libraries we can
use?
>
> use Image::Magick;
> # http://www.imagemagick.org/
>
> my $im = Image::Magick->new();
> my $rc = $im->Read($image_name);
> die $rc if $rc;
> $rc = $im->Scale("50%");
> die $rc if $rc;
> $rc = $im->Write($other_image_name);
> die $rc if $rc;
>
> Apart from Scale, there are also Zoom, Sample, Transform, Minify and
> Maxify (IIRC).
>
> Martien
> --
> Martien Verbruggen              |
> Interactive Media Division      | We are born naked, wet and hungry.
> Commercial Dynamics Pty. Ltd.   | Then things get worse.
> NSW, Australia                  |
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 14 Oct 2000 20:25:02 GMT
From: "Julien Stokkink" <julien@stokkink.com>
Subject: Re: Newbie: Reading a COOKIE ?!
Message-Id: <yi3G5.792898$Kw2.7443420@flipper>

I've fixed the problem by removing the path and now it works !
But thanks for your help anyway.

Julien





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

Date: Sat, 14 Oct 2000 19:42:51 +0200
From: Bas Appelo <bas@appelo.nl>
Subject: Perl & MySQL & Solaris
Message-Id: <39E89B1B.B9870030@appelo.nl>

Hy,

I've got a problem with installing the MySQL module when I do

use MySQL;

I get:

Can't load
'/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBI/DBI.so' for
module DBI: ld.so.1: /usr/local/bin/perl: fatal: relocation error: file
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/DBI/DBI.so:
symbol Perl_no_security: referenced symbol not found at
/usr/local/lib/perl5/5.6.0/sun4-solaris/DynaLoader.pm line 200.
 at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBI.pm line 182
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBI.pm line 182.
Compilation failed in require at
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Mysql.pm line 11.
Compilation failed in require at ./test.pl line 3.
BEGIN failed--compilation aborted at ./test.pl line 3.

I just installed the module with CPAN, I've got Solaris 2.7.

During the installation CPAN said:
Note (probably harmless): No library found for -lgz

Does somebody has a clue what I'm doing wrong?

offcourse I can give alot more information, but I'm not our
regular Sys-admin, so I really don't have a clue what you
wanna know.

TnXe6,
	Bas Appelo


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

Date: Sat, 14 Oct 2000 11:34:34 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perl & MySQL & Solaris
Message-Id: <39E8A73A.D5B3AC92@vpservices.com>

Bas Appelo wrote:
> 
> Hy,
> 
> I've got a problem with installing the MySQL module when I do
> 
> use MySQL;

Try something like:

use DBI;
my $dbh = DBI->connect(
    "DBI:mysql:$database:",
    $user,
    $pass,
    {RaiseError=>1}
) or die $DBI::errstr;

The old stand-alone MySQL.pm has been replaced by the DBD::mysql.pm and
DBI.

See perldoc DBD::mysql for further details (*not* perldoc MySQL, which
will get you a bunch of confusing instructions and this tidbit):

    OBSOLETE SOFTWARE
      As of Msql-Mysql-modules 1.19_10 M(y)sqlPerl is no longer a
separate
      module. Instead it is emulated using the DBI drivers. You are
strongly
      encouraged to implement new code with DBI directly.


-- 
Jeff


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

Date: Sat, 14 Oct 2000 22:33:52 +0200
From: Bas Appelo <bas@appelo.nl>
Subject: Re: Perl & MySQL & Solaris
Message-Id: <39E8C330.CF2E74B7@appelo.nl>

Jeff Zucker wrote:
> 
> Bas Appelo wrote:
> >
> > Hy,
> >
> > I've got a problem with installing the MySQL module when I do
> >
> > use MySQL;
> 
> Try something like:
> 
> use DBI;
> my $dbh = DBI->connect(
>     "DBI:mysql:$database:",
>     $user,
>     $pass,
>     {RaiseError=>1}
> ) or die $DBI::errstr;
> 
> The old stand-alone MySQL.pm has been replaced by the DBD::mysql.pm and
> DBI.

TnX, I'll use that but the problem remains :(

Greets,
	Bas Appelo


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

Date: Sat, 14 Oct 2000 13:54:34 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perl & MySQL & Solaris
Message-Id: <39E8C80A.9BF3F277@vpservices.com>

Bas Appelo wrote:
> 
> Jeff Zucker wrote:
> >
> > Bas Appelo wrote:
> > >
> > > Hy,
> > >
> > > I've got a problem with installing the MySQL module when I do
> > >
> > > use MySQL;
> >
> > Try something like:
> >
> > use DBI;
> > my $dbh = DBI->connect(
> >     "DBI:mysql:$database:",
> >     $user,
> >     $pass,
> >     {RaiseError=>1}
> > ) or die $DBI::errstr;
> >
> > The old stand-alone MySQL.pm has been replaced by the DBD::mysql.pm and
> > DBI.
> 
> TnX, I'll use that but the problem remains :(

Then it would seem that you need to re-install DBI and DBD::mysql.

-- 
Jeff


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

Date: Sat, 14 Oct 2000 20:30:14 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Perl - form interaction
Message-Id: <JD1G5.887$Uy5.65653@news000.worldonline.dk>

David R. Hardoon wrote:

> Hello,
> i have a question about perl,
> how can I send data from it to a form?
> <form.....>
> </from>

Take a look at the CGI module
 
> and how can I write the script so when it is
> run from the web as cgi it wont stop running?

You need to learn. Go search the web for information on HTTP and CGI

-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Sat, 14 Oct 2000 19:26:04 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Regex for matching e-mail addresses
Message-Id: <lqchusgkk2m4gjb754i3c65p6f1jv6nc9h@4ax.com>

Philip 'Yes, that's my address' Newton wrote:

>For example, I believe someone once mentioned he had an email
>address of hostmaster@dk

That sounds like it should be reserved for the king of Danmark.

-- 
	Bart.


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

Date: Sat, 14 Oct 2000 18:37:23 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: run system command and return before completion
Message-Id: <39e8a7e3.5a4$357@news.op.net>
Keywords: Thomson, behind, monkey, obtain

In article <39E82ADC.79E61D63@biochem.usyd.edu.au>,
Joel Mackay  <j.mackay@biochem.usyd.edu.au> wrote:
>I tried simply using:
>
>`dyana &`
>ànd a number of variations thereof, but the browser always waits till
>the program is finished running before continuing.

I suspect that

        system("dyana >/dev/null 2>&1 &");

will do what you want.

There are several things wrong with your try.  The simplest is that
the

        `command`

notation specifically instructs Perl to wait until it has received all
the data from the command.  Even though you 'ran the command in the
background', you sabotaged that by forcing the main program to wait
until it had received all the command's output.

Because of this sort of situation, is is usually considered bad style
to use `...` unless you are interested in getting the output of the
command back into the master program.  If you are not interested in
the command output, you should probably use 'system' instead.

Using

        system("dyana &");

will fix this part of the problem.  However, in the case of CGI
programs, that is not usually enough to get the browser to continue.
Here's what is happening.

The browser sends the request to the server.  The server runs your CGI
program.  It is waiting for the program to complete; then it will
gather all the output data from the command, package them up, and send
the package back to the browser.  The browser will display the data
and return control to the user.

The server will not send the package until it has all the data from
the command.  It is attached to the CGI program via a pipe which is
hooked into the standard output of the program.  When the CGI program
prints data to the standard output, as with

        print "Content-type: text/html\n\n";

or whatever, the string actually goes into the pipe, and is received
by the server.  The server is waiting for this pipe to be closed.
When the pipe is closed, the server knows that nor more information is
forthcoming, so it can send all the data off over the network to the
browser.  Until the pipe closes, there might be more data, to the
server must wait.

Pipes close automatically when there is nobody left to write to them.
Normally, the CGI program is the only thing attached to the writign
end of the pipe, so when it exits, the pipe closes and the server
sends the data.

However, when a process runs a subprocess, the subprocess inherits all
the open files and pipes from its parent.  If you did:

        system("dyana &");

then dyana would inherit the pipe back to the server.  When the main
CGI program exited, dyana would still be attached to the pipe, so it
wouldn't close, and the server would continue to wait for the end
of the command output.  This wouldn't occur until dyana had also
exited or otherwise closed STDOUT.

The solution I suggested was:

        system("dyana >/dev/null 2>&1 &");

The >/dev/null detaches dyana's standard output from the pipe and
points in into /dev/null.  2>&1 means "make the standard error go to
the same place that standard output is going to"---in this case,
/dev/null.  (2>&1 may be unnecessary, but some web servers attach
standard error to the server pipe also.)  The & puts the command in
the background.

>Any suggestions out there?

Hope this helps.



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

Date: Sat, 14 Oct 2000 18:43:28 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: run system command and return before completion
Message-Id: <39e8a950.5dc$355@news.op.net>

In article <39E82DA9.595E59AA@gmx.net>, Per Kistler  <kistler@gmx.net> wrote:
>close STDIN;
>close STDOUT;

This is bad practice, because many commands will deliver a
segmentation fault or other error if you exec them with STDIN or
STDOUT closed.  It is much safer to redirect to /dev/null.


>        POSIX::setsid();  # This detaches it completely

I think setsid() is unnecessary in this context.  It is to prevent
signals sent by the controlling terminal from being delivered to the
background job.  But the web server presumably doesn't have a
controlling terminal anyway.



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

Date: Sat, 14 Oct 2000 11:16:25 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: split problem
Message-Id: <mbudash-914548.11162514102000@news.pacbell.net>

In article <39e89f53.44d$16b@news.op.net>, mjd@plover.com (Mark-Jason 
Dominus) wrote:

> In article <39E87F5E.36461E36@ihug.com.au>,
> Neo James Crum  <stphw@ihug.com.au> wrote:
> >The problem I face is how to get split to ignore the comma inside the
> >quotation marks. 
> 
> That's actually a Frequently Asked Question (lots of people deal with
> CSV data) and the usual answer is that you should get a copy of the
> Text::CSV module (which you can find at search.cpan.org) and use that;
> it'll probably be more robust than whatever you put together yourself.
> 
> The FAQ list probably has more information; take a look.
> 

akternatively, he could skip the trip to CPAN by using Test::ParseWords, 
part of the standard perl distribution. i use it often for just this 
task...

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Sat, 14 Oct 2000 18:39:51 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: split problem
Message-Id: <39e8a876.5bc$20a@news.op.net>
Keywords: hostler, potential, salvageable, stratify

In article <mbudash-914548.11162514102000@news.pacbell.net>,
Michael Budash  <mbudash@sonic.net> wrote:
>akternatively, he could skip the trip to CPAN by using Test::ParseWords, 

                                                        Text::ParseWords

Thanks very much.  I had completely forgotten about Text::ParseWords.



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

Date: Sat, 14 Oct 2000 11:41:31 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: split problem
Message-Id: <mbudash-5C6E45.11413114102000@news.pacbell.net>

In article <39e8a876.5bc$20a@news.op.net>, mjd@plover.com (Mark-Jason 
Dominus) wrote:

> In article <mbudash-914548.11162514102000@news.pacbell.net>,
> Michael Budash  <mbudash@sonic.net> wrote:
> >akternatively, he could skip the trip to CPAN by using Test::ParseWords, 
> 
>                                                         Text::ParseWords
> 
> Thanks very much.  I had completely forgotten about Text::ParseWords.
> 

my pleasure
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Sat, 14 Oct 2000 20:04:01 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: split problem
Message-Id: <x7r95jur4g.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:


  G> $in = '234,tree,"Smith, John",6834';

typical moronzilla crap code. try it with

'234,tree,"Smith,John",6834';

  G> $in =~ s/, /© /;

not every quoted comma has trailing blanks.

use a CSV module for proper parsing of this. it works for ALL cases and
not some typical case moronzilla likes.

  G>   if ($element =~ /©/)
  G>    { $element =~ s/©/,/; }

stupid code again. the two regexes can be done as just the second
one. she is not only stupid, but redundantly so. this causes the maxim
to be one moronzilla head is stupider than any two other moron head put
together.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sat, 14 Oct 2000 21:27:36 GMT
From: dtbaker_dejanews@my-deja.com
Subject: tips on installing Image::Magick ?
Message-Id: <8saj44$6ne$1@nnrp1.deja.com>

I need to do some image re-sampling and manipulation... and it looks
like the module Image::Magick will fill the bill. However, I am not very
familar with installing the optional modules. The instructions seem to
be mostly designed for UNIX, and assume you have root privs.

I would like to know if there is a tutorial that might walk thru the
installs on both a local windows98 PC, and a remote UNIX domain host
where I do NOT have root privs and would have to install to my
mydomain/cgi-bin/ImageMagick dir or something like that.

I poked around usenews for a while and found a number of threads on
using Image::Magick by good guys like Randall, but I didnt see any
installation tutorials for the "module newbie".

thanx,

Dan


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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