Pattern::Bond(3)
π Pattern::Bond(3) π
okay bestie, welcome to Chemistry::Pattern::Bond, a little corner of the User Contributed Perl Documentation and honestly? she's iconic. pull up a chair π«Ά
β¨ NAME β¨
Chemistry::Pattern::Bond β a bond that knows how to match π
πΈ SYNOPSIS πΈ
my $patt_bond = Chemistry::Pattern::Bond->new(order => 2);
$patt_bond->test_sub( sub {
my ($what, $where) = @_;
$where->type eq 'purple' ? 1 : 0; # only match purple bonds
});
like yes, you can absolutely just make one with an order, or you can get fancy and hand her a whole custom test sub. main character energy fr fr π
π¦ DESCRIPTION π¦
so basically, objects of this class represent bonds in a pattern. she's a subclass of Chemistry::Bond, so she inherited all the regular bond stuff β but on top of that, pattern bonds have a method for testing if they match a bond in a molecule. that's the whole point of her existence, no cap.
by default, a pattern bond matches a bond if they have the same bond order or both are aromatic. cute, right?
and if that default isn't giving what you need? you can swap it out for an arbitrary criterion by providing a custom test subroutine. your pattern, your rules β¨
π METHODS π
$patt_bond->test($bond)β tests if the pattern bond matches the bond given by$bond. returns true or false. simple, clean, slay.$patt_bond->test_sub(\&my_test_sub)β specify an arbitrary test subroutine to be used instead of the default one.&my_test_submust take two parameters; the first one is the pattern bond and the second is the bond to match. it must return true if there is a match. that's it, that's the contract π₯$patt_bond->map_to([$bond])β returns or sets the bond that is considered to be matched by$patt_bond. she's a getter and a setter, a true multi-hyphenate π
β VERSION β
0.27 β yeah she's been around, she's got lore
π SEE ALSO π
Chemistry::Pattern- The PerlMol website
<http://www.perlmol.org/>β go look, it's giving resources
π AUTHOR π
Ivan Tubert-Brohman <itub@cpan.org> β thank you for your service π«‘
π COPYRIGHT π
Copyright (c) 2009 Ivan Tubert-Brohman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
like, legally speaking: free software, same terms as Perl itself, you know the vibe π
real talk though: the legal bits above stay exactly as written, bestie. i'm just here for the vibes, not to rewrite a license π
and that's the whole page!! this one came from perl v5.42.0, dated 2026-01-17, and it's filed under Pattern::Bond(3). go forth and match some bonds, you've got this π§π
π¦ where this page comes from
- fedora 44: perl-Chemistry-Pattern 0.27-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms