[22639] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4860 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 18 03:06:01 2003

Date: Fri, 18 Apr 2003 00:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 18 Apr 2003     Volume: 10 Number: 4860

Today's topics:
    Re: Good Programming Practices - Avoiding Memory Leaks <Juha.Laiho@iki.fi>
    Re: Interpolation problem with DB execute object (Liberty Belle)
    Re: Interpolation problem with DB execute object (Liberty Belle)
    Re: Matching two patterns at once <Jodyman@hotmail.com>
        MIME::Lite images and attachments (David Alyea)
    Re: Need advice on my first Perl script (Tad McClellan)
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
        remembering values <chris_12003@yahoo.com>
    Re: Trouble with Variable Interpolation while executing (Liberty Belle)
    Re: Using a pre-processor to generate POD <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: Using a pre-processor to generate POD <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 18 Apr 2003 06:12:00 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Good Programming Practices - Avoiding Memory Leaks
Message-Id: <b7o4ub$q0$1@ichaos.ichaos-int>

"Kevin Vaughn" <kevin.vaughn@ttu.edu> said:
>I'm having a problem with a small memory leak (~20MB/day). I have
>traced the problem back to my Perl scripts.
 ...
>I've written a 250 line Perl script and a bunch of smaller scripts that
>are ~50 lines. All of these scripts run every five minutes, working
>together to extract WMI information from servers (I'm also running
>MRTG, which could conceivably be the culprit).

So, are you saying that these scripts (also the 250-liner) are started
fresh every five minutes (not that they just sleep for five minutes, do
something, and go to sleep again but do not exit)?

If it is so that the scripts are started fresh, the memory leak is
not in Perl - but in your OS. Ok, something you do in Perl might be
triggering the leak, but the leak still is on the OS side - which makes
the Win32::OLE routines the most probable place of problems. You might
try to check this by having the same script, but instead of calling
things through Win32::OLE just return some fixed (or random) data.

And as was mentioned in the other reply, use 'my' for declaring your
variables, and limit them to the smallest possible scope. This also
helps to keep your program(s) maintainable (and so do, after you cross
the initial "pain", turning on warnings and strict). This doesn't help
much in catching memory leaks, but it might catch some other problems
that are waiting to bite you.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: 17 Apr 2003 22:11:43 -0700
From: libertybelle2112@yahoo.com (Liberty Belle)
Subject: Re: Interpolation problem with DB execute object
Message-Id: <d9cbd61e.0304172111.43879d76@posting.google.com>

tiltonj@erols.com (Jay Tilton) wrote in message news:<3e9f2527.17227729@news.erols.com>...
> libertybelle2112@yahoo.com (Liberty Belle) wrote:
> 
> : "st execute failed: called with 1 bind variables when 5 are needed"
> : 
> : it sees [...]
> : only one variable in the execute, though it too is values 
> : separated by commas.
>  
> : $inputdata = 'row1, 14, 150.34, 238.00, 12.50';
> : $sth_loadstmt->execute($inputdata);
> 
> $inputdata is not several values.  It is one value--a string.
> 
> Perl has a considerable gift of DWIM, but it cannot reason that you
> want that string burst at the commas to create a list of arguments to
> pass to execute().  You must do that yourself.
> 
> Didn't you already ask this question?

Yes, sorry about the double post.  After waiting over 24 hours and not
seeing my original post, I assumed that there had been an error in
posting and reposted.


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

Date: 17 Apr 2003 22:17:02 -0700
From: libertybelle2112@yahoo.com (Liberty Belle)
Subject: Re: Interpolation problem with DB execute object
Message-Id: <d9cbd61e.0304172117.1d31f5ea@posting.google.com>

Michael Budash <mbudash@sonic.net> wrote in message news:<mbudash-E59B7C.10303817042003@typhoon.sonic.net>...
> In article <d9cbd61e.0304170837.2b2aa42a@posting.google.com>,
>  libertybelle2112@yahoo.com (Liberty Belle) wrote:
> 
> > Working on a little program which will extract N number of column 
> > headers, as well as N data values for each header from a page of 
> > text. I then concatenate each to its own var($columnheads and 
> > $inputdata below), separating with a comma. Additionally, I get a 
> > var of comma separated question marks, all this to build my $sth 
> > prepare statement. However, when I run this I get an error:
> > 
> > "st execute failed: called with 1 bind variables when 5 are needed"
> > 
> > The problem is that it interpolates as I want it to in the prepare 
> > statement, but it does not in the execute. Thus it sees the var as 
> > its component text, column names separated by commas in the prepare, 
> > but only one variable in the execute, though it too is values 
> > separated by commas.
> > 
> > Any help would be appreciated.
> > 
> > Code as follows:
> > 
> > #!/usr/bin/perl
> > 
> > use DBI;
> > 
> > $dbh = DBI->connect('dbi:ODBC:financials') || die "DBI could not 
> > connect\n";
> > 
> > $columnheads = 'head1, head2, head3, head4, head5';
> > $columnqmks = '?,?,?,?,?,';
> 
> this will get you an SQL error... drop the final ','...
> 
> > $inputdata = 'row1, 14, 150.34, 238.00, 12.50';
> 
> @inputdata = qw/row1 14 150.34 238.00 12.50/;
> 
> > $sth_loadstmt = $dbh->prepare(qq{ INSERT INTO Table1 ( 
> > $columnheads ) VALUES ($columnqmks) }) || die "sth loadstmt prepare 
> > failed\n";
> > 
> > $sth_loadstmt->execute($inputdata);
> 
> $sth_loadstmt->execute(@inputdata);
> 
> hth-


Belay my idiot first response to this about it not being a list.  I
see what you're doing.

1000 apologies for my muddleheadedness


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

Date: Fri, 18 Apr 2003 04:26:35 GMT
From: "Jodyman" <Jodyman@hotmail.com>
Subject: Re: Matching two patterns at once
Message-Id: <%7Lna.29897$4P1.2703420@newsread2.prod.itd.earthlink.net>


"Stephan Bour" <sbour@niaid.nih.gov> wrote in message:

> I have a multi-line output text that contains pertinent information
between
> two different patterns. I'm trying to split the string to build an array
> that would contain the text comprised between the two search patterns. To
> illustrate: if I have the string "I don't know much about perl" and I want
> to extract "much about" looking for anything comprised between "know" and
> "perl", can I do that in one go or do I need two splits?
>
> This doesn't work properly:
>
> @split = split ((/know/ and /perl/), $output);
>

You might try a regex instead of split:


use strict;
use warnings;
use diagnostics;

my $text = "I don't know much about perl";

my ($match) = $text =~ /know (.+) perl/;

print $match;

hth,

Jodyman




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

Date: 17 Apr 2003 23:58:44 -0700
From: ironmanda@yahoo.com (David Alyea)
Subject: MIME::Lite images and attachments
Message-Id: <4e277f62.0304172258.2f2a4e52@posting.google.com>

I'm trying to write a script to send
HTML files.  So far, so good- except
that:

1. the images I define in the body
   show up as broken
2. the images I attach are actual
   attachments on the email

Does anyone have an example of how
to send HTML email using MIME::Lite?

Thanks!
David

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

#!/usr/local/bin/perl

use MIME::Lite;

my $from_address = 'a@b.com';
my $to_address = 'c@d.com';
my $subject = "MIME test: HTML formatted message";

$msg = MIME::Lite->new(
       To      =>$to_address,
       Subject =>$subject,
       Type    =>'multipart/related'
       );

$msg->attach(Type => 'text/html',
             Data => qq{ <body>
                         <b>Here's my image:</b>
                         <hr>
                         <img src="cid:myimage">
                         </body> }
                 );

$msg->attach(Type => 'image/gif',
             Id   => 'myimage',
             Path => '../images/thisimage.gif',
             );

$msg->send();

exit 0;


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

