[14066] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1476 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 24 09:14:30 1999

Date: Wed, 24 Nov 1999 06:06:44 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943452404-v9-i1476@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 24 Nov 1999     Volume: 9 Number: 1476

Today's topics:
    Re: Archive::Tar Sending File to Browser? (Abigail)
    Re: Assigning a Match to a Scalar (Bart Lateur)
    Re: Best book on Perl (John McNamara)
    Re: Best book on Perl (Arved Sandstrom)
    Re: Best book on Perl (David Cantrell)
    Re: Charts (Martien Verbruggen)
        Curses (Perl Vision) on Win32 <denis@jagor.srce.hr>
    Re: DBI questions (memory, signals) (Jani Lahti)
        execute hidden form within perl cgi script funnyface@bigfoot.com
    Re: execute hidden form within perl cgi script <tony_curtis32@yahoo.com>
    Re: filehandles and access symbols (Abigail)
    Re: filehandles and access symbols (Abigail)
    Re: getlogin() <paul.walker@st.com>
        Help : Separate source file for some subroutines (Jason)
    Re: Help : Separate source file for some subroutines (Lars Gregersen)
        lex, yacc perl ports <wlhst6+@pitt.edu>
        Merging files <b.m.ovregard@shell.no>
    Re: New dialect of perl: xperl (or reinventing perl, or (Bart Lateur)
    Re: New dialect of perl: xperl (or reinventing perl, or (Bart Lateur)
    Re: newbie PERL question <BurtHwangSPAMSUCKS@SPAMSUCKS.ufsltd.com>
    Re: Percentages Question (David Cantrell)
        Perl as daemon? <erik@visionarynet.com>
    Re: Perl as daemon? (Martien Verbruggen)
    Re: Perl as daemon? <jim.mosier@usa.net>
        Please help... a problem with Perl & MySQL!! <breville@mpce.mq.edu.au>
    Re: Portuguese Whaling Songs <gellyfish@gellyfish.com>
    Re: Portuguese Whaling Songs <roman.stawski@fr.adp.com>
    Re: Portuguese Whaling Songs <gellyfish@gellyfish.com>
    Re: Reading a here-document? <gellyfish@gellyfish.com>
        reg expr question <di5majo@my-deja.com>
        Regex question: character that might have accents or di (Jed Parsons)
        sprintf help esalmon@packet.net
    Re: sprintf help (Simon Cozens)
    Re: Test for eval() without using eval() ?? <gellyfish@gellyfish.com>
        Using an XSUB module for Perl 5.001 <abraham_pagulayan@sbphrd.com>
    Re: using regex to extract data (Abigail)
    Re: write(FILEHANDLE) ??? <rzijp@dds.nl>
    Re: Writing Modules (Michael Houghton)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 24 Nov 1999 07:34:26 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Archive::Tar Sending File to Browser?
Message-Id: <slrn83nqh6.m2v.abigail@alexandra.delanet.com>

WDDobbs (wddjr@mediaone.net) wrote on MMCCLXXVI September MCMXCIII in
<URL:news:383B6440.F88D7994@mediaone.net>:
$$ 
$$ When I am in the browser (netscape), I get a save file dialog but he
$$ file name is always the name of my perlscript (perlscript.pl) by
$$ default.  How do I get the desired filename to be the default in the
$$ save dialog?  If I rename the default to temp.tar, and then use winzip,
$$ I am able to read the archive.

You would change the sources of Netscape, and then you recompile.
Your problem isn't a Perl problem, but a browser one.



Abigail
-- 
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail


  -----------== 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, 24 Nov 1999 13:48:28 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Assigning a Match to a Scalar
Message-Id: <383fec58.8671339@news.skynet.be>

lee.lindley@bigfoot.com wrote:

>I guess it really depends on how confident you are on the format of
>your input data.  But the original request did say "2 or 3 digits
>(price)", which I hear as 2 or 3 digits after the dollar sign, so
>this is a bit better.
>
>$str =~ /\$(\d{2,3})/ 

What about inflation?

-- 
	Bart.


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

Date: Wed, 24 Nov 1999 10:46:36 GMT
From: jmn.ac.delete@abanet.it (John McNamara)
Subject: Re: Best book on Perl
Message-Id: <383bc1f8.11598027@news.eni.it>

On Tue, 23 Nov 1999 16:46:02 -0500, jadapturNOSPAM@hotmail.com (John)
wrote:

>What's the best Book to Learn Perl for the web..

Try "Perl for Portuguese Whalers".

HTH,

John McNamara

-- 


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

Date: Wed, 24 Nov 1999 07:26:26 -0400
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: Best book on Perl
Message-Id: <Arved_37-2411990726260001@dyip-11.chebucto.ns.ca>

In article <383B36A6.AEABAA33@mail.cor.epa.gov>, David Cassell
<cassell@mail.cor.epa.gov> wrote:

> Do *not* buy any book with the word 'dummies', 'unleashed',
> or 'idiot' if you really want to learn some Perl.
> 
So "Idiots Unleashed on Perl, Vol.2: Mastering Perl CGI for Dummies, with
foreword by Jorge Soares, author of 'Reminiscences of the Ice Blink:
Portuguese Whaling Songs of the Labrador Sea'" would be a bad idea?

Arved Sandstrom


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

Date: Wed, 24 Nov 1999 11:59:01 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Best book on Perl
Message-Id: <383bd284.485828@10.0.0.155>

On 23 Nov 1999 22:18:06 -0500, Uri Guttman <uri@sysarch.com> said:

>>>> ... "Elements of Programming with Perl" by Andrew Johnson ...
>
>it is hard to judge a book aimed at non-programmers when we are all (i
>hope) experienced hackers ...

Which is why Croydon Perl Mongers has found a complete newbie to
review it.  Book hasn't arrived yet though, and I'm not going to
pester her for her review for at least a month after it does.

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: 24 Nov 1999 09:56:07 GMT
From: mgjv@localhost.localdomain (Martien Verbruggen)
Subject: Re: Charts
Message-Id: <slrn83ndjg.f5b.mgjv@localhost.localdomain>

On Wed, 24 Nov 1999 07:34:59 GMT,
	Jason L. James <jasonj@rwdata.co.uk> wrote:
> >mirak63@yahoo.com writes:
> >
> >> Hello, 
> >> 
> >> Are there any PERL modules that provide for the development of Charts
> >> or Graphs?
> >> 
> >> I've been looking all over and can't find anything.
> 
> You could try GD.pm and GIFgraph.pm, both are avilable 
> from cpan.org.  However, there seems to be a bit of a
> problem there because the latest version of GD does not
> support GIF files, and yet GIFgraph must us GD to draw
> it graphs.  If you can get hold of an old version of GD that does
> support GIF files that you should have no problems.

Steve Bonds has released Chart::PNGgraph while I'm working on a better
solution. It's basically GIFgraph rewritten to work with the new
versions of GD, and also to make use of some of the newer features.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | That's not a lie, it's a
Commercial Dynamics Pty. Ltd.   | terminological inexactitude.
NSW, Australia                  | 


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

Date: Wed, 24 Nov 1999 10:19:21 +0100
From: "Denis Stancer" <denis@jagor.srce.hr>
Subject: Curses (Perl Vision) on Win32
Message-Id: <81gaod$7ht$1@bagan.srce.hr>

Is there a way to make Perl Vision work under Win32?

It uses Curses module, which has to be compiled ,and I do not have a
compiler.

Is there precompiled Curses module for Win32 (Activestate has nothing)?
Is it possible to adjust PV to work with Win32-Console?


--
Denis Stancer
<Denis.Stancer@gamma.CARNet.hr>






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

Date: 24 Nov 1999 12:51:03 GMT
From: ace@XX-iki.fi (Jani Lahti)
Subject: Re: DBI questions (memory, signals)
Message-Id: <81gmvn$emh$1@baker.cc.tut.fi>

>Jani Lahti wrote:
>>> When I open a DBI connecion to Oracle, my script grows by 3MB.
>
>On Fri, 19 Nov 1999 16:51:46 -0700, Ron Reidy <rereidy@uswest.net> wrote:
>>The size of the script grows not because of some added data structs used by
>>DBI/DBD, but because of the inclussion of the Oracle libraries.  This would
>>happen regardless of language used (i.e. Perl, C/C++, php3, etc.).

Doh! Somehow I completely forgot that. In C I can see the Oracle
libraries being included, but - in Perl - the use of 'use DBI' hides
that. My mistake.

But how about that signal stuff, anybody:
> I also noticed that previously I could stop the scripts with ^C, [...]


jsd@gamespot.com (Jon Drukman) writes:
>If you're worried about multiple copies of your script snarfing
>memory, you have two choices:
>
>1: don't worry about it so much. 2: rearrange your system 3: add more memory.

Good points all three. I have 256M memory, so it's enough for the
scripts now running. But even then I wouldn't want to 'waste' it.
Option 2 (utilizing shared memory, perhaps) may be worth consider-
ing if and when the amount of script instances increases.


Jonathan Stowe writes:
> Also bear in mind that if you have the database server running on the
> same machine then you are likely to have some bastarding great processes
> already

We have a dedicated DB server with some nifty pieces of hardware,
and I'm lucky enough not to have to administer it..:)

Thanks, all of you.

//jani

--
jani.lahti@XX-iki.fi  --  http://www.iki.fi/jani.lahti/  -- 050 345 0030
          Todelliset kunniamerkit näkyvät vain saunassa. -- T.Rautavaara


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

Date: Wed, 24 Nov 1999 13:34:06 GMT
From: funnyface@bigfoot.com
Subject: execute hidden form within perl cgi script
Message-Id: <81gpgf$oeu$1@nnrp1.deja.com>

I have a form passing two parameters to a perl cgi script which is
working. I am adding a third parameter, which if present, will run a
new hidden form within the script (to subscribe to a newsletter).

I've set up my "if" statement to test if the third parameter is
present, written my "print <form action" statement and my
various "print <input lines", and then come to the submit line, which
in html completes the process. What do I use here instead? Or, if I
need the submit line, how do I get it to execute?

Thanks.


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


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

Date: 24 Nov 1999 13:45:50 +0000
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: execute hidden form within perl cgi script
Message-Id: <wkogckove9.fsf@yahoo.com>

funnyface@bigfoot.com writes:

> I have a form passing two parameters to a perl cgi script which is
> working. I am adding a third parameter, which if present, will run a
> new hidden form within the script (to subscribe to a newsletter).

Hmmm, that doesn't make much sense to me.  The FORM
is for user (whatever "user" means) interaction.  If
it's hidden, what's the point of it?

What you probably want is...

> I've set up my "if" statement to test if the third parameter is
> present, written my "print <form action" statement and my
> various "print <input lines", and then come to the submit line, which
> in html completes the process. What do I use here instead? Or, if I
> need the submit line, how do I get it to execute?

 ... to perform a GET/POST operation from within the
script to a different server.  That would make
sense.

  perldoc LWP
  perldoc HTTP::Request

spills the beans (are we allowed to say "beans" in a
non-java group? :-)

If you want help/advice with code, then you'll have
to post it here, or at least the relevant bits of
it.

hth
tony


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

Date: 24 Nov 1999 07:38:59 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: filehandles and access symbols
Message-Id: <slrn83nqpm.m2v.abigail@alexandra.delanet.com>

Max (junkmail@kenobiz.com) wrote on MMCCLXXVI September MCMXCIII in
<URL:news:383b6884.33435438@news.acronet.net>:
== is there anyway that i can open a file just once to read it and then
== overwrite its contents?
== open(BLAH,"+>blah.txt")   erases the file contents before i even get
== to read it and.....
== open(BLAH,"+<blah.txt")  allows me to read but only APPEND the data
== that i write to it

No, it doesn't. Use seek().

== what i am writing to the file is simply a number that will be
== incremented by 1 every time the script is run
== any solutions are gladly welcome

Ah, the infamous evil netlag creating counter. IIRC, there's a module
for that on CPAN.


Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


  -----------== 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: 24 Nov 1999 07:39:46 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: filehandles and access symbols
Message-Id: <slrn83nqr6.m2v.abigail@alexandra.delanet.com>

Rick Delaney (rick.delaney@home.com) wrote on MMCCLXXVI September
MCMXCIII in <URL:news:383B794B.B7473360@home.com>:
!! [posted & mailed]
!! 
!! Max wrote:
!! > 
!! > open(BLAH,"+<blah.txt")  allows me to read but only APPEND the data
!! > that i write to it
!! 
!! Nonsense.
!! 
!! perldoc -f seek
!! perldoc perlopentut


I checked the latter. It doesn't seem to mention seek when using +< open.



Abigail
-- 
perl -e 'for (s??4a75737420616e6f74686572205065726c204861636b65720as?;??;??) 
             {s?(..)s\??qq \?print chr 0x$1 and q ss\??excess}'


  -----------== 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, 24 Nov 1999 10:11:36 +0000
From: Paul Walker <paul.walker@st.com>
Subject: Re: getlogin()
Message-Id: <383BB9D8.A624734F@st.com>

"Brett W. McCoy" wrote:

> >Quick question - getlogin() is limited to returning 8 characters for a
> >username. Is that because the OS only returns 8 characters, or just a
> >limitation for some other reason?
> Where does it say that it is limited 8 characters, and on what OS?

The copy of "Teach yourself perl" that I'm using (since it's the closest
thing we have to a handy reference!). Doesn't specify what OS, but we're
using Solaris. If someone could check how many it returns under NT, that
would be much appreciated. :-)

