[25081] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7331 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 28 14:05:49 2004

Date: Thu, 28 Oct 2004 11:05:09 -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           Thu, 28 Oct 2004     Volume: 10 Number: 7331

Today's topics:
        [ANN] Algorithm::Knapsack 0.02 <a.anderson@utoronto.ca>
    Re: Am *I* allowed to make a suggestion for PG <nospam@nospam.com>
    Re: Am *I* allowed to make a suggestion for PG (krakle)
        ANNOUNCE:  Data-Presenter-0.68 and Mail-Digest-Tools-2. <jkeen_via_google@yahoo.com>
        ANNOUNCE: Cisco::Reconfig version 0.8 ((null))
    Re: browser output <nospam@nospam.com>
    Re: browser output <no@email.com>
    Re: browser output <nospam@nospam.com>
    Re: browser output <nobull@mail.com>
    Re: Common file operations (Seymour J.)
    Re: Common file operations (Seymour J.)
        Debugger Error <nospam@nospam.com>
    Re: Debugger Error <perl@my-header.org>
    Re: Debugger Error <mritty@gmail.com>
    Re: Debugger Error <lwt0301@bellsouth.net>
        FAQ 8.43: How do I open a file without blocking? <comdog@panix.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 24 Oct 2004 20:04:17 GMT
From: Alexander Anderson <a.anderson@utoronto.ca>
Subject: [ANN] Algorithm::Knapsack 0.02
Message-Id: <I6At96.1Cnw@zorch.sf-bay.org>

NAME
    Algorithm::Knapsack - brute-force algorithm for the knapsack problem

SYNOPSIS
        use Algorithm::Knapsack;

        my $knapsack = Algorithm::Knapsack->new(
            capacity => $capacity,
            weights  => \@weights,
        );

        $knapsack->compute();

        foreach my $solution ($knapsack->solutions()) {
            foreach my $index (@{$solution}) {
                # do something with $weights[$index]
            }
        }

DESCRIPTION
    The knapsack problem asks, given a set of items of various weights, find
    a subset or subsets of items such that their total weight is no larger
    than some given capacity but as large as possible.

    This module solves a special case of the 0-1 knapsack problem when the
    value of each item is equal to its weight. Capacity and weights are
    restricted to positive integers.

METHODS
    new    my $knapsack = Algorithm::Knapsack->new( capacity => $capacity,
           weights => \@weights, );

           Creates a new Algorith::Knapsack object. Value of $capacity is a
           positive integer and \@weights is a reference to an array of
           positive integers, each of which is less than $capacity.

    compute
               $knapsack->compute();

           Iterates over all possible combinations of weights to solve the
           knapsack problem. Note that the time to solve the problem grows
           exponentially with respect to the number of items (weights) to
           choose from.

    solutions
               my @solutions = $knapsack->solutions();

           Returns a list of solutions. Each solution is a reference to an
           array of indexes to @weights.

EXAMPLES
    The following program solves the knapsack problem for a list of weights
    (14, 5, 2, 11, 3, 8) and capacity 30.

        use Algorithm::Knapsack;
        my @weights = (14, 5, 2, 11, 3, 8);
        my $knapsack = Algorithm::Knapsack->new(
            capacity => 30,
            weights  => \@weights,
        );
        $knapsack->compute();
        foreach my $solution ($knapsack->solutions()) {
            print join(',', map { $weights[$_] } @{$solution}), "\n";
        }

    The output from the above program is:

        14,5,11
        14,5,3,8
        14,2,11,3

AUTHOR
    Alexander Anderson <a.anderson@utoronto.ca>

COPYRIGHT
     Copyright (c) 2004 Alexander Anderson. All rights reserved.
     This program is free software; you can redistribute it and/or
     modify it under the same terms as Perl itself.

P.S.: Available from CPAN near you.




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

Date: Thu, 28 Oct 2004 11:16:59 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Am *I* allowed to make a suggestion for PG
Message-Id: <1098976676.336297@nntp.acecape.com>

"Charlton Wilbur" <cwilbur@mithril.chromatico.net> wrote in message
news:87lldrf9k6.fsf@mithril.chromatico.net...
> >>>>> "lazy fuckwit" == daniel kaplan <nospam@nospam.com> writes:
>
> (in response to Michael Carman)
>
>     >> Once you learn the rules, this is a wonderfully helpful and
>     >> perfectly freindly place.
>
>     lazy fuckwit> my sincere response is, if the regulars know the
>     lazy fuckwit> rules, and know what happens next , shouldn't they
>     lazy fuckwit> lead the way via example?
>
> WHY ON EARTH do you think so many people pointed you at the Posting
> Guidelines?

