Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Wise ones :) I am making my first attempt at using a perl module (Bio::PrimerDesigner)and am needing some guidance. Here is the relevant part of my code, which is just me trying to copy the synopsis in the CPAN listing for this module. There is code prior the my $pd line and after the "use Bio::PrimerDesigner" that defines the %probe_hash in this script.
#!/usr/bin/env perl use strict; use File::Copy; use warnings; use diagnostics; use Bio::PrimerDesigner; my $pd = Bio::PrimerDesigner->new; while ((my $probe_key, my $probe_value)=each(%probe_hash)) { # # Define the DNA sequence, etc. # my $dna = $probe_value; my $seqID = $probe_key; # # Define design parameters (native primer3 syntax) # my %params = ( PRIMER_NUM_RETURN => 2, PRIMER_SEQUENCE_ID => $seqID, SEQUENCE => $dna, PRIMER_PRODUCT_SIZE => '500-600' ); # # Design primers # my $results = $pd->design( %params ) or die $pd->error; # # Make sure the design was successful # if ( !$results->left ) { die "No primers found\n", $results->raw_data; } # # Get results (single primer set) # my $left_primer = $results->left; my $right_primer = $results->right; my $left_tm = $results->lefttm; # # Get results (multiple primer sets) # my @left_primers = $results->left(1..3); my @right_primers = $results->right(1..3); my @left_tms = $results->lefttm(1..3); }
When I run this, I get the following error: No alias for 'PRIMER_PRODUCT_SIZE' at /script/location also, if I "print @left_primers;" will that print the contents of the array as expected?

Replies are listed 'Best First'.
Re: Uncaught Exception from user code: no alias for...
by toolic (Bishop) on Feb 20, 2009 at 21:45 UTC
      Thanks, I will do that now.
Re: Uncaught Exception from user code: no alias for...
by Bloodnok (Vicar) on Feb 20, 2009 at 21:02 UTC
    I'm afraid I know nothing about the module of which you speak, but as to your second question, I'm not quite sure what you expected, but print "@array"; will stringify the array and print it as a conjoined string i.e. no separators - newlines etc. ... to do that, you'll need to either use Data::Dumper, Recipe 4.2 from the Cookbook or a version of Recipe 5.5 (also from the Cookbook).

    A user level that continues to overstate my experience :-))
Re: Uncaught Exception from user code: no alias for...
by Narveson (Chaplain) on Feb 20, 2009 at 20:57 UTC

    Thanks for reporting the error, but does it really say at/script/location or are you omitting detail?

    If the error points you to an actual location in your code, flag that location for us.

      sorry, it indicates line 277 which corresponds to the line containing
      my $results = $pd->design( %params ) or die $pd->error;
Re: Uncaught Exception from user code: no alias for...
by Osiris1975 (Novice) on Feb 20, 2009 at 20:44 UTC
    sorry this is my question, didnt realize I was not logged in :)