[25246] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7491 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 7 18:05:36 2004

Date: Tue, 7 Dec 2004 15:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 7 Dec 2004     Volume: 10 Number: 7491

Today's topics:
        Dynamic Search Tool <newsgroups@xtracold.co.uk>
        Dynamic Search Tool <newsgroups@xtracold.co.uk>
        Dynamic Search Tool <newsgroups@xtracold.co.uk>
        Dynamic Search Tool <newsgroups@xtracold.co.uk>
        examples using PDF::Template <botfood@yahoo.com>
    Re: Generate Squential Numbers? <gobeyondgobeyond@Rem0ve.Yahoo.com>
    Re: Generate Squential Numbers? <1usa@llenroc.ude.invalid>
    Re: How to detect an undefined SV* value in XS? <usenet@morrow.me.uk>
    Re: How to detect an undefined SV* value in XS? xhoster@gmail.com
    Re: How to detect an undefined SV* value in XS? <tassilo.von.parseval@rwth-aachen.de>
    Re: HTML2JPEG <romm@empire.tau.ac.il>
        I'm interesting to install some free database on Window <tanja@verso.co.izbaciovo>
    Re: I'm interesting to install some free database on Wi <daveandniki@ntlworld.com>
    Re: I'm interesting to install some free database on Wi <1usa@llenroc.ude.invalid>
    Re: I'm interesting to install some free database on Wi <segraves_f13@mindspring.com>
    Re: Is this possible in perl? <mikael@ebi.ac.uk>
    Re: Is this possible in perl? <gifford@umich.edu>
    Re: Monitor a dos console perl program running mluvw47@gmail.com
    Re: Monitor a dos console perl program running mluvw47@gmail.com
    Re: New comp.lang.perl.misc mirror site at lampforums.o <jkeen_via_google@yahoo.com>
        perl DBI - can I send multiple updates at once? <lardattardisdoteddotacdotuk@mailinator.com>
    Re: perl DBI - can I send multiple updates at once? <craig@codenation.net>
    Re: perl DBI - can I send multiple updates at once? xhoster@gmail.com
    Re: Perl open(). Inserting data into a file <jds@atavailcheck.com>
        perl port to my m68k calculator bulk88@hotmail.com
        PerlCom Replacements <not@home.net>
    Re: Question on loops and return values <abigail@abigail.nl>
    Re: References and scope. <tadmc@augustmail.com>
    Re: RegExp Help <sbryce@scottbryce.com>
    Re: Trouble Passing Array Containing Hash to Subroutine <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 7 Dec 2004 11:22:16 -0800
From: "xtracold" <newsgroups@xtracold.co.uk>
Subject: Dynamic Search Tool
Message-Id: <1102447336.378241.124500@f14g2000cwb.googlegroups.com>

Hi folks,

I've been dabbling with Perl for some weeks now to build some tools for
use at work. I'm now looking to produce a simple search tool that will
extract a list of variable names from a given file (or set of files)
then dynamically sort this list of names as a user enters a search
string. It will be incorporated into a small Tk application that i'm
working on and at the moment I envisage using an entry field with each
keystroke bound to a reqexp match routine which repopulates the
displayed list from the master list on each key stroke.

Now, simply put, has anyone ever attempted this before? I'm concerned
that the binding to a key stroke event on the entry field will not
produce very fast results.

Thanks in advance for any advice

XC



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

Date: 7 Dec 2004 11:22:33 -0800
From: "xtracold" <newsgroups@xtracold.co.uk>
Subject: Dynamic Search Tool
Message-Id: <1102447353.558047.318080@z14g2000cwz.googlegroups.com>

Hi folks,

I've been dabbling with Perl for some weeks now to build some tools for
use at work. I'm now looking to produce a simple search tool that will
extract a list of variable names from a given file (or set of files)
then dynamically sort this list of names as a user enters a search
string. It will be incorporated into a small Tk application that i'm
working on and at the moment I envisage using an entry field with each
keystroke bound to a reqexp match routine which repopulates the
displayed list from the master list on each key stroke.

Now, simply put, has anyone ever attempted this before? I'm concerned
that the binding to a key stroke event on the entry field will not
produce very fast results.

