glob question

Discussion in 'Perl Misc' started by s99999999s2003@yahoo.com, Jul 29, 2005.

  1. Guest

    hi
    i have a piece of perl code like this

    ....
    print "$globbed\n" ; # this output gives *.txt
    process($globbed);

    ....

    sub process {
    my $pattern = $_[0];
    while ( glob $pattern ) {
    ....

    }

    }
    when the sub process is executed, i have an error
    " glob failed (child exited with status 1) "

    thanks very much for any help rendered :)
    , Jul 29, 2005
    #1
    1. Advertising

  2. Guest

    wrote:
    > hi
    > i have a piece of perl code like this
    >
    > ...
    > print "$globbed\n" ; # this output gives *.txt
    > process($globbed);
    >
    > ...
    >
    > sub process {
    > my $pattern = $_[0];
    > while ( glob $pattern ) {
    > ....
    >
    > }
    >
    > }
    > when the sub process is executed, i have an error
    > " glob failed (child exited with status 1) "
    >
    > thanks very much for any help rendered :)


    What version of Perl? OS?
    What if you change the while to a foreach?

    Maybe this is relevant:
    Is there a leak/bug in glob()?

    Due to the current implementation on some operating systems,
    when you use the glob() function or its angle-bracket alias
    in a scalar context, you may cause a memory leak and/or
    unpre- dictable behavior. It's best therefore to use glob()
    only in list context.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    , Jul 29, 2005
    #2
    1. Advertising

  3. Paul Lalli Guest

    wrote:
    > wrote:
    > > hi
    > > i have a piece of perl code like this
    > >
    > > ...
    > > print "$globbed\n" ; # this output gives *.txt
    > > process($globbed);
    > >
    > > ...
    > >
    > > sub process {
    > > my $pattern = $_[0];
    > > while ( glob $pattern ) {
    > > ....
    > >
    > > }
    > >
    > > }
    > > when the sub process is executed, i have an error> > " glob failed (child exited with status 1) "
    > >
    > > thanks very much for any help rendered :)

    >
    > What version of Perl? OS?
    > What if you change the while to a foreach?
    >
    > Maybe this is relevant:
    > Is there a leak/bug in glob()?


    I think the relevant entry from perldoc perldiag is more relevant:

    glob failed (%s)
    (W glob) Something went wrong with the external
    program(s) used for "glob" and "<*.c>". Usually, this
    means that you supplied a "glob" pattern that caused the
    external program to fail and exit with a nonzero status.
    If the message indicates that the abnormal exit resulted
    in a coredump, this may also mean that your csh (C
    shell) is broken. If so, you should change all of the
    csh-related variables in config.sh: If you have tcsh,
    make the variables refer to it as if it were csh (e.g.
    "full_csh='/usr/bin/tcsh'"); otherwise, make them all
    empty (except that "d_csh" should be "'undef'") so that
    Perl will think csh is missing. In either case, after
    editing config.sh, run "./Configure -S" and rebuild
    Perl.

    Paul Lalli
    Paul Lalli, Jul 29, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Georgy Pruss
    Replies:
    15
    Views:
    712
    Tim Roberts
    Dec 1, 2003
  2. Tim Peters
    Replies:
    1
    Views:
    348
    Duncan Booth
    Dec 1, 2003
  3. Sean Berry

    Question about glob.glob <--newbie

    Sean Berry, May 4, 2004, in forum: Python
    Replies:
    3
    Views:
    340
    David M. Cooke
    May 4, 2004
  4. Elbert Lev

    glob.glob unicode bug or feature

    Elbert Lev, Jul 31, 2004, in forum: Python
    Replies:
    5
    Views:
    382
    Neil Hodgson
    Aug 2, 2004
  5. Hitesh

    glob.glob output

    Hitesh, Mar 12, 2007, in forum: Python
    Replies:
    6
    Views:
    384
    Hitesh
    Mar 13, 2007
Loading...

Share This Page