Thanks,

Paul
(Must get around to adding a .sig)


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

Date: Wed, 24 Nov 1999 09:17:58 GMT
From: ancient_97@yahoo.com (Jason)
Subject: Help : Separate source file for some subroutines
Message-Id: <383babf3.8276429@news.singnet.com.sg>

Hi.

	I need some help on how to :
	Keep my subroutines into a separate source file so that my main
script does not show subroutine declarations.
	I tried using USE but it doesn't seem to work.




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

Date: Wed, 24 Nov 1999 10:15:06 GMT
From: lg@kt.dtu.dk (Lars Gregersen)
Subject: Re: Help : Separate source file for some subroutines
Message-Id: <383bba13.7134285@news.dtu.dk>

On Wed, 24 Nov 1999 09:17:58 GMT, ancient_97@yahoo.com (Jason) wrote:

>Hi.
>
>	I need some help on how to :
>	Keep my subroutines into a separate source file so that my main
>script does not show subroutine declarations.
>	I tried using USE but it doesn't seem to work.

H!

use works. You just have to do it right. Read on how to make modules
in your favourite text book on Perl. Also see the docs that comes with
Perl. perlmod seems a nice place to look.

In the future, if you want in solid advice from writing in this group
then be more specific about what you have tried to code. What you
intend the code to do and how it fails to do so. Also mentioning any
error messages you see is a good thing.

  Lars

 ------------------------------