not a lazy fuck wilbur, ask your mom




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

Date: 28 Oct 2004 10:14:17 -0700
From: krakle@visto.com (krakle)
Subject: Re: Am *I* allowed to make a suggestion for PG
Message-Id: <237aaff8.0410280914.6975dde2@posting.google.com>

"daniel kaplan" <nospam@nospam.com> wrote in message news:<1098901554.932673@nntp.acecape.com>...
> A yadda yadda ding dong blah blah boo hoo...
> 
> Anyway, that's my thought/recommendation, you may do with it as you like...
> 
> daniel

9 out of 10 times the answer is always answered. And yes some people
are jerkoffs here but as long as you get your answer it is fine.
Generally, you will never meet these people in your world. If they
offend you who cares. If you offend them seriously who cares. If you
got your post answered too hooray. If you also got offended, didn't
you get your post answered?

But I do agree the flaming and cruelness need to stop. We all can't be
like Tad. No we can't.


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

Date: Mon, 25 Oct 2004 03:05:39 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: ANNOUNCE:  Data-Presenter-0.68 and Mail-Digest-Tools-2.11
Message-Id: <I6At9D.16ov@zorch.sf-bay.org>

The following new versions of modules have been uploaded to CPAN:

Data::Presenter (v0.68)
Mail::Digest::Tools (v2.11)

These versions include corrections to earlier code which gave correct
results and passed tests when run under normal conditions but failed
tests when run for coverage analysis with Devel::Cover.  (See my
10/23/2004 posting to comp.lang.perl.modules for further explanation.)

James E Keenan




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

Date: Mon, 25 Oct 2004 22:51:22 GMT
From: muir@idiom.com ((null))
Subject: ANNOUNCE: Cisco::Reconfig version 0.8
Message-Id: <I6At9q.1Cor@zorch.sf-bay.org>

You can find this in CPAN at 

http://www.cpan.org/authors/id/MUIR/modules/Cisco-Reconfig-0.8.tar.gz

or (until CPAN picks it up) at

ftp:://ftp.idiom.com/users/muir/CPAN/modules/Cisco-Reconfig-0.8.tar.gz

-Dave


 ...CHANGELOG...................................................

Marko Haim <Haim.Marko at comverse.com> reported that access lists
were being reordered.  Very tricky bug, but fixed now.

Jay Austad <austad at signal15.com> reported that get('no cdp enable')
didn't work.  Oops, I forgot to document something: "no" is ignored
as a word when parsing configurations.  It's documented now.


 ...POD.........................................................

NAME
    Cisco::Reconfig - Parse and generate Cisco configuration files

SYNOPSIS
            use Cisco::Reconfig;

            my $config = readconfig("/my/cisco/config");
            my $config = stringconfig("cisco config", "goes here");

DESCRIPTION
    Cisco::Reconfig makes it easier to write programs to generate changes to
    Cisco configuration files.

    Cisco::Reconfig is a module that parses Cisco router configuration
    files. It doesn't have any real understanding of Cisco configurations so
    it might be useful for other similar configuration languages. It knows
    that nesting is shown by indentation. It knows that "!" means a comment.
    It knows that "no" may proceed a line without changing where that line
    exists in the hierarchy. It doesn't know much else.

    Cisco::Reconfig can be used to modify configurations. The "set()" method
    will check the current configruation and return commands to change it if
    it is other than what is wanted (as passed to the "set()" method).

  DETAILS
    Some of the accessor methods return a special "undef" object instead of
    a proper undef. This is so that code that uses accessors doesn't have to
    be paranoid about undefined values. This "undef" object tests as false
    in boolean context however it is "defined()"ed.

    Methods that return configuration items can return items that represent
    any particular word in the configruation file. For example, with the
    following configuration & code, the return value for the "get()" method
    would represent the word "access-list" in both of the lines:

            ip as-path access-list 111 deny _10993_
            ip as-path access-list 111 permit .*

            $config->get('ip as-path access-list');

    Most of the time you don't need to worry about the fact that the object
    represents a word. Another way to look at it is that the object
    represents a selection of lines from the configuration file. Sometimes
    that selection is a single line. Sometimes it is a block. Sometimes it
    is a few lines that start with the same tokens.

    To look at all the different as-path access lists, the following would
    work:

            $config->get('ip as-path access-list')->all;

    The word "no" is handled specially: it is discarded. Many cisco
    directives start with the word "no". To make the module more usable, the
    word "no" is ignored during parsing. It is kept in the text so, if you
    look for something that might have a "no" in front of it, you'll get a
    hit if the "no" is there or isn't there. For example:

            my (@cdp_disabled);
            for my $context ($config->get('interface')->all(qr{^ether}i)) {
                    my $cdp = $context->get('cdp enable');
                    push(@cdp_disabled, $context)
                            if $cdp =~ /no cdp enable/;
            }

