CLI-refbase as system cmd in another script?

Help
2010-11-25
2013-05-28
  • I want to use the extract/append possibility offered by the CLI to integrate refbase with latexmk by setting up a latexmk-"custom dependency" for generating *.bib from *.aux.
    While trying this, I realized a strange (at least to me) behavior: If the "refbase" Perl-script is called directly from the prompt, everything works fine. However, if called from within a wrapper (Perl-)script by invoking

    system("refbase --host=http://beta.refbase.net/ --user=user@refbase.net --password=user --extract='foo.aux' --format=bibtex --append='foo.bib' --update=1");
    

    the refbase-server responds with:

    {

    Your query:

    SELECT author, title, type, year, publication, abbrev_journal, volume, issue, pages, keywords, abstract, address, corporate_author, thesis, publisher, place, editor, language, summary_language, orig_title, series_editor, series_title, abbrev_series_title, series_volume, series_issue, edition, issn, isbn, medium, area, expedition, conference, notes, approved, contribution_id, online_publication, online_citation, created_date, created_time, created_by, modified_date, modified_time, modified_by, call_number, serial, orig_record, serial, file, url, doi, isbn, type FROM refs WHERE ((cite_key RLIKE "^(Eisenlohr2004|Roters_etal2010)$")) ORDER BY author, year DESC, publication

    caused the following error:

    Error 1054: Unknown column 'cite_key' in 'where clause'
    }

    I confirmed this with my own as well as with the beta.refbase.net server…

    Any clue what the difference in direct versus "system" calling might be??

    Thanks for help
    Philip

     
  • Problem is solved: Perl "system" call requires single ticks, not quotes…

    So a working latexmk custom dependency would look like:

    add_cus_dep( 'aux', 'bib', 0, 'refbase' );
    sub refbase
    {
      $source = $_[0];
      unlink ("$source.bib");
      system('refbase'.
             ' --host=http://murefbase/refbase/'.
             ' --user=user@host.to'.
             ' --password=theSecReT'.
             ' --extract='.$source.'.aux'.
             ' --format=bibtex'.
             ' --append='.$source.'.bib'.
             ' --update=1');
    }