Lars Gregersen (lg@kt.dtu.dk)
http://www.gbar.dtu.dk/~matlg


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

Date: Wed, 24 Nov 1999 08:48:11 -0500
From: "W. Lyle Hayhurst" <wlhst6+@pitt.edu>
Subject: lex, yacc perl ports
Message-Id: <Pine.GSO.3.96L.991124084737.1492B-100000@unixs4.cis.pitt.edu>


Does perl have any mods for these two standard
programs?  I searched cpan and didn't come up
with anything.

Thanks,
Lyle



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

Date: Wed, 24 Nov 1999 13:39:33 +0100
From: Magne Oevregaard <b.m.ovregard@shell.no>
Subject: Merging files
Message-Id: <383BDC85.E9927CB7@shell.no>

Hi all,

I have made a perl script to merge to ascii listings.
I used a "while loop within a while loop" to test on conditions
within the second file, and extracted a field from it.
The script scans the complete second file for each line in the first
file.
The script works, but it's slow.

Could any of you suggest other ways of doing this. witch speeds up
things?.

Thanks
Magne



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

Date: Wed, 24 Nov 1999 13:48:23 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: New dialect of perl: xperl (or reinventing perl, or perl-izing jpython)
Message-Id: <383eeab7.8253799@news.skynet.be>