FUNCTIONS
    There is just one function provided: "readconfig()". Readconfig takes a
    single argument: a filename or file handle. It parses the file and
    returns an Cisco::Reconfig object.

MAIN METHODS
    ->get(@designators)
        The "get()" method is the key to looking up items in a configuration
        file. It takes an array of designators as an argument. A designator
        is simply something that identifies a portion of a configuration
        file. For example "('interface')" is a designator for all the
        interfaces and "('ip route')" is a designator for all the static
        routes.

        When multiple designators are specified, they are used for nested
        configuration items. For example, "('router bgp', 'neighbor')" would
        be a designator for all the BGP neighbors. This assumes that there
        is only one "router bgp" defined.

        In array context, "get()" will follow multiple paths to find
        configuration items that match the specification. For example
        "('interface', 'ip address')" would return a list of ip address
        items across multiple interfaces.

        Designators must exactly match words in the configuration. You may
        not abbr anythng.

    ->set(@designators, $newvalue)
        The "set()" method will generate Cisco configuration snippets that
        will modify the configuration of an item. For example, the following
        code:

                my $ser0 = $config->get('interface Serial0');
                print $ser0->set('ip address', 
                        'ip address 207.181.198.194 255.255.255.252');

        Will print:

                interface Serial0
                 ip address 207.181.198.194 255.255.255.252
                exit

        If the configuration already matches the $newvalue then nothing
        would be printed.

        The designator(s) say what will be modified. This should either be
        represent a line or an entire block. When multiple designators are
        needed, pass them as an anonymous array. The above example could
        also have been written as:

                print $config->set('interface Serial0', 'ip address',
                        'ip address 207.181.198.194 255.255.255.252');

        If no designators are needed, don't pass any. The following is
        nearly the same as the preceeding;

                my $ipaddr = $config->get('interface Serial0', 'ip address');
                print $ipaddr->set( 'ip address 207.181.198.194 255.255.255.252');

        When providing code snippets to "set()", indent blocks just like
        Ciscos do when they display their configuration. For example, the
        following:

                print $config->set("ip access-list extended all-addresses", <<END);
                        ip access-list extended all-addresses
                         permit ip any any
                        !
                END

        Will print the following if the access list ins't already set as
        listed:

                ip access-list extended all-addresses
                 permit ip any any
                exit

        When modifying a block, include the configruation line that starts
        the block in the replacement text. For example, when setting an
        entire interface, provide the entire block:

                print $config->set('interface Serial0',<<END);
                        interface Serial0 point-to-point
                         ip address 219.22.221.3 255.255.255.252
                         bandwidth 3022
                        !
                END

    ->all($regex)
        The "all()" method can be used to expand and select configuration
        items.

        For example, to make sure that all loopback interfaces use a netmask
        of 255.255.255.255, use the following:

                for my $loop ($config->get('interface')->all(qr{^Loop})) {
                        my $ip = $loop->get('ip address');
                        next unless $ip->text =~ /\A\s*ip address (\S+) \S+\s*\Z/;
                        print $ip->set(undef, "ip address $1 255.255.255.255");
                }

        The $regex paramater is optional.

