svn - Perl script : Run from command line vs inside the script -
when run command line -- works.
$ svn log http://svn.test.com/svn/trunk --stop-on-copy | perl -lne 'begin{$/="-"x72; $re = shift} /$re/ , ($_)=split , print' jira-123456 r1 r2 r3
but when run inside script error:
$ perl svn_promote.pl syntax error @ -e line 2, near "=" begin not safe after errors--compilation aborted @ -e line 2. svn: e720232: write error: pipe being closed.
i'm trying revisions trunk have been committed jira ticket in svn comments. script have 2 args passed - url
, jira ticket#
script:
$ cat svn_promote.pl #!/usr/bin/perl use strict; use warnings; $svn_url=$argv[0]; print "$svn_url\n"; $jira_ticket=$argv[1]; print "$jira_ticket\n"; @revs = `svn log $svn_url --stop-on-copy | perl -lne 'begin{$/="-"x72; $re = shift} /$re/ , ($_)=split , print' $jira_ticket`; chomp (@revs) print "$revs\n";
error:
$ perl svn_promote.pl global symbol "$re" requires explicit package name @ svn_promote.pl line 13. global symbol "$re" requires explicit package name @ svn_promote.pl line 13. syntax error @ svn_promote.pl line 16, near ") print" execution of svn_promote.pl aborted due compilation errors.
Comments
Post a Comment