For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > July 2005 > glob question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author glob question
s99999999s2003@yahoo.com

2005-07-28, 10:00 pm

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 :-)

xhoster@gmail.com

2005-07-29, 5:03 pm

s99999999s2003@yahoo.com 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
Paul Lalli

2005-07-29, 5:03 pm

xhoster@gmail.com wrote:
> s99999999s2003@yahoo.com wrote:
>
> 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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com