ACCESSOR METHODS
    ->single()
        Cisco::Reconfig objects may represent any word in a configruation
        file. For example the word "address" in the following is represented
        by an object that would be returned by the code that follows.

                interface Loopback0 
                 ip access-group 151 in
                 ip address 218.28.41.38 255.255.255.255
                !

                my $address_word = $config->get('interface Loopback0', 'ip')
                        ->all(qr{^address});

        "single()" answers the question: does this Cisco::Reconfig object
        uniquely specify a single point in the configuration? In the example
        above, the object for word "ip" (above) does not but the object for
        the word "address" does.

        "single()" returns an object (representing the last word on the
        line) or undef.

    ->zoom()
        "zoom()" is the same as to "single()" except that it will always
        return a valid Cisco::Reconfig object.

    ->endpt()
        Returns an Cisco::Reconfig object representing the last word on a
        configuration line that could follow from the current ZYZ object.
        When there are multiple possibilities the object picked is nearly
        random.

    ->next()
        "next()" returns an Cisco::Reconfig object representing the last
        word on the suceeding line of the current configuration block.

        When used at the beginning of a block, it returns the last word of
        the first line in the block.

    ->context()
        Returns the configuration object that represents the surounding
        context.

                # returns the "undefined" object
                $config->context 

                # returns $config
                $config->get('interface Loopback0')->context 

                # returns $config->get('interface Loopback0')
                $config->get('interface Loopback0', 'ip address')->context 

        "context()" always returns a configuration object.

    ->subs()
        For Cisco::Reconfig objects that represent a word in a line that
        introduces a block of configuration items (such as most "interface"
        lines), the "subs()" function returns an Cisco::Reconfig object that
        represents the contents of the block.

        If the Cisco::Reconfig object in question does not represent the
        start of a configuration block, the "undefined" object is returned.

    ->kids()
        For Cisco::Reconfig objects that do not uniquely specify a single
        line (ie: "! -"single()>), the ->kids() method will return an array
        of objects representing the possible following words.

        If there is only one possibility, that one possibility is returned.

        If the Cisco::Reconfig object represents the last word on a
        configuration line then that word is returned.

MISCELLANEOUS METHODS
    ->text()
        Returns the text from the original configuration file (in original
        order) of all of the lines that could follow from the current
        Cisco::Reconfig object.

        When the invoking Cisco::Reconfig object represents a single line
        "text()" returns that line. When the invoking Cisco::Reconfig object
        represents a block "text()" returns the entire block. When the
        Cisco::Reconfig object represents a word with multiple possible
        completions, "text()" returns all the completions.

    ->setcontext()
        Returns an array of configuration lines that define the block
        surrounding the invoking object.

    ->unsetcontext()
        Returns an array of the word "exit" repeated as many times as
        nessasary to undo a "setcontext()".

    ->block()
        Returns true if the object represents a whole configuration block.

OVERLOADING
    Two operators are overloaded: boolean tests and stringification.
    Cisco::Reconfig objects booleanify as true if they are the special
    undefined objects. Cisco::Reconfig objects stringify as their text
    lines.

CAVEATS
    Since Cisco::Reconfig doesn't really understand Cisco configuration
    files it can't know things that you might think it should.

    For example, it doesn't know that "interface Serial0" is the same as
    "int ser 0" nor even "interface Serial 0". Be very careful about where
    Cisco's actually put spaces and where they don't.

    No attempt has been made to make this module particularly fast or
    efficient for the computer.

    Cisco::Reconfig objects don't automatically garbage collect themselves
    because they are highly self-referrential.

LICENSE
    Copyright (C) 2002 David Muir Sharnoff <muir@idiom.com> This module may
    be licensed on the same terms as Perl itself.

-- 




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

Date: Thu, 28 Oct 2004 11:13:31 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: browser output
Message-Id: <1098976467.986004@nntp.acecape.com>

"Tore Aursand" <toreau@gmail.com> wrote in message
news:pan.2004.10.28.08.40.40.57262@gmail.com...
> On Wed, 27 Oct 2004 15:34:01 -0400, daniel kaplan wrote:
> No.  It - normally - doesn't matter where your subroutines are, and in
> "traditional" CGI programming you should _never_ use 'exit'.
>
> Why do you need to use exit?  A CGI program runs from A to Z, then it's
> done, right?  Why do you need to exit at - for instance - F og M in the
> script?
>
> If you show me your code, I will show you what is wrong.
>
>
> -- 
i will recreate the instance that has caused it and post it, am just
sidetracked on some other issues....




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

Date: Thu, 28 Oct 2004 17:52:11 +0100
From: Brian Wakem <no@email.com>
Subject: Re: browser output
Message-Id: <2ucmdrF28qp54U1@uni-berlin.de>