Abigail wrote:

>With OO perl, there's just one living room for each object. The entire
>tree of inherited classes all share the same livingroom.

That could easily be fixed, if everybody were to use a class specific
prefix for it's fields names. An already familiar convention would be to
use the same format as for package variables: the package name, plus
'::', as a prefix. So if there's a 'thing' in package Foo, and a 'thing'
in package 'Bar', you can make the class' anonymous hash into:

	{ 'Foo::thing' => 3, 'Bar::thing' => 17 }

I'm supposing that class "Foo" is the only supplier of existing fields
with the "Foo::" prefix. 'Bar' is a subclass.

>Again, a comparison with non-OO Perl:
>
>    package foo;
>    $scalar = 3;
>
>    package bar;
>    $scalar = 17;
>
>    package foo;
>    print $scalar;   # Prints 3.

>Sure, from package bar you can change $scalar in package foo. But it is
>*not* the default, and you do *not* have to do extra work to avoid
>accidently overwriting data outside of your logical unit. You have to do
>work to overwrite such data - a willingly act. 

Perhaps the following code snippet goes into the right direction. It
uses the 'package name prefix' convention as above, but it uses the tied
hash mechanism, as an intermediator between the user interface and the
real data hash. Granted, I haven't attempted to use it in a class
hierarchy (that would only blur the important matter ;-).

The main disadvantage is that the package lookup happens at runtime, so
there's a speed penalty, and there can be no compile-time check.

It's a standalone script.

    #! perl -w
    tie %hash, 'Qualified::Hash';

    $hash{foo} = "value set in 'main'";

    package Foo;
    $main::hash{foo} = "value set in 'Foo'";

    package Bar;
    $main::hash{foo} = "value set in 'Bar'";
    print "'Foo::foo' in 'Bar': $main::hash{'Foo::foo'}\n";
    print "plain 'foo' in 'Bar': $main::hash{'foo'}\n";

    package main;
    $\ = "\n";
    print 'Available keys: ', join ', ', keys %hash;


    package Qualified::Hash;
    sub TIEHASH {
        my $class = shift;
        my %hash; @hash{@_} = ();
        return bless \%hash;
    }

    sub FETCH {
        my($self, $key) = @_;
        return $self->{$key=~/::/?$key:
          do {my($cpkg) = caller; "$cpkg\::$key"}};
    }

    sub STORE {
        my($self, $key, $value) = @_;
        $self->{$key=~/::/?$key:
          do {my($cpkg) = caller; "$cpkg\::$key"}} = $value;
    }

    # "borrowed" from Tie::StdHash (in Tie::Hash) :-) :
    sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} }
    sub NEXTKEY  { each %{$_[0]} }

__END__
'Foo::foo' in 'Bar': value set in 'Foo'
plain 'foo' in 'Bar': value set in 'Bar'
Available keys: Foo::foo, Bar::foo, main::foo

-- 
	Bart.


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

Date: Wed, 24 Nov 1999 13:48:26 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: New dialect of perl: xperl (or reinventing perl, or perl-izing jpython)
Message-Id: <383dea43.8137688@news.skynet.be>

Abigail wrote:

>no
>lexical scoped 'array', and if you type 'arrya', it's not even a run
>time error. You can use all the -w and use stricts you want, all you
>get is mysterious behaviour. Sure, sure, sure, you can put in extra
>checks. But that's something I want from the *language*, after all,
>that's what "use strict" is doing for me for non-OO.

I've done a little exercise using tied hashes, which could help.

It gives a runtime error whenever you attempt to get or set a value in
this hash for which the key hash not been "registered" (i.e. the key
exists). It's still a run-time, not a compile-time check, so it may take
a (long) while for it to fail on typos in key names: days, perhaps even
forever.