Date: Fri, 18 Apr 2003 00:21:38 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Need advice on my first Perl script
Message-Id: <slrnb9v2r2.96s.tadmc@magna.augustmail.com>

Scott Spencer <scott@doppelgangerdesign.com> wrote:

> keep only every 5th or 6 th file deleting the ones in between. For
> instance, file001 will stay but file 002 thru 005 will be deleted. I
> know its bad form to delete the files 


I don't know that.

Why is it bad form to delete the files?


> but it was the first and only
> solution I found in my book. 


If it does not do what you _want_ to do, then it is not a 
"solution" at all...


> this is my first time ever
> coding Perl so... : )


 ... so have you read the Posting Guidelines that are posted
here frequently?

   http://mail.augustmail.com/~tadmc/clpmisc.shtml



> opendir (BOOGER, "$path") || die "cannot open your request??? $!"; 
                   ^     ^

Those quotes do not do anything, so they should not be there.

It would be helpful if your diagnostic message actually said
what directory it tried to open:

   opendir(BOOGER, $path) or die "cannot open '$path'  $!";


> @thefiles = readdir(BOOGER); 		#read the directory contents into an


You know that @thefiles might contain things that are NOT files, right?

Like directories, symlinks, etc...

If you want only plain files, you can use grep and a filetest:

   @thefiles = grep -f "$path/$_", readdir(BOOGER);

and now that you are done with the directory handle, you
should free that resource:

   closedir BOOGER;


> #and the script itself which onloy seems to work
> when it is in the home #directory. I think thats cause I used the
> unlink function.


No, that is because you did not read the documentation for
the functions that you are using.

You should read the documentation for the functions that you use:

   perldoc -f readdir

       if you're planning to filetest the return values
       out of a "readdir", you'd better prepend the
       directory in question.  Otherwise, because we
       didn't "chdir" there, it would have been testing
       the wrong file.

It is looking for the files in the current directory, but they
are not in the current directory, they are in the directory
that you opendir()ed.