Tore Aursand wrote:

> On Wed, 27 Oct 2004 15:34:01 -0400, daniel kaplan wrote:
>> with regards to your EXIT comment, if i hear correctly , just make sure
>> your script is at the bottom of the file (subroutines on top) and just
>> let it run through?
> 
> No.  It - normally - doesn't matter where your subroutines are, and in
> "traditional" CGI programming you should _never_ use 'exit'.
> 
> Why do you need to use exit?  A CGI program runs from A to Z, then it's
> done, right?  Why do you need to exit at - for instance - F og M in the
> script?


#!/usr/bin/perl

use strict;
use CGI;
my $query = new CGI;


if (..some condition is met..) {
     print $query->redirect(..some other url..);
     exit;
}

 .. more code..


Without the exit the script continues to run even though the person
accessing the script is long gone.

What would be better than exit here?



-- 
Brian Wakem




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

Date: Thu, 28 Oct 2004 13:09:28 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: browser output
Message-Id: <1098983422.782830@nntp.acecape.com>

"Brian Wakem" <no@email.com> wrote in message
news:2ucmdrF28qp54U1@uni-berlin.de...

> if (..some condition is met..) {
>      print $query->redirect(..some other url..);
>      exit;
> }
>
> .. more code..
>
>
> Without the exit the script continues to run even though the person
> accessing the script is long gone.
>
> What would be better than exit here?


the only reaosn i changed it and put exit there was the server error log
would give me some strange wanring....i will recreate later to post that
warning, at someone else's request...just very sidetracked now....thanks




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

Date: Thu, 28 Oct 2004 18:18:57 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: browser output
Message-Id: <clr9dd$ia4$2@sun3.bham.ac.uk>



daniel kaplan wrote:

> afternoon,
> 
> I use the following in all my scripts:
> 
> print $q->header();
> print $out;
> exit;
> 
> And sometimes in place of the first line I have used
> print "Content-type: text/plain\n\n";
> 
> Sometimes after everything appears to be working fine, I no
> longer get output to my browser (windows platform) after
> running the script I get the dialog asking me if I would like to
> SAVE/OPEN this document.  Opening it makes a quick DOS
> window, and examining the results of save with a text editor,
> shows me the text of my output.

This, AFAIK, is a known bug in IE.

Perhaps you should try reporting it to the vendor.  No, wait, that would
be Microsoft.

One workround I've sometimes found effective is not to call the script
with a URL that looks like:

http://somesite.example.com/some_script.pl

but instead

http://somesite.example.com/some_script.pl/my_browser_is_broken.txt




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

Date: Thu, 28 Oct 2004 10:36:45 -0300
From: "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>
Subject: Re: Common file operations
Message-Id: <418103fd$1$fuzhry+tra$mr2ice@news.patriot.net>

In <bf10o090o6rc71s5usu1472qv8tp5vclus@4ax.com>, on 10/27/2004
   at 10:47 PM, Michele Dondi <bik.mido@tiscalinet.it> said:

>Hmmm, maybe I should apologize... but I think you misunderstood the
>sense of my cmt: it was intended ironic, sarcastic maybe, but
>certainly not offensive. If, inadvertently, it was, then I
>apologize.

And I apologize for getting your sex wrong.

>What I meant is that at all effects what you (not too clearly)
>described seemed a good task for glob().

"the complete path" seems clear enough.

>To be precise there's no reason why it shouldn't work.

The documentation doesn't claim that it returns a complete[1] path,
and an experiment shows that it doesn't. Have you seen code that
causes glob to return a complete path?

>If for any reason it didn't work for me,
>then I'd suspect about me having done something wrong, however
>deeply hidden the error may be, rather than blaming glob().

I wasn't "blaming" glob, simply noting that it didn't have the
functionality that I wanted.

>minimal example

You've already commented on my sample code in a later article.

>D'Oh! I'm sorry to inform you that your perl installation is
>broken...

So it would seem, but since I rely on documentation[1] built from the
same POD, it hasn't been an issue for me.

>Sorry, but I think that you didn't clearly say what it is that you
>want.

 1. If I have a partial file name, how do I get the complete path?

The answer seems to be Cwd::abs_path

 2. If I have a directory name and a file specification, how do I find
    all files in that directory matching the specification. File::Find
    and issuing an ls command seem like overkill. I could use readdir
    if I don't need a recursive search, but I was hoping for an 
    equivalent of SysFileTree in OS/2.

There doesn't seem to be a single service that will handle recursion.
File::Find as documented doesn't do the matching. What I'm looking for
is a directory tree-walking function that applies matching criteria
and only returns the files meeting those criteria. If I drop the
requirement for recursion then calling glob with the output of
abs_path would work.

>Care to expand?

The term "dead tree" is a slang term for hard copy (printed)
documentation. Much of the information in the online documentation is
available in "Programming Perl" and "Perl in a Nutshell" from
O'Reilly.

[1] Assuming that the input didn't have a complete path.

[2] Specifically, a .inf file for the OS/2 view command.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Thu, 28 Oct 2004 11:13:19 -0300
From: "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>
Subject: Re: Common file operations
Message-Id: <41810c8f$2$fuzhry+tra$mr2ice@news.patriot.net>

In <31bvn0pnelmb5sgm3k5ds5ffcjavv4lfjn@4ax.com>, on 10/27/2004
   at 04:34 PM, Michele Dondi <bik.mido@tiscalinet.it> said:

>BTW: do you really need -T?

Probably not; I just assumed that it was prudent to make a habit of
it.

>Also, with modern perls it's better to
>  use warnings;

Do you mean instead of the taint flag?

>Huh?!? Don't do this! Well, if you really really like...

A. Sinan Unur already commented on it; if it's consider poor Perl
style then I won't do it.


>> my ($dir,$file)=@ARGV;

>Hmmm, then I'd rather do (somthing like):
>  @ARGV == 2 or die "Usage: $0 <wildcard> <file>\n";

ITYM in additon to the existing code.

>Not a real issue, but are you sure you want to print all these info?

The entire file is strictly for investigating the actual behavior of
various Perl functions; those data tell me whether the functions do
what I expect. I won't be putting anything like that in production
code, except possibly under the control of a debugging flag.

>Hey, and you said you had never heard about regexen...

Correct. Check the spelling ;-)

>However... you're just removing possible C<'>s from at ^ or $,
>right?

Yes. I need to be able to pass command arguments containing * without
the shell interpreting the * as a wildcard. The only other technique
that I came up with was keying the argument with \* instead of *,
which I would have found to be more of a nuisance than the
apostrophes.

>Then I suggest you do something like
>  s/^'//, s/'$// for $dir;

Thanks. In this case efficiency is irelevant, but if I need to do
something similar inside a loop, is the clear version as fast as the
other?

>Oh, this one too, then why not doing them both in one run?

It was incremental Q&D code.

>Also, still if you really *do* want to print all those info, then
>for clarity resons you may consider an HERE doc instead.

EXPN?

>This is not required

Thanks.

>You may have used
>  @dirs=grep -d, glob $dir;

Thanks. Although I'd still need to test that the count was 1.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Thu, 28 Oct 2004 12:02:58 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Debugger Error
Message-Id: <1098979432.166071@nntp.acecape.com>

afternoon all,

my debugger is pointing to an error/warning that doesn't
stop my program but is complaining about one of the
perl modules.  now i know some warnings that occur while
debugging in C can be overlooked, with perl i do not know
 .
this occurs the moment i run my app, and hit my first line of
code.  and it doesn't matter WHAT that first line is, even
my $test_var = "1";
will do it.  and again this is before executing any of my code.
so am guessing it occurs in the "use" statements, which are:

use warnings;
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use DBI;
use Net::POP3;

i am on:
platform: windows & open-perl-ide

error warning in debugger..is
DBI.pm: Use of uninitialized value in join or string at
 ..\..\OpenPerlIDE/perl5db.pl line 624.
and it points to this line in the perl5db.pl
$SubInfo .= '('.join(', ', @test).')';

i have googled, checked DBI for bugs listing etc., perldoc'ed a
bunch of words i had hoped might work,  nothing.   so was hoping someone
here
might have an incling of what's going on.

again my code does work, but i would like to know what this warning is,
so it doesn't blow up in my face later.

thanks ahead.




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

Date: Thu, 28 Oct 2004 19:15:25 +0200
From: Matija Papec <perl@my-header.org>
Subject: Re: Debugger Error
Message-Id: <6u92o055bhsd6m8tomarcctjqn4hbmi1n9@4ax.com>

X-Ftn-To: daniel kaplan 