It's a minimalistic implementation: no methods that aren't needed in the
demo.

    #! perl -w

    tie %hash, 'Strict::Hash', qw'alpha beta gamma';
    print $hash{alpha} = "alpha got set.\n";
    print $hash{beta} = "beta got set.\n";
    print "fetch alpha: ", $hash{alpha};

    print $hash{typo} = "This should fail";


    package Strict::Hash;
    sub TIEHASH {
        my $class = shift;
        my %hash; @hash{@_} = (); 
        return bless \%hash;
    }

    sub FETCH {
        my($self, $key) = @_;
        exists $self->{$key} or die 
          sprintf "Key '%s' does not exist at %s line %d.\n", 
          $key, (caller)[1,2];
        return $self->{$key};
    }

    sub STORE {
        my($self, $key, $value) = @_;
        exists $self->{$key} or die 
          sprintf "Key '%s' does not exist at %s line %d.\n", 
          $key, (caller)[1,2];
        $self->{$key} = $value;
    }
__END__
alpha got set.
beta got set.
fetch alpha: alpha got set.
Key 'typo' does not exist at stricthash.pl line 8.

-- 
	Bart.


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

Date: Wed, 24 Nov 1999 08:11:08 -0500
From: "Burt Hwang" <BurtHwangSPAMSUCKS@SPAMSUCKS.ufsltd.com>
Subject: Re: newbie PERL question
Message-Id: <OtR_3.5$M6.139@client>


>Not only that, but people who learn Perl from the kludges
>of random clueless lusers only learn *bad* Perl.  The Dark
>Side of the language, so to speak.  And its attraction is
>strong for those who are weak-minded or not in control of
>their emotions.
>
>I think that the original poster might benefit from buying
>[and reading] Andrew Johnson's runaway best-seller "Elements
>of Programming with Perl."  Soon to be a major motion picture
>starring Jeff Speakman.

I heard the sequel is in the works too.




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

Date: Wed, 24 Nov 1999 12:01:00 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Percentages Question
Message-Id: <383cd359.698093@10.0.0.155>

On 23 Nov 1999 19:37:10 -0600, abigail@delanet.com (Abigail) said:

>    $" = "+";
>    $total = eval "@{[values %votes]}";

Naughty!

{ local $" ...
}

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: Wed, 24 Nov 1999 00:10:51 -0800
From: "Erik Rogers" <erik@visionarynet.com>
Subject: Perl as daemon?
Message-Id: <81g6q2$6jb$1@brokaw.wa.com>

I'm looking for a way to run a perl script as a daemon (detatched from a 
terminal process). Does anyone know of an easy way to do this?

Thanks,

ERIK
--
Erik Rogers <erik@visionarynet.com>                 Visionary Networks



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

Date: 24 Nov 1999 09:54:06 GMT
From: mgjv@localhost.localdomain (Martien Verbruggen)
Subject: Re: Perl as daemon?
Message-Id: <slrn83ndfq.f5b.mgjv@localhost.localdomain>

On Wed, 24 Nov 1999 00:10:51 -0800,
	Erik Rogers <erik@visionarynet.com> wrote:
> I'm looking for a way to run a perl script as a daemon (detatched from a 
> terminal process). Does anyone know of an easy way to do this?


# man perlipc
[snip]
       Complete Dissociation of Child from Parent
[snip]
# perldoc -q daemon | grep =head
=head1 Found in /opt/perl5.00503/lib/5.00503/pod/perlfaq8.pod
=head2 How do I fork a daemon process?
#

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd.   | crops where there ain't no crops.
NSW, Australia                  | 


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

Date: Wed, 24 Nov 1999 13:57:44 GMT
From: "Jim Mosier" <jim.mosier@usa.net>
Subject: Re: Perl as daemon?
Message-Id: <s9S_3.5856$QT2.31851@pm02news>

Erik Rogers <erik@visionarynet.com> wrote in message
news:81g6q2$6jb$1@brokaw.wa.com...
| I'm looking for a way to run a perl script as a daemon (detatched from a
| terminal process). Does anyone know of an easy way to do this?
|
| Thanks,
|
| ERIK
| --
| Erik Rogers <erik@visionarynet.com>                 Visionary Networks
|

Have you considered forking then killing the parent?  Make sure the child
can die thought.  This will allow the child to run somewhat like a daemon
and is very easy to setup.  See the Perl Cookbook recipe 17.11 for a good
example of forking servers.  Consider how you'll communicate to this child
(daemon) too once its running.

use POSIX;
#---------------------------------------------------------------------
# Fork once, Let the parent die
#---------------------------------------------------------------------
$pid = fork;
exit if $pid;
#---------------------------------------------------------------------
# Dissociate the controlling terminal that started us, trap signals
#---------------------------------------------------------------------
POSIX::setsid() || die "Can't start a new session: $!";
$SIG{INT} = $SIG{TERM} = $SIG{HUP} = \&signalHandler;
while( 0 ) {
  do something that will eventually become true.
}
sub signalHandler {
  $time_to_die = 1;
}




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

