PickLE

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

README.md
contrib/eagle-bom-export.csv
contrib/example.pkl
cpanfile
lib/App/pickle/OptArgs.pm
lib/App/pickle/export.pm
lib/App/pickle/import.pm
lib/PickLE.pm
lib/PickLE/Category.pm
lib/PickLE/Component.pm
lib/PickLE/Converter/EagleBOM.pm
lib/PickLE/Document.pm
lib/PickLE/Exporter/HTML.pm
lib/PickLE/Exporter/JSON.pm
lib/PickLE/Property.pm
minil.toml
script/pickle
script/picklews
t/01_property.t
t/02_component.t
t/03_category.t

META.json  view on Meta::CPAN

      "PickLE" : {
         "file" : "lib/PickLE.pm",
         "version" : "v0.1.0"
      },
      "PickLE::Category" : {
         "file" : "lib/PickLE/Category.pm"
      },
      "PickLE::Component" : {
         "file" : "lib/PickLE/Component.pm"
      },
      "PickLE::Converter::EagleBOM" : {
         "file" : "lib/PickLE/Converter/EagleBOM.pm"
      },
      "PickLE::Document" : {
         "file" : "lib/PickLE/Document.pm"
      },
      "PickLE::Exporter::HTML" : {
         "file" : "lib/PickLE/Exporter/HTML.pm"
      },
      "PickLE::Exporter::JSON" : {
         "file" : "lib/PickLE/Exporter/JSON.pm"
      },

META.yml  view on Meta::CPAN

    file: lib/App/pickle/export.pm
  App::pickle::import:
    file: lib/App/pickle/import.pm
  PickLE:
    file: lib/PickLE.pm
    version: v0.1.0
  PickLE::Category:
    file: lib/PickLE/Category.pm
  PickLE::Component:
    file: lib/PickLE/Component.pm
  PickLE::Converter::EagleBOM:
    file: lib/PickLE/Converter/EagleBOM.pm
  PickLE::Document:
    file: lib/PickLE/Document.pm
  PickLE::Exporter::HTML:
    file: lib/PickLE/Exporter/HTML.pm
  PickLE::Exporter::JSON:
    file: lib/PickLE/Exporter/JSON.pm
  PickLE::Property:
    file: lib/PickLE/Property.pm
requires:
  JSON::MaybeXS: '1.004003'

lib/App/pickle/OptArgs.pm  view on Meta::CPAN

			isa      => 'Str',
			required => 1,
		);
	},
);

subcmd 'App::pickle::import' => (
	comment => 'Converts another file into a PickLE pick list',
	optargs => sub {
		arg 'type' => (
			comment  => 'File type. Supported formats: eagle (Eagle BOM CSV)',
			isa      => 'Str',
			required => 1,
		);

		arg 'file' => (
			comment  => 'File to be imported',
			isa      => 'Str',
			required => 1,
		);
	},

lib/App/pickle/import.pm  view on Meta::CPAN


package App::pickle::import;

use strict;
use warnings;
use autodie;
use utf8;
use Moo;

use PickLE::Document;
use PickLE::Converter::EagleBOM;

=head1 ATTRIBUTES

=over 4

=item I<document>

PickLE parsed document object.

=cut

lib/App/pickle/import.pm  view on Meta::CPAN


sub import_file {
	my ($self) = @_;

	# Make the type lowercase for good measure.
	$self->{type} = lc($self->{type});

	# Check if we are even able to import this file.
	if ($self->{type} eq 'eagle') {
		# Eagle CAD.
		my $bom = PickLE::Converter::EagleBOM->load($self->{file});
		$self->_set_document($bom->document);

		return;
	}

	# Unknown type to import.
	die "Unknown type of file to be imported. Supported types: eagle\n";
}

1;

lib/PickLE/Converter/EagleBOM.pm  view on Meta::CPAN

#!/usr/bin/env perl

=head1 NAME

C<PickLE::Converter::EagleBOM> - Converts an EAGLE exported BOM CSV file

=cut

package PickLE::Converter::EagleBOM;

use strict;
use warnings;
use autodie;
use Moo;
use Text::CSV;

use PickLE::Document;
use PickLE::Property;
use PickLE::Category;
use PickLE::Component;

=head1 ATTRIBUTES

=over 4

=item I<document>

Converted BOM into a L<PickLE::Document> object.

=cut

has document => (
	is      => 'ro',
	lazy    => 1,
	default => sub { PickLE::Document->new },
	writer  => '_set_document'
);

=back

=head1 METHODS

=over 4

=item I<$bom> = C<PickLE::Converter::EagleBOM>->C<load>(I<$csvfile>)

Initializes the converter with a CSV file of a BOM exported straight out of
Eagle.

=cut

sub load {
	my ($proto, $csvfile) = @_;
	my $self = (ref $proto) ? $proto : $proto->new;

	# Setup the CSV parser.
	my $csv = Text::CSV->new({



( run in 0.740 second using v1.01-cache-2.11-cpan-e9daa2b36ef )