Thanks in advance for any advice

XC



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

Date: 7 Dec 2004 11:22:47 -0800
From: "xtracold" <newsgroups@xtracold.co.uk>
Subject: Dynamic Search Tool
Message-Id: <1102447367.370595.126850@f14g2000cwb.googlegroups.com>

Hi folks,

I've been dabbling with Perl for some weeks now to build some tools for
use at work. I'm now looking to produce a simple search tool that will
extract a list of variable names from a given file (or set of files)
then dynamically sort this list of names as a user enters a search
string. It will be incorporated into a small Tk application that i'm
working on and at the moment I envisage using an entry field with each
keystroke bound to a reqexp match routine which repopulates the
displayed list from the master list on each key stroke.

Now, simply put, has anyone ever attempted this before? I'm concerned
that the binding to a key stroke event on the entry field will not
produce very fast results.

Thanks in advance for any advice

XC



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

Date: 7 Dec 2004 11:22:50 -0800
From: "xtracold" <newsgroups@xtracold.co.uk>
Subject: Dynamic Search Tool
Message-Id: <1102447370.007509.127060@f14g2000cwb.googlegroups.com>

Hi folks,

I've been dabbling with Perl for some weeks now to build some tools for
use at work. I'm now looking to produce a simple search tool that will
extract a list of variable names from a given file (or set of files)
then dynamically sort this list of names as a user enters a search
string. It will be incorporated into a small Tk application that i'm
working on and at the moment I envisage using an entry field with each
keystroke bound to a reqexp match routine which repopulates the
displayed list from the master list on each key stroke.

Now, simply put, has anyone ever attempted this before? I'm concerned
that the binding to a key stroke event on the entry field will not
produce very fast results.

Thanks in advance for any advice

XC



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

Date: 7 Dec 2004 12:50:58 -0800
From: "botfood" <botfood@yahoo.com>
Subject: examples using PDF::Template
Message-Id: <1102452658.908630.130430@z14g2000cwz.googlegroups.com>

I have a possible project I am looking into that is basically creating
a "mail-merge" utility that would chew through a big CSV spreadsheet
and merge the fields into a template to generate a big .pdf document.
The reason the client wants to go .pdf is to have a "print ready"
format.

After poking through CPAN, it looks like PDF::Template and/or
PDF::Create are along these lines.... It is a little unclear to me how
involved it would be to set up the template that I would "merge" into.
There seem to be a LOT of parameters that would need to be set up in a
root document, and I am wondering if there is a reasonably easy way to
do this.

Like...
- Can I take an existing authored .pdf page and clone all the
margins settings and stuff like that?

- Can I author a template with any special tags where I want to plug
in my variable fields?

If you have any tips, tutorials, or examples illustrating these modules
that would help me determine if this is the way to go.... 

TIA,
Dan



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

Date: Tue, 7 Dec 2004 10:23:45 -0600
From: Terry <gobeyondgobeyond@Rem0ve.Yahoo.com>
Subject: Re: Generate Squential Numbers?
Message-Id: <MPG.1c1f950be31d89f39896c5@news.tc.umn.edu>


> Lots of possibilities here,
>  i.e store value in separate file, rather like a hit counter script.

Thanks for the response!  Can you point a few example scripts on how 
this is done?  I am new to programming and new to perl too.  

Terry


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

Date: 7 Dec 2004 18:17:47 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Generate Squential Numbers?
Message-Id: <Xns95B887428E599asu1cornelledu@132.236.56.8>

Terry <gobeyondgobeyond@Rem0ve.Yahoo.com> wrote in 
news:MPG.1c1f950be31d89f39896c5@news.tc.umn.edu:

> 
>> Lots of possibilities here,
>>  i.e store value in separate file, rather like a hit counter script.
> 
> Thanks for the response!  Can you point a few example scripts on how 
> this is done?  I am new to programming and new to perl too.  

I ask again: What have you tried so far? By the way, have you read the 
posting guidelines for this group?

Maybe you have forgotten to look in the FAQ list before posting. The FAQ 
and other documentation are available both on your computer and online.