Date: Thu, 25 Nov 1999 00:45:02 +1100
From: "Brendan Reville" <breville@mpce.mq.edu.au>
Subject: Please help... a problem with Perl & MySQL!!
Message-Id: <81gq9q$l21$1@sunb.ocs.mq.edu.au>

hi everyone,

I am having a problem getting my Perl program to access a MySQL database.
My test program looks like this:

use DBI;

$serverPort = "3308";

$dbh = DBI->connect('dbi:MySQL:Clients;port=$serverPort',
  'mydatabase', 'mypassword');


When I run it with Perl I get the following error:

   install_driver(MySQL) failed: Can't locate DBD/MySQL.pm in @INC (@INC
   contains: <...snipped...>
   Perhaps the DBD::MySQL perl module hasn't been fully installed,
   or perhaps the capitalisation of 'MySQL' isn't right.
   Available drivers: ADO, ExampleP, Proxy, mysql.
   at test.pl line 5


OK that's fine, so I need to change the MySQL to mysql (lowering the
case). So I try this:

use DBI;

$serverPort = "3308";

$dbh = DBI->connect('dbi:mysql:Clients;port=$serverPort',
  'mydatabase', 'mypassword');


But this time I get the following, which is where I get stuck:

   install_driver(mysql) failed: Can't find 'boot_DBD__mysql' symbol in
   /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/mysql/mysql.so
     at (eval 1) line 3

   at test.pl line 5


 ...so, what on earth does this last error mean?

My ISP told me they noticed no problems when they installed the MySQL
module for Perl.  Do any of you have any idea what this error message
means?

any help is hugely appreciated!

- Brendan






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

Date: 24 Nov 1999 09:53:22 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Portuguese Whaling Songs
Message-Id: <383bb592_1@newsread3.dircon.co.uk>

Abigail <abigail@delanet.com> wrote:
> Craig Berry (cberry@cinenet.net) wrote on MMCCLXXVI September MCMXCIII in
> <URL:news:s3mf6ffarrp40@corp.supernews.com>:
> || John (jadapturNOSPAM@hotmail.com) wrote:
> || : Portuguese Whaling Songs
> || : 
> || : Anyone know where I can find info on Portuguese Whaling Songs of the 19th
> || : Century?
> || 
> || On CPAN (Cetacean Portuguese Antique Noodlings), of course!
> 
> 
> Isn't Portugal a bit too far south to have singing whales?
> 

Wasnt there a Disney movie about a Singing Whale that wound up in Italy ?

/J\
-- 
"The most frightening thing on television since Anthea Turner revealed
she had a sister" - Suggs


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

Date: Wed, 24 Nov 1999 11:16:12 +0100
From: Roman Stawski <roman.stawski@fr.adp.com>
Subject: Re: Portuguese Whaling Songs
Message-Id: <383BBAEC.265D2DED@fr.adp.com>

Abigail wrote:
> Craig Berry (cberry@cinenet.net) wrote on MMCCLXXVI September MCMXCIII in
> <URL:news:s3mf6ffarrp40@corp.supernews.com>:
> || John (jadapturNOSPAM@hotmail.com) wrote:
> || : Anyone know where I can find info on Portuguese Whaling Songs of the 19th
> || : Century?
> 
> Isn't Portugal a bit too far south to have singing whales?
 
Oh I don't know - they've always done a lot of singing in South Wales


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

Date: 24 Nov 1999 11:29:57 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Portuguese Whaling Songs
Message-Id: <383bcc35_2@newsread3.dircon.co.uk>

Roman Stawski <roman.stawski@fr.adp.com> wrote:
> Abigail wrote:
>> Craig Berry (cberry@cinenet.net) wrote on MMCCLXXVI September MCMXCIII in
>> <URL:news:s3mf6ffarrp40@corp.supernews.com>:
>> || John (jadapturNOSPAM@hotmail.com) wrote:
>> || : Anyone know where I can find info on Portuguese Whaling Songs of the 19th
>> || : Century?
>> 
>> Isn't Portugal a bit too far south to have singing whales?
>  
> Oh I don't know - they've always done a lot of singing in South Wales

print <<EOCYM;
Gwlad, gwlad, pleidiol wyf i'm gwlad
Tra mor yn fur
I'r bur hoff bau
O bydded i'r heniaith barhau.
EOCYM


/J\
-- 
"Tony Blair. Make it so" - Patrick Stewart


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

Date: 24 Nov 1999 09:17:28 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Reading a here-document?
Message-Id: <383bad28_1@newsread3.dircon.co.uk>

Alan J. Flavell <flavell@mail.cern.ch> wrote:
> On Tue, 23 Nov 1999, Larry Rosler wrote:
> 
>> Why bother with the array then?  Just put the list in the foreach 
>> directly:
>> 
>> foreach (split /\n/, <<EOD) { _process_record_ }
>> ...
>> ...
>> EOD
> 
> Erm, (shuffles feet), yes...  well, actually _process_record_
> was a whole lump of code, previously within that 
> while (<FILE>) { ... } block, and I couldn't at first see how
> the syntax worked for that.
> 
> I think I've muddled my way through to understanding that 
> the syntax would go like this:
> 
> foreach (split /\n/, <<EOD) {
> eins
> zwei
> drei
> EOD
> 
>    _process_record_
> 
> }
> 
> and not vice versa.  (Yes: a noddy test prog executes OK).
> 