"daniel kaplan" <nospam@nospam.com> wrote:
>bunch of words i had hoped might work,  nothing.   so was hoping someone
>here
>might have an incling of what's going on.
>
>again my code does work, but i would like to know what this warning is,
>so it doesn't blow up in my face later.

When you enable warnings, perl wants to tell you everything that looks
suspicious, and using uninitialized variables falls into this category. You
might want to disable this particular warning:

use warnings;
no warnings qw/uninitialized/;
use strict;
my $s;
print $s;



-- 
Matija


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

Date: Thu, 28 Oct 2004 17:25:34 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Debugger Error
Message-Id: <iY9gd.4220$Xq3.1724@trndny01>

"daniel kaplan" <nospam@nospam.com> wrote in message
news:1098979432.166071@nntp.acecape.com...
> afternoon all,
>
> my debugger is pointing to an error/warning that doesn't
> stop my program but is complaining about one of the
> perl modules.  now i know some warnings that occur while
> debugging in C can be overlooked, with perl i do not know
> .
> this occurs the moment i run my app, and hit my first line of
> code.  and it doesn't matter WHAT that first line is, even
> my $test_var = "1";
> will do it.  and again this is before executing any of my code.
> so am guessing it occurs in the "use" statements, which are:
>
> use warnings;
> use strict;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
> use DBI;
> use Net::POP3;
>
> i am on:
> platform: windows & open-perl-ide
>
> error warning in debugger..is
> DBI.pm: Use of uninitialized value in join or string at
> ..\..\OpenPerlIDE/perl5db.pl line 624.
> and it points to this line in the perl5db.pl
> $SubInfo .= '('.join(', ', @test).')';

"Your" debugger is pointing to a warning caused within your IDE.  I'm
not at all familiar with "Open Perl IDE", so I can't speak as to what
it's doing to your code, but the above error woudl seem to indicate it's
linking your program to some of its own internal resources, which are
throwing errors.

I would suggest compiling and testing your code the 'normal' way.  (ie,
run it from a command line, not from within your IDE), and see if you
still get that error.

Paul Lalli




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

Date: Thu, 28 Oct 2004 13:57:52 -0400
From: Laura <lwt0301@bellsouth.net>
Subject: Re: Debugger Error
Message-Id: <10o2cv4ka6rf40f@news.supernews.com>

daniel kaplan wrote:

> afternoon all,
> 
> my debugger is pointing to an error/warning that doesn't
> stop my program but is complaining about one of the
> perl modules.  now i know some warnings that occur while
> debugging in C can be overlooked, with perl i do not know
> .
> this occurs the moment i run my app, and hit my first line of
> code.  and it doesn't matter WHAT that first line is, even
> my $test_var = "1";
> will do it.  and again this is before executing any of my code.
> so am guessing it occurs in the "use" statements, which are:
> 
> use warnings;
> use strict;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);

This line 'fatalsToBrowser' is awsome.  You can actually see your warnings
and errors by looking at your web page in your browser.  You can pick up
warnings and errors that don't come up if you run your program from the
command line.

> use DBI;
> use Net::POP3;
> 
> i am on:
> platform: windows & open-perl-ide
> 
> error warning in debugger..is
> DBI.pm: Use of uninitialized value in join or string at
> ..\..\OpenPerlIDE/perl5db.pl line 624.
> and it points to this line in the perl5db.pl
> $SubInfo .= '('.join(', ', @test).')';
> 
> i have googled, checked DBI for bugs listing etc., perldoc'ed a
> bunch of words i had hoped might work,  nothing.   so was hoping someone
> here
> might have an incling of what's going on.
> 
> again my code does work, but i would like to know what this warning is,
> so it doesn't blow up in my face later.
> 
> thanks ahead.



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

Date: Thu, 28 Oct 2004 16:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 8.43: How do I open a file without blocking?
Message-Id: <clr57l$ejr$1@reader1.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

8.43: How do I open a file without blocking?

    If you're lucky enough to be using a system that supports non-blocking
    reads (most Unixish systems do), you need only to use the O_NDELAY or
    O_NONBLOCK flag from the Fcntl module in conjunction with sysopen():

        use Fcntl;
        sysopen(FH, "/foo/somefile", O_WRONLY|O_NDELAY|O_CREAT, 0644)
            or die "can't open /foo/somefile: $!":



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

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


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