Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/perl/lib/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ $os_name =~ s/\s+/_/g;
useperlio => 'define',

# Extensions available in PerlOnJava
extensions => 'Socket IO::Socket',
dynamic_ext => 'Socket IO::Socket',
extensions => 'Fcntl IO File/Glob Socket IO::Socket',
dynamic_ext => 'Fcntl IO File/Glob Socket IO::Socket',
static_ext => '',

# File operations
Expand Down
120 changes: 120 additions & 0 deletions src/main/perl/lib/File/Glob.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package File::Glob;

use strict;
use warnings;

our $VERSION = '1.39';

use Exporter 'import';

our @EXPORT_OK = qw(
glob
bsd_glob
GLOB_ERROR
GLOB_CSH
GLOB_NOMAGIC
GLOB_QUOTE
GLOB_TILDE
GLOB_BRACE
GLOB_NOCHECK
GLOB_NOSORT
GLOB_NOSPACE
GLOB_ABEND
GLOB_ALPHASORT
GLOB_ALTDIRFUNC
);

our %EXPORT_TAGS = (
'glob' => [ qw(
glob
bsd_glob
GLOB_ERROR
GLOB_CSH
GLOB_NOMAGIC
GLOB_QUOTE
GLOB_TILDE
GLOB_BRACE
GLOB_NOCHECK
GLOB_NOSORT
GLOB_NOSPACE
GLOB_ABEND
GLOB_ALPHASORT
GLOB_ALTDIRFUNC
) ],
);

# Constants for glob flags
use constant {
GLOB_ERROR => 0,
GLOB_CSH => 1,
GLOB_NOMAGIC => 2,
GLOB_QUOTE => 4,
GLOB_TILDE => 8,
GLOB_BRACE => 16,
GLOB_NOCHECK => 32,
GLOB_NOSORT => 64,
GLOB_NOSPACE => 128,
GLOB_ABEND => 256,
GLOB_ALPHASORT => 512,
GLOB_ALTDIRFUNC => 1024,
};

# bsd_glob implementation - use Perl's built-in glob for now
sub bsd_glob {
my $pattern = shift;
my $flags = shift || 0;

# For now, just use Perl's built-in glob
# In the future, we could implement the flags properly
return CORE::glob($pattern);
}

# Regular glob - just use built-in
sub glob {
my $pattern = shift;
return CORE::glob($pattern);
}

1;

__END__

=head1 NAME

File::Glob - Perl extension for BSD glob routine

=head1 SYNOPSIS

use File::Glob ':glob';

@list = bsd_glob('*.txt');

=head1 DESCRIPTION

This is a minimal implementation of File::Glob for PerlOnJava.
It provides basic glob functionality using Perl's built-in glob operator.

=head1 FUNCTIONS

=over 4

=item bsd_glob($pattern [, $flags])

Implements BSD-style globbing. Currently uses Perl's built-in glob.

=item glob($pattern)

Simple wrapper around Perl's built-in glob.

=back

=head1 CONSTANTS

Various GLOB_* constants are exported for compatibility.

=head1 AUTHOR

PerlOnJava Project

=cut