Also if you want to process the data in the file in the same loop as the
stuff you are inserting you could insert a rather horrid looking

  @{[<FILE>]}

in your heredoc (assuming the data isnt too large and that FILE is
your open file handle ...

/J\
-- 
"It's times like this I wish I had a penis" - Duckman


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

Date: Wed, 24 Nov 1999 08:51:33 GMT
From: Magnus Johansson <di5majo@my-deja.com>
Subject: reg expr question
Message-Id: <81g8ul$dmv$1@nnrp1.deja.com>

If I want to check if a text only contains characters a-z how should I
do then?


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


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

Date: 24 Nov 1999 00:03:16 GMT
From: jed@socrates.berkeley.edu (Jed Parsons)
Subject: Regex question: character that might have accents or diacritics
Message-Id: <81fa04$87n$1@nntprelay.berkeley.edu>

Greetings,

Here's a quickie for the regexperts.

If $string="K\xF6nig" and $pattern="Kon", I would like to have 

	print $string if ($string =~ /$pattern/);

return $string.  In other words, I would like not to have to specify
accents and diacritics in my search pattern, but still have any characters
in that pattern match all possible accented versions. 

Is there a clever way to do this with locale?

Thanks for any advice,

Jed
-- 
Jed Parsons : mailto:jed@socrates.berkeley.edu  
            : http://socrates.berkeley.edu/~jed/
--------------------------------------------------------------------------
              use Curses;initscr;for(;;){$f=($f+10)%360;clear;grep(do{$i=$


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

Date: Wed, 24 Nov 1999 07:06:56 -0500
From: esalmon@packet.net
Subject: sprintf help
Message-Id: <383BD4E0.1A76@packet.net>

How would I round up a scallar using the sprintf format?


Exmp:

	$weight = 2.25
	$rounded_up = sprintf("?????", $weight);

$weight should = 3


Please reply to email: esalmon@packet.net


  -----------== 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: 24 Nov 1999 12:21:48 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: sprintf help
Message-Id: <slrn83nm2s.gfs.simon@othersideofthe.earth.li>

esalmon@packet.net (comp.lang.perl.misc):
>How would I round up a scallar using the sprintf format?
>	$weight = 2.25
>	$rounded_up = sprintf("?????", $weight);
>$weight should = 3

perldoc -q round

Makes you think the FAQ was written for a reason, doesn't it?

>Please reply to email: esalmon@packet.net

Ask a question in public, check for answers in public. USENET etiquette.

-- 
Feel free to contact me (flames about my english and the useless of this
driver will be redirected to /dev/null, oh no, it's full...).
(Michael Beck, describing the PC-speaker sound device)


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

Date: 24 Nov 1999 10:19:32 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Test for eval() without using eval() ??
Message-Id: <383bbbb4_1@newsread3.dircon.co.uk>

lee.lindley@bigfoot.com wrote:
> Matt Kruse <mkruse@rens.com> wrote:
> 
> :>kevin montuori <montuori@acs.neu.edu> wrote in message
> :>news:yge7lj9ozi4.fsf@spot.acs.neu.edu...
> :>> i think you're a bit confused: web servers do not disable perl
> :>> commands; web servers and perl interpreters are not related
> :>> entities.  one can turn on (or off) the server side includes
> :>> directive "eval" on a netscape enterprise server -- perhaps
> :>> this is what you mean?
> 
> :>No, I'm not confused. I've been doing this stuff for 6 years. This is the
> :>first time that I've encountered crippled versions of Perl on a web server,
> :>though.
> 
> :>There are sites that exist that have a "crippled" version of perl running
> :>for CGI scripts. I'm not sure how they accomplish it, and I'm not sure how
> :>it works. All I know is that I've had a number of people tell me that a
> :>script won't run because Perl will not do eval() or system() or back-ticks
> :>with CGI scripts on their server. It's odd, yes. Makes no sense to me. I was
> :>just wondering if there was a way to check for this situation within the
> :>limits of the environment.
> 
> OK.  You know what you are doing. Humor me.  Tell me that these
> people are not reporting a symptom of a script run under
> taint mode that isn't taint free.  (Forgive the double negative.)
> 
> I can't figure out how to disable eval.  I've only thought about it
> for a little while, but it looks to be non-trivial.  This really
> sounds like taint mode imposed on a script that doesn't play by
> those rules.
> 

A cursory examination would suggest that eval can only be disabled by
patching the source *somehow* and quite honestly I would be concerned
that the resulting executable would be broken in a variety of ways other
than simply disabling some operations.  I would agree that it probably
is a -T supplied to perl from some system (I'm thing of something like
IIS ) that have a central configuration for running scripts - indeed such
a system could well supply -MSafe for instance ...

/J\
-- 
"Pat was wondering if he could put his massive tool in my box" - Mrs
Doyle, Father Ted


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

Date: Wed, 24 Nov 1999 10:43:27 -0000
From: "Abraham" <abraham_pagulayan@sbphrd.com>
Subject: Using an XSUB module for Perl 5.001
Message-Id: <81gfgc$i6o@hbu005.ha.uk.sbphrd.com>

Hello,

We have a production system running on Perl 5.001.  I have written an XSUB
module which runs perfectly well on the latest version of Perl.

However, I need this module to work on the production system.  When I tried
using the "use lib <directory name>'  statement I receive this error
======================================
Can't locate lib.pm in @INC at abetest line 5.
BEGIN failed--compilation aborted at abetest line 5.
======================================

So I tried using BEGIN unshift @INC, <directory name> and this time I
receive the errors below instead.

Is there a way of using a package in Perl 5.001?

Any suggestions will be most welcome.

Thanks.

Abraham

=============================================
Global symbol "EXPORT" requires explicit package name at
/home/pagulaac/mylib/dm
apilib.pm line 14.
Global symbol "VERSION" requires explicit package name at
/home/pagulaac/mylib/d
mapilib.pm line 17.
Global symbol "AUTOLOAD" requires explicit package name at
/home/pagulaac/mylib/
dmapilib.pm line 25.
Global symbol "AUTOLOAD" requires explicit package name at
/home/pagulaac/mylib/
dmapilib.pm line 29.
Global symbol "AUTOLOAD" requires explicit package name at
/home/pagulaac/mylib/
dmapilib.pm line 36.
Global symbol "AUTOLOAD" requires explicit package name at
/home/pagulaac/mylib/
dmapilib.pm line 37.
Global symbol "VERSION" requires explicit package name at
/home/pagulaac/mylib/d
mapilib.pm line 40.
 at abetest line 6.
BEGIN failed--compilation aborted at abetest line 6.
============================================


--
The opinions expressed in this communication are my own, and do not
necessarily reflect those of my employer.




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

Date: 24 Nov 1999 07:32:56 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: using regex to extract data
Message-Id: <slrn83nqec.m2v.abigail@alexandra.delanet.com>

Martien Verbruggen (mgjv@comdyn.com.au) wrote on MMCCLXXVI September
MCMXCIII in <URL:news:O5L_3.529$6Y1.6324@nsw.nnrp.telstra.net>:
~~ 
~~ You could use the flipflop operator:
~~ 
~~ my @d;
~~ while(<DATA>)
~~ {
~~ 	next unless (/^Date and Time: Thu Oct 14 08:12:00 1999/ .. 0);
~~ 	push @d, (/^Description\s+:\s(.+)$/);
~~ }

Yeah, but that's suboptimal because you keep doing the test, even after
it became false. Furtermore, you're using a regex for an exact match.

    <DATA> untill $_ eq "Date and Time: Thu Oct 14 08:12:00 1999\n";
    push @d => /^Description\s+:\s(.+)$/ while <DATA>;



Abigail
-- 
$" = "/"; split $, => eval join "+" => 1 .. 7;
*{"@_"} = sub  {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


  -----------== 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, 24 Nov 1999 09:15:14 +0100
From: "Robbert Zijp" <rzijp@dds.nl>
Subject: Re: write(FILEHANDLE) ???
Message-Id: <383b9eb8$0$17040@reader3.casema.net>

Well, it isn't.

open (RPT1FILE, ">Whateverthefileiscalled.maybeanextension");
print RPTFILE "blablabla";

Robbert

hmpeak8352@my-deja.com heeft geschreven in bericht
<81ffbl$s3l$1@nnrp1.deja.com>...
>When I use
>
>  write(RPT1FILE);
>
>where RPT1FILE is a file handle, I get the
>following error message :
>Undefined format "main::RPT1FILE" called ...
>I thought this was the right syntax to use for
>writing to a file.
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.




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

Date: 24 Nov 1999 08:48:43 -0500
From: herveus@Radix.Net (Michael Houghton)
Subject: Re: Writing Modules
Message-Id: <81gqbr$127$1@saltmine.radix.net>

Howdy!

In article <kushfij6v2q.fsf@bottom.bu.edu>,
Scott Lanning  <slanning@bu.edu> wrote:
>davidwaters@bigfoot.com (David Waters) writes:
>> Can anyone give me some tips please on how I go about writing a Perl
>> module. Most of the standard documentation that I've come across is
>> useless and doesn't explain the steps required to create a module.
>
>Bah...
>'perldoc perlmod', 'perldoc Exporter', 'perldoc perlmodlib',
>'perldoc -f use'
>
and 'perldoc ExtUtils::MakeMaker'

yours,
Michael
-- 
Michael and MJ Houghton   | Herveus d'Ormonde and Megan O'Donnelly
herveus@radix.net         | White Wolf and the Phoenix
Bowie, MD, USA            | Tablet and Inkle bands, and other stuff
                          | http://www.radix.net/~herveus/


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

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


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