validate_email($email)

INPUT

$email - string (5-254 chars), email address

Returns: 1 if valid

method($param)

Parameters: $param - string (5-50 chars), description ```

### Format 2: Type Keywords

```perl =head2 method($param)

Parameters: $param - integer, positive number $email - string, matches /\@/ $config - hashref, configuration options ```

### Format 3: Constraint Description

```perl =head2 method($count)

Parameters: $count - integer (min 1, max 100), item count ```

## Improving Accuracy

### Write Better POD

Good documentation = better extraction:

```perl # ✓ Good - specific and clear =head2 validate_age($age)

Parameters: $age - integer (1-150), person's age in years ```

```perl # ✗ Bad - vague =head2 validate_age($age)

Validates age. ```

### Add Type Comments

Help the extractor with inline comments:

```perl sub process { my ($self, $data) = @_; # $data is arrayref

croak unless ref($data) eq 'ARRAY';
# ... rest of code
}
```

### Use Consistent Validation

Standard patterns are easier to detect:

```perl # ✓ Detectable croak "Too short" unless length($str) >= 5; croak "Too long" unless length($str) <= 100;

# ✗ Hard to detect my $len = length($str); die "Bad length" if $len < 5 || $len > 100; ```

## Troubleshooting

### Low Confidence Scores

**Problem**: Most methods rated "low confidence"

**Solutions**: 1. Add POD documentation with parameter types 2. Use explicit validation (ref checks, length checks) 3. Review and manually edit generated schemas

### Missing Parameters

**Problem**: Parameters not detected

**Solutions**: 1. Ensure parameters are in the signature: `my ($self, $param) = @_;` 2. Document parameters in POD 3. Add manual schema entries

### Wrong Types

**Problem**: Incorrect type inference

**Solutions**: 1. Add explicit type in POD: `$param - integer` 2. Add ref checks in code: `ref($param) eq 'HASH'` 3. Manually correct the YAML file

### Regex Patterns Not Captured

**Problem**: Regex validation not detected

**Solutions**: 1. Use simple pattern: `$param =~ /pattern/` 2. Document in POD: `$param - string, matches /pattern/` 3. Add manually to YAML: `matches: '/pattern/'`

## Limitations

1. **No Type System**: Perl has no native types, so inference is heuristic-based 2. **Dynamic Code**: Cannot analyze runtime-conditional validation 3. **Complex Logic**: Nested if/else validation is hard to parse 4. **Context-Dependent**: Same parameter might have different types in different contexts

## Roadmap

- [ ] Support for Moose/Moo type constraints - [ ] Function::Parameters signature parsing - [ ] Type::Tiny integration - [ ] Machine learning to improve heuristics - [ ] Interactive review mode - [ ] Batch processing for entire directory trees

## Contributing

To improve the extractor:

1. Test on real modules and report accuracy 2. Submit examples of patterns that aren't detected 3. Suggest new heuristics or validation patterns 4. Improve POD parsing patterns

## License

This software is free and open source.

## See Also

- [App::Test::Generator](https://github.com/nigelhorne/App-Test-Generator) - [PPI](https://metacpan.org/pod/PPI) - Perl parsing - [Pod::Simple](https://metacpan.org/pod/Pod::Simple) - POD parsing

## Author

Created with assistance from Claude (Anthropic)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 231:

Non-ASCII character seen before =encoding in '✓'. Assuming UTF-8