> while ($current_count ne $end_frame)  {
                        ^^

ne is for comparing _strings_.

If you want to compare numbers, you use != instead.


> 	$current_file = @thefiles [$current_count]; 


If you had enabled warnings it would have said something about
that line.

Ask for all the help you can get.

You should always enable warnings when developing Perl code!


>         $current_file_number = $current_file;
> 	$current_file_number =~ s/\D*//;  #regular expression to remove all
> #alpha characters before numbers


Your comment is misleading as it will remove the first run of non-digits
(not "all" non-digits) regardless of whether they appear before or
after digit characters.

   s/^\D+//;  # remove all non-digits from start of string


> # I need to figure out the regular expression to wipe the .tif
> extension as #well.

   s/\.tif$//;  # remove the .tif extension


> 	unlink ($current_file);


Just because you asked for the file to be deleted does not mean
you got what you asked for.

You should check the return value to see if you got what you asked for:

   unlink($current_file) or die "could not unlink '$current_file'  $!";


> 	print '\n';


I'll bet that does not do what you think it does...


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


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

Date: Fri, 18 Apr 2003 01:22:39 -0500
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
Message-Id: <P_-cnXgKMLEyBAKjXTWcog@august.net>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://mail.augustmail.com/~tadmc/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume 

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_group_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "Jeopardy" (because the answer comes before the question), or
        "TOFU".

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan <tadmc@augustmail.com> and many others on the
    comp.lang.perl.misc newsgroup.



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

Date: Thu, 17 Apr 2003 22:49:48 -0700
From: "Chris" <chris_12003@yahoo.com>
Subject: remembering values
Message-Id: <v9v4gs3dckmc05@corp.supernews.com>

How do I call a cgi so that each time I call it, it remembers the previous
variable values?  I've thought about appending the variables, something like
mycgi.cgi?var1=a?var2=b but am not sure  how to do this.

Thanks
Chris




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

Date: 17 Apr 2003 22:08:02 -0700
From: libertybelle2112@yahoo.com (Liberty Belle)
Subject: Re: Trouble with Variable Interpolation while executing a dbi string handle
Message-Id: <d9cbd61e.0304172108.7375906@posting.google.com>

Steve May <stevenm@bogus.blackwater-pacific.com> wrote in message news:<b7k1f1$co9$1@quark.scn.rain.com>...
> Liberty Belle wrote:
> > Working on a quick little script to load some data off of a page of
> > text.  These pages have a column header(variable name) and some wanted
> > information, as well as some garbage.  I want to keep this script as
> > general as possible since there are at least 3, and more coming
> > variations.
> > 
> > Everytime it recognizes a column header, it collects it and appends it
> > to a var, $columnheads, as well as a comma.  Additionally, I append a
> > ', ?' to $columnqmks, so that the number of ? is equal to the number
> > of columns.  When it finds information, it does likewise to another
> > var, $inputdata.  
> 
> Is the above a typo? If you feed a scalar to the prepared query instead
> of a list it will break when there is more than one placeholder...
> 
> 
> So far, so good.  If I print this, I get exactly
> > what I want.  So, head over to DB angle.
> > 
> > My DB Handle works fine, no prob there
> > 
> > This part works fine as well.  For the one I test, it interpolates
> > properly, which I know when I get the execute error
> > 
> >        $sth_loadstmt = $dbh->prepare(qq{ INSERT INTO BalSheet (
> > $columnheads ) VALUES ($columnqmks) }) || die "Problem sth
> > loadstmt\n";
> > 
> > This is the problem.	
> > 
> > $sth_loadstmt->execute($inputdata);
> 
> 
> $sth_loadstmt->execute(@inputdata);
> 
> 
> s.

Well, not so much a typo as a contextual error.  It isn't a list,
where list means array.  It is a var with all my values comma
separated

To wit:

$inputdata = 'value1,value2,value3'; # et cetera

Sorry for the confusion


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

Date: Fri, 18 Apr 2003 08:12:51 +0200
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Using a pre-processor to generate POD
Message-Id: <newscache$gxzidh$rc2$1@news.emea.compuware.com>

pkent wrote (Thursday 17 April 2003 22:50):

> In article <newscache$7suhdh$s02$1@news.emea.compuware.com>,
>  Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com> wrote:
> 
>> I am currently working on a cpp look-a-like to generate my inline POD
>> documentation. The reason is that I have a base class from which I stem
>> numerous (30) other classes. Due to the shared base class, many methods
>> are the same. And as I don't want to write the same POD over and over
>> again, I was trying to have cpp generate the POD for me. But cpp has it's
>> limitations (tokens, terms, balanced quotes, etc).
> 
> There is at least one other preprocessor on CPAN, e.g.
> http://search.cpan.org/author/GSPIVEY/Text-EP3-1.00/EP3.pm
> but I haven't examined that too closely - maybe it just won't do what
> you need.

Just had a quick look. Seems complicated to me. But that's probably it has a
different and broader application. I only need my modules to be
pre-processed for default POD. Nothing more. In my Makefile I can now
simple say:

    podproc $< | pod2man | gzip > man/man3/$@

And that's cool :-)

-- 
KP



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

Date: Fri, 18 Apr 2003 08:16:41 +0200
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Using a pre-processor to generate POD
Message-Id: <newscache$t30jdh$rc2$1@news.emea.compuware.com>

user2048 wrote (Thursday 17 April 2003 19:41):

>> I am currently working on a cpp look-a-like to generate my inline
>> POD documentation. The reason is that I have a base class from which
>> I stem numerous (30) other classes. Due to the shared base class,
>> many methods are the same.
> 
> I usually hardcode "see also" POD links to the parent class,
> to cover the cases where the method is inherited (or at least,
> where the interface and description are "inhertied").

Yep. There's not much more you can do. It at least saves you from repeating
yourself. But the drawback is that the reader needs to follow cross links.

> But I'm interested in alternatives. I like the idea of seeing
> all of a class's method descriptions in one place.

That is exactly what I had in mind when I scratched this itch.

-- 
KP



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

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.  

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


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