I am trying to connect to a database using perl. I tried to follow this tutorial https://metacpan.org/pod/release/RIBASUSHI/DBIx-Class-0.082840/lib/DBIx/Class.pod and create a simple app named MyApp as they made and create the files exactly as they did but when I compile the CD.pm file I am getting the error Can't locate MyApp/Schema.pm in @INC (you may need to install the MyApp::Schema module).
The program is looking like that in Atom using package Script to run the code on ubuntu:
MyApp---
| |
| Schema--
| |
| Result-----
| | |
| Artist.pm CD.pm
|
Schema.pm
#Schema.pm
package MyApp::Schema;
use base qw/DBIx::Class::Schema/;
__PACKAGE__->load_namespaces();
1;
#CD.pm
package MyApp::Schema::Result::CD;
use base qw/DBIx::Class::Core/;
__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
__PACKAGE__->table('cd');
__PACKAGE__->add_columns(qw/ cdid artistid title year /);
__PACKAGE__->set_primary_key('cdid');
__PACKAGE__->belongs_to(artist => 'MyApp::Schema::Result::Artist', 'artistid');
1;
#Artist.pm
package MyApp::Schema::Result::Artist;
use base qw/DBIx::Class::Core/;
__PACKAGE__->table('artist');
__PACKAGE__->add_columns(qw/ artistid name /);
__PACKAGE__->set_primary_key('artistid');
__PACKAGE__->has_many(cds => 'MyApp::Schema::Result::CD', 'artistid');
1;