Hint: Look in perlfaq5 for file locking.

-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Mon, 6 Dec 2004 23:06:46 +0000
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: How to detect an undefined SV* value in XS?
Message-Id: <695f82-kk4.ln1@osiris.mauzo.dyndns.org>


Quoth jl_post@hotmail.com (J. Romano):
> Dear Perl community,
> 
>    I have a problem here and I'm hoping that someone can help.
> 
>    I am writing some XS code, and I need to detect whether a value
> accessed through an SV pointer is defined or undefined.

I *believe* that all you need to do is

SV *sv;

if (sv != &PL_sv_undef) {
    ...
}

 . If I am wrong here I would appreciate correction... :)

Ben

-- 
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk


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

Date: 07 Dec 2004 19:28:47 GMT
From: xhoster@gmail.com
Subject: Re: How to detect an undefined SV* value in XS?
Message-Id: <20041207142847.607$X8@newsreader.com>

Ben Morrow <usenet@morrow.me.uk> wrote:
> Quoth jl_post@hotmail.com (J. Romano):
> > Dear Perl community,
> >
> >    I have a problem here and I'm hoping that someone can help.
> >
> >    I am writing some XS code, and I need to detect whether a value
> > accessed through an SV pointer is defined or undefined.
>
> I *believe* that all you need to do is
>
> SV *sv;
>
> if (sv != &PL_sv_undef) {
>     ...
> }
>
> . If I am wrong here I would appreciate correction... :)

I think you are wrong, but I don't know how to demonstrate it.
I think that PL_sv_undef is only way (out of many) of being undefined.

Xho

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


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

Date: Tue, 7 Dec 2004 21:51:28 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: How to detect an undefined SV* value in XS?
Message-Id: <slrncrc5ug.10q.tassilo.von.parseval@localhost.localdomain>

Also sprach Ben Morrow:

> Quoth jl_post@hotmail.com (J. Romano):
>> Dear Perl community,
>> 
>>    I have a problem here and I'm hoping that someone can help.
>> 
>>    I am writing some XS code, and I need to detect whether a value
>> accessed through an SV pointer is defined or undefined.
>
> I *believe* that all you need to do is
>
> SV *sv;
>
> if (sv != &PL_sv_undef) {
>     ...
> }
>
> . If I am wrong here I would appreciate correction... :)

PL_sv_undef is only a special kind of undef created statically for the
sake of performance and convenience. It has some special properties such
as being read-only and having an artifically high refcount. Devel::Peek
will tell you:

    ethan@ethan:~$ perl -MDevel::Peek
    my $a;
    Dump(undef);
    Dump($a);
    SV = NULL(0x0) at 0x814c5f4
      REFCNT = 2147483625
      FLAGS = (READONLY)
    SV = NULL(0x0) at 0x814cc6c
      REFCNT = 1
      FLAGS = (PADBUSY,PADMY)

Most undefs occuring in Perl code are actually not pointers to
PL_sv_undef but something else. Only undef() and Perl built-ins
documentatedly returning undef will give you this special undefined
value.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Tue, 7 Dec 2004 14:06:19 +0000 (UTC)
From: "Roman M. Parparov" <romm@empire.tau.ac.il>
Subject: Re: HTML2JPEG
Message-Id: <cp4dcr$mv8$1@news.iucc.ac.il>

katja <katja_zina@web.de> wrote:
> How can I convert an Internet-page to a PDF/JPEG-file from a
> Perl-script under Linux? (I would like to make a screenshot from a
> command line).
> Thank you
> Katja

Since every browser for every platform for every user renders the WWW
pages differently, it is unclear whether your task is well-defined, thus
an answer should not be possible. You can download the contents of a web
page as a text file easily. Converting text files on Linux is often
done using wv suite (wvText, wvPDF et al.) which operates installed
converting programs like latex, distill and others through a shell script 
wrapper.

-- 
Roman M. Parparov - NASA EOSDIS project node at TAU technical manager.
Email: romm@empire.tau.ac.il		   http://www.nasa.proj.ac.il/
Phone/Fax: +972-(0)3-6405205 (work),        +972-(0)50-734-18-34 (home)
----------------------------------------------------------------------
The economy depends about as much on economists as the weather does on
weather forecasters.
                -- Jean-Paul Kauffmann


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

Date: Tue, 7 Dec 2004 16:40:12 +0100
From: "Tanja" <tanja@verso.co.izbaciovo>
Subject: I'm interesting to install some free database on Windows 98 and XP. 
Message-Id: <41b5cedd@news.s5.net>

I'm interesting to install some free database on Windows 98 and XP.
Is it Perl + MySql best solution?
What about PHP + MySql, or Borland Interbase, or some IBM data base (don't
now database name)?
Please help me.
Tanja




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

Date: Tue, 07 Dec 2004 19:20:18 GMT
From: "Dave" <daveandniki@ntlworld.com>
Subject: Re: I'm interesting to install some free database on Windows 98 and XP. 
Message-Id: <Snntd.389$Ov4.31@newsfe1-gui.ntli.net>


"Tanja" <tanja@verso.co.izbaciovo> wrote in message 
news:41b5cedd@news.s5.net...
> I'm interesting to install some free database on Windows 98 and XP.
> Is it Perl + MySql best solution?
> What about PHP + MySql, or Borland Interbase, or some IBM data base (don't
> now database name)?
> Please help me.
> Tanja
>
>

It all depends on what you are trying to do with the database, (and what you 
are currently skilled with). Postgresql might also be suitable.

Dave 




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

Date: 7 Dec 2004 18:07:35 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: I'm interesting to install some free database on Windows 98 and XP.
Message-Id: <Xns95B88587E41Dasu1cornelledu@132.236.56.8>

"Tanja" <tanja@verso.co.izbaciovo> wrote in news:41b5cedd@news.s5.net:

> I'm interesting 

Nah, you are not that interesting :)

> to install some free database on Windows 98 and XP.
> Is it Perl + MySql best solution?

All joking aside, however, you are off-topic here. Only you know your 
criteria for what best means. Hence, you need to look at the facilities 
provided by databases to decide which one suits your needs.

There is a huge difference between Windows 98 and XP, by the way.

You might also want to read the documentation for Perl's DBI:

<http://search.cpan.org/~timb/DBI-1.46/>

> What about PHP + MySql

PHP is off-topic here as well.

>, or Borland Interbase, or some IBM data base (don't now database name)

Are you referring to DB2?

> Please help me.

You can help yourself by thinking about what you really need and for what 
purpose.

Also, please read the posting guidelines for this group:

http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.text


-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Tue, 07 Dec 2004 18:43:59 GMT
From: "Bill Segraves" <segraves_f13@mindspring.com>
Subject: Re: I'm interesting to install some free database on Windows 98 and XP.
Message-Id: <PRmtd.9616$714.6647@newsread2.news.atl.earthlink.net>

"Tanja" <tanja@verso.co.izbaciovo> wrote in news:41b5cedd@news.s5.net:
> I'm interesting to install some free database on Windows 98 and XP.
> Is it Perl + MySql best solution?

See IndigoPerl, available free from www.indigostar.com.
--
Bill Segraves






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

Date: Tue, 07 Dec 2004 16:44:34 +0000
From: Mikael Andersson <mikael@ebi.ac.uk>
Subject: Re: Is this possible in perl?
Message-Id: <cp4mlj$bh3$1@helium.hgmp.mrc.ac.uk>

madhav_a_kelkar@hotmail.com wrote:
> Hi all,
> 
>           I am doing XML processing in perl,  i want to read a
> function name from the XML file and call a function with that name at
> runtime. Can I use the "require" statement for it? I was wondering if
> it is possible in perl. Please help me.
> 

You could create A package, lets call it Funcs.pm, and implement all you 
    functions there. And then do something similar to this.

use Funcs;

$toCall ="Funcs::$functionNameFromXML";
&$toCall;

/Mikael


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

Date: Tue, 07 Dec 2004 15:28:48 -0500
From: Scott W Gifford <gifford@umich.edu>
Subject: Re: Is this possible in perl?
Message-Id: <qszeki1x37j.fsf@rygar.gpcc.itd.umich.edu>

madhav_a_kelkar@hotmail.com writes:

> Hi all,
>
>           I am doing XML processing in perl,  i want to read a
> function name from the XML file and call a function with that name at
> runtime. Can I use the "require" statement for it? I was wondering if
> it is possible in perl. Please help me.

You can use eval to do that, but that will allow the XML file to cause
arbitrary code to execute on your machine:

    $func = $xml->get_func_name();
    eval "${func}()";

You can make that a bit more secure by only allowing word characters,
but it will still allow any function on the system to be called.

You can use symbolic references, which will allow any function to be
called:

    {
      no strict 'refs';
      $func = $xml->get_func_name();
      $func->();
    }

But the most secure way would be to use "hard references" and make a
hash of allowed functions, mapping names to the reference:

    my %allowed_funcs = (
      func1 => \&func1,
      func2 => \&func2,
    );
    $func = $xml->get_func_name();
    $allowed_funcs{$func} or die "Can't run '$func'";
    $allowed_funcs{$func}->();

That gives you precise control over what functions can be called, and
will run just fine under taint mode, "use strict", and "use warnings".

----ScottG.


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

Date: 7 Dec 2004 10:53:42 -0800
From: mluvw47@gmail.com
Subject: Re: Monitor a dos console perl program running
Message-Id: <1102445622.069129.304110@f14g2000cwb.googlegroups.com>


dan baker wrote:
> mluvw47@gmail.com (Maverick Ieong) wrote in message
news:<d4b6522b.0412031501.52326913@posting.google.com>...
> > Hi,
> >   I have a perl script (script name: doingwork.bat) that doing some
> > work that take about 3-4 hour easily on the DOS console. Say output
on
> > the dos console, like below..
> > c:\>doingwork.bat
> > == Build Working 1/10000
> > Build 1 == done.
> > Build 2 == done.
> > ...
> > ...
> >
> >   Is that a way allow other people to see what doingwork.bat
progress
> > have done from IE? I know using netmeeting can do it, but I just
want
> > to connect the machine say..
> > http://mymachine.somedomain.com/doingwork.bat will tell me the
above
> > progress from IE. Do I need to make the above script as CGI script
or
> > how should I do it?
> > ------------------------------------
>
> you are using a DOS machine for a web server? scarey!
>
> its a little hard to tell exactly what you want... to initiate a
> script on a web server, it'll have to be in the cgi-bin dir,
> executable, and follow whatever naming convension your host defines.
> You also need to protect it so that unknown users cant start it up!
>
> If you are running a process on your local PC and just wanting to
> display status in a "public" place, that is possible too...
>
> anyway, one approach would be to have your script overwrite or append
> to a file somwhere in your loop with "reasonable" frequency which is
> either a plain  HTML file, or included as a text file in a .shtml
file
> if your server can handle that. If the HTML has a meta-refresh in the
> header, you can make it reload itself periodically, like maybe avery
> minute, and display any new status updates. Not "real-time", but
> probably close enough.
>
> this is dead simple if the script is running on the server. If the
> script is running on some offline machine, you'll have to add steps
to
> upload the status file to your webserver.
>
> d

Thanks D, that is pretty helpful. That script doingwork.bat is
current running on an
XP,(and doesn't have apache or any other webserver install). the
doingwork.bat is
written in perl, and right now the output detail is only on that
machine screen, call this (machine A).
(Machine A) does have internet access and belong to same network.

What I tried to do is when the owner of machine A start the
doingwork.bat,
that will output what see from the machine A into a html, so others can
see what is going on by connect to
let say :http://machineA.domain/cgi-bin/doingwork

In this case, do I need to install apache on machien A? and convert
the doingwork.bat into doingwork.cgi?
Or do I need to write another cgi program as a wrapper to read whatever
doingwork.bat output?

TIA,

Regards,
Mav



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

Date: 7 Dec 2004 10:54:31 -0800
From: mluvw47@gmail.com
Subject: Re: Monitor a dos console perl program running
Message-Id: <1102445671.881078.171590@z14g2000cwz.googlegroups.com>

dan baker wrote:
> mluvw47@gmail.com (Maverick Ieong) wrote in message
news:<d4b6522b.0412031501.52326913@posting.google.com>...
> > Hi,
> >   I have a perl script (script name: doingwork.bat) that doing some
> > work that take about 3-4 hour easily on the DOS console. Say output
on
> > the dos console, like below..
> > c:\>doingwork.bat
> > == Build Working 1/10000
> > Build 1 == done.
> > Build 2 == done.
> > ...
> > ...
> >
> >   Is that a way allow other people to see what doingwork.bat
progress
> > have done from IE? I know using netmeeting can do it, but I just
want
> > to connect the machine say..
> > http://mymachine.somedomain.com/doingwork.bat will tell me the
above
> > progress from IE. Do I need to make the above script as CGI script
or
> > how should I do it?
> > ------------------------------------
>
> you are using a DOS machine for a web server? scarey!
>
> its a little hard to tell exactly what you want... to initiate a
> script on a web server, it'll have to be in the cgi-bin dir,
> executable, and follow whatever naming convension your host defines.
> You also need to protect it so that unknown users cant start it up!
>
> If you are running a process on your local PC and just wanting to
> display status in a "public" place, that is possible too...
>
> anyway, one approach would be to have your script overwrite or append
> to a file somwhere in your loop with "reasonable" frequency which is
> either a plain  HTML file, or included as a text file in a .shtml
file
> if your server can handle that. If the HTML has a meta-refresh in the
> header, you can make it reload itself periodically, like maybe avery
> minute, and display any new status updates. Not "real-time", but
> probably close enough.
>
> this is dead simple if the script is running on the server. If the
> script is running on some offline machine, you'll have to add steps
to
> upload the status file to your webserver.
>
> d

Thanks D, that is pretty helpful. That script doingwork.bat is
current running on an
XP,(and doesn't have apache or any other webserver install). the
doingwork.bat is
written in perl, and right now the output detail is only on that
machine screen, call this (machine A).
(Machine A) does have internet access and belong to same network.

What I tried to do is when the owner of machine A start the
doingwork.bat,
that will output what see from the machine A into a html, so others can
see what is going on by connect to
let say :http://machineA.domain/cgi-bin/doingwork

In this case, do I need to install apache on machien A? and convert
the doingwork.bat into doingwork.cgi?
Or do I need to write another cgi program as a wrapper to read whatever
doingwork.bat output?

TIA,

Regards,
Mav



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

Date: Tue, 07 Dec 2004 22:45:46 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: Re: New comp.lang.perl.misc mirror site at lampforums.org
Message-Id: <uoqtd.3808$Dr4.586@trndny02>

astro wrote:
> Hello all,
> We have set up new linux, apache, mysql, python, perl, and php forums
> at http://lampforums.org .
> 
> comp.lang.perl.misc is at: http://lampforums.org/forumdisplay.php?f=19
> 
Please note:  It's "Perl" -- initial cap only -- not "PERL" as in your 
"PERL: The PERL Progamming Language."

jimk


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

Date: Tue, 07 Dec 2004 14:52:25 +0000
From: Alex Hunsley <lardattardisdoteddotacdotuk@mailinator.com>
Subject: perl DBI - can I send multiple updates at once?
Message-Id: <10rbgt3b3b7cgbe@corp.supernews.com>

I'm using perl DBI and I use the $dbh->do() command to send UPDATE 
instructions to a mysql database.
Is there any reason why I wouldn't be able to send multiple commands in 
one do statement, seperated by the command delimiter?
For example:

$dbh->do( "UPDATE [..etc....]; UPDATE .[..etc...]; UPDATE [...etc...]");

thanks
alex


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

Date: Tue, 7 Dec 2004 15:57:09 +0000
From: Craig Dunn <craig@codenation.net>
Subject: Re: perl DBI - can I send multiple updates at once?
Message-Id: <Pine.LNX.4.61.0412071548130.4383@gw.codenation.net>



> I'm using perl DBI and I use the $dbh->do() command to send UPDATE 
> instructions to a mysql database.
> Is there any reason why I wouldn't be able to send multiple commands in one 
> do statement, seperated by the command delimiter?
> For example:
>
> $dbh->do( "UPDATE [..etc....]; UPDATE .[..etc...]; UPDATE [...etc...]");


Simple reason... thats not supported.  Why would you want to do that 
anyway?  If you're reasoning is that you have multiple UPDATE's that are 
very similar and you do not want to have to redo the SQL each time (and 
I'm purely guessing here) then you may want to do something slightly nicer 
using prepare and execute.

$sth = $dbh->prepare("UPDATE foo SET bar = ? where moo = ?");

 ... loop through an array to set @bindvars {
$sth->execute(@bindvars);
 ... }

Craig



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

Date: 07 Dec 2004 17:17:40 GMT
From: xhoster@gmail.com
Subject: Re: perl DBI - can I send multiple updates at once?
Message-Id: <20041207121740.845$gD@newsreader.com>

Alex Hunsley <lardattardisdoteddotacdotuk@mailinator.com> wrote:
> I'm using perl DBI and I use the $dbh->do() command to send UPDATE
> instructions to a mysql database.
> Is there any reason why I wouldn't be able to send multiple commands in
> one do statement, seperated by the command delimiter?

Yes.  The reason is that that doesn't work.  The semicolon is part of the
syntax of the MySQL client, not of the servers SQL syntax.

I'd like to see vectorized inserts (and maybe updates, if there is such a
thing) implemented in DBI, but I don't think mysql would directly support
them anyway.

> For example:
>
> $dbh->do( "UPDATE [..etc....]; UPDATE .[..etc...]; UPDATE [...etc...]");
>
> thanks
> alex

Xho

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


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

Date: Tue, 07 Dec 2004 14:53:28 GMT
From: "Julia De Silva" <jds@atavailcheck.com>
Subject: Re: Perl open(). Inserting data into a file
Message-Id: <Itjtd.124192$38.51695@fe2.news.blueyonder.co.uk>

> I'm a Perl newbie. My question is: how do I insert data contained in
> $string at a certain position in a file? I tried to use
>
> open(OUT,"+< $out") or die "Can't read/write $out: $!";
> while(<OUT>) {
> if($_ =~ /<add_here \/>/s) { print OUT $string; }
> }
>
> to insert new data into an XML file which looks like this:
>
> <?xml version="1.0" encoding="Windows-1251"?>
> <disc>
> <info>Some Info</info>
> <info>Some Info 2</info>
> ...
> <add />
> </disc>
>
> but on update it prints the following:
>
> <?xml version="1.0" encoding="Windows-1251"?>
> <disc>
> <info>Some Info</info>
> <info>Some Info 2</info>
> ...
> <add_here />
> </disc>
> <?xml version="1.0" encoding="Windows-1251"?>
> <disc>
> <info>Some Info 1</info>
> <info>Some Info 2</info>
> ...
> <add_here />
> </disc>
> <info>Some Info 3</info>
>
> that is, it appends the preceding data and the new data ($string) at
> the end of the file. Why? I just want to add new text at the <add_here>
> position...
>
> Regards,
> dshan

This is a FAQ.  In fact it is more than frequently asked !!
FAQ 5 How do I change one line in a file/delete a line in a file/insert a
line in the middle of a file/append to the beginning of a file?





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

Date: 7 Dec 2004 15:01:12 -0800
From: bulk88@hotmail.com
Subject: perl port to my m68k calculator
Message-Id: <1102460472.077548.188110@z14g2000cwz.googlegroups.com>

Can someone please port perl to my 12 mhz Motorola 68000 CPU (same as
in apples) Texas Instruments 89 graphing calculator?

There is a C compiler available for the calculator. I would like to be
able to run perl on it because, the BASIC of the calculator is feature
limited, and not good at text processing, or dealing with strings. And
there are no regular expressions and all the flexibility and glue-ness
of Perl. And C isnt so good at strings either, and too much risk of
severe crashing. I've written a couple math programs in Perl, which are
more text manipulation than math, and it would be wonderful if I could
use them on my calculator.



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

Date: Tue, 07 Dec 2004 19:14:10 GMT
From: "VBSome" <not@home.net>
Subject: PerlCom Replacements
Message-Id: <6intd.27720$fC4.24474@newssvr11.news.prodigy.com>

PerlCom used to be the tool to expose Perl to COM.
ActiveState no longer maintains or sells it.

I have talked to ActiveState Tech Support and they say the only other option 
I have is to use PerlCtrl, which converts a perl script to an ActiveX 
control. I have about a 100 scripts that change almost weekly. I really do 
not want to have to create a new control every time I need to make a minor 
change to one of my scripts.

Are there any replacements out there for PerlCom ??

Thanks! 




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

Date: 07 Dec 2004 22:59:12 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Question on loops and return values
Message-Id: <slrncrcde0.k4s.abigail@alexandra.abigail.nl>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCXVI
September MCMXCIII in <URL:news:cp47no$d7l$2@mamenchi.zrz.TU-Berlin.DE>:
__  Tad McClellan  <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
__ > delfuego <djcameron60616@yahoo.com> wrote:
__  
__  [...]
__  
__ > >   $grate = eval { ($gvalue / $last) * 100 }; # growth rate percentage
__ > 
__ > 
__ > Can you tell us why you are using eval() there?
__  
__  It's probably a misguided way of saying
__  
__      $grate = ($gvalue / $last) * 100 if $last;


Except of course that the latter can give you an "Illegal division by zero"
error, since numeric context ain't the same as boolean context.


    $str = "700 00";
    ($gvalue, $last) =~ $str = /(\d+)\s+(\d+)/;
    $grate = ($gvalue / $last) * 100 if $last;
    __END__
    Illegal division by zero


Abigail
-- 
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;        
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";


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

Date: Tue, 7 Dec 2004 06:44:25 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: References and scope.
Message-Id: <slrncrb9d9.2e6.tadmc@magna.augustmail.com>

Adam <adam_cheney@hotmail.com> wrote:

> What actually happens when a variable goes out of scope? 


It isn't actually the variable that goes out of scope, it is
the *name* of the variable that goes out of scope.


> More
> specifically, if I define a variable in a sub-routine (it is thus in
> scope only within the subroutine, right?) 


Right, outside of the subroutine you can no longer use that
name to access the variable's value.


> and explicitly return a
> reference to that variable, 


Now you don't *need* the name to get access, you now have a second
way to get to the variable's value, via the reference.


> how can I dereference that return value
> outside the subroutine and still have something meaningful?


Because Perl uses a "reference counting" type of garbage collection.

When in the subroutine there is one reference to the variable,
via its name.

When you return a reference, the ref count goes to 2, then the
name immediately goes out of scope because the subroutine is ending,
and the ref count goes to 1.

The variable's space is not reclaimed until the ref count reaches zero.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 07 Dec 2004 08:24:12 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: RegExp Help
Message-Id: <-PudnVJU3pOBVijcRVn-1g@comcast.com>

BigDaDDY wrote:
> Andrew,
> 
> My bad..I did want 25.010 to be converted to 25.01.  Nice catch.
> 
> How does this change the regexp you provided?

Is there a reason why you insist on using a regex for a task that does 
not require one?



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

Date: Tue, 7 Dec 2004 06:51:22 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Trouble Passing Array Containing Hash to Subroutine
Message-Id: <slrncrb9qa.2e6.tadmc@magna.augustmail.com>

Michael Erskine <msemtd@yahoo.co.uk> wrote:
> Jim Keenan wrote:
> 
>> If you're using non-negative integers for the keys of a hash, you might
>> as well use an array instead, since arrays are automatically indexed by
>> non-negative integers.
> 
> Not if your non-negative integer keys are non-contiguous -- you fall foul of
> deriving too much specific information from this limited context in your
> tirade of poor-programming accusations.


Tirade? What tirade?

Looks like a calmly delivered BTW to me.

And if the OP actually had non-contiguous indexes, then the example
should *show* non-contiguous indexes, else he could fall afoul of
getting non-applicable comments about it.

We are not mind readers, we can only go by what we are told (or by
what is implied in examples).


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

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

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 7491
***************************************


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