Re: run command from perl

2012-03-03 Thread Shlomi Fish
Hi Peter, On 2 Mar 2012 02:48:28 - Peter Scott wrote: > On Sun, 26 Feb 2012 20:30:56 +0100, Manfred Lotz wrote: > > I want to run a shell command with the following constraints: > > > > a. I like to get the return code of the command b. Furthermore I want to > > combine stdout and stderr so

Re: run command from perl

2012-03-03 Thread John W. Krahn
Shlomi Fish wrote: On 2 Mar 2012 02:48:28 - Peter Scott wrote: It doesn't have flaws. You could do it without the module with a piped open: sub run_cmd { my $cmd = shift; open my $fh, '-|', "$cmd 2>&1" or die "open: $!"; print while<$fh>; close $fh; return $?>> 8; } I

read from command line

2012-03-03 Thread lina
$ perl extract.pl try.tex Bareword "filename" not allowed while "strict subs" in use at extract.pl line 8. Execution of extract.pl aborted due to compilation errors. #!/usr/bin/env perl use strict; use warnings; my $filename = $ARGV[0] ; open FILE, "<", filename or die $!; my @line = ; whil

Re: read from command line

2012-03-03 Thread Steve Bertrand
On 2012-03-03 09:08, lina wrote: $ perl extract.pl try.tex Bareword "filename" not allowed while "strict subs" in use at extract.pl line 8. Execution of extract.pl aborted due to compilation errors. #!/usr/bin/env perl use strict; use warnings; Good. my $filename = $ARGV[0] ; open FILE, "

Re: read from command line

2012-03-03 Thread Ken Slater
On Sat, Mar 3, 2012 at 9:08 AM, lina wrote: > $ perl extract.pl try.tex > Bareword "filename" not allowed while "strict subs" in use at extract.pl line > 8. > Execution of extract.pl aborted due to compilation errors. > > > #!/usr/bin/env perl > > use strict; > use warnings; > > my $filename = $A

Re: read from command line

2012-03-03 Thread lina
Thanks for both of you. Your guys are great. Best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

write to the file whose basename is argv[0]

2012-03-03 Thread lina
Hi, I want to output the result into the file shared the same basename but different extensions, Below is what I have come up so far: perl try.tex #!/usr/bin/env perl use strict; use warnings; use File::Basename; my $bib_filename = "/home/lina/texmf/bibtex/bib/biophymd.bib"; my $bib_abbrev_f

Re: write to the file whose basename is argv[0]

2012-03-03 Thread Shlomi Fish
Hi lina, On Sun, 4 Mar 2012 00:37:58 +0800 lina wrote: > Hi, > > I want to output the result into the file shared the same basename but > different extensions, > > Below is what I have come up so far: > > perl try.tex > > #!/usr/bin/env perl > > use strict; > use warnings; > use File::Basen

Re: write to the file whose basename is argv[0]

2012-03-03 Thread Shawn H Corey
On 12-03-03 11:37 AM, lina wrote: my $tex_filename = $ARGV[0] ; # for catfile() use File::Spec; # divide the input file name into its path and name, # ignore its extension my ( $name, $path ) = fileparse( $tex_filename, qr/\.[^\.]+$/ ); # create a new name with .bib extension my $output_text_

Access class symtab by dereferencing an object

2012-03-03 Thread Steve Bertrand
Hi all, I have a need to examine and manipulate certain aspects of a class symbol table. I can do this: my $dog = Animal->new(); foreach my $entry ( keys %Animal:: ){ ... } ...but what I'd like to do is dereference the object itself to get the class, as there will be times I won't know w

Re: Access class symtab by dereferencing an object

2012-03-03 Thread Paul Johnson
On Sat, Mar 03, 2012 at 01:51:28PM -0500, Steve Bertrand wrote: > Hi all, > > I have a need to examine and manipulate certain aspects of a class > symbol table. I can do this: > > my $dog = Animal->new(); > foreach my $entry ( keys %Animal:: ){ > ... > } > > ...but what I'd like to do is der

Re: Access class symtab by dereferencing an object

2012-03-03 Thread Uri Guttman
On 03/03/2012 01:51 PM, Steve Bertrand wrote: Hi all, I have a need to examine and manipulate certain aspects of a class symbol table. I can do this: you claim you have this need but given your skill level, i wonder if that is actually a real need. please state the larger problem you are tr

Re: Access class symtab by dereferencing an object

2012-03-03 Thread Steve Bertrand
On 2012-03-03 14:18, Paul Johnson wrote: On Sat, Mar 03, 2012 at 01:51:28PM -0500, Steve Bertrand wrote: Is there a proper way to do this that someone could point out? no strict "refs"; foreach my $entry ( keys %{ ref($dog) . "::" }) But why? If you really need class introspection then OK,

Re: Access class symtab by dereferencing an object

2012-03-03 Thread Paul Johnson
On Sat, Mar 03, 2012 at 02:42:35PM -0500, Steve Bertrand wrote: > I've been writing a program that will perform extra work for > diagnostics upon each method call. > > As of now, I need to write a call to an outside function manually > into each method. To automate this so the original methods do

Re: Access class symtab by dereferencing an object

2012-03-03 Thread Uri Guttman
On 03/03/2012 02:42 PM, Steve Bertrand wrote: I've been writing a program that will perform extra work for diagnostics upon each method call. attributes can do that for each sub. there are modules that let you call code before/after each method call. or class techniques that allow that.

has anyone used perl CGI scripts with Hiawatha web server?

2012-03-03 Thread Rajeev Prasad
Anyone has any experience to share about implementing perl CGI scripts on Hiawatha web server? ty. R 

Rasberry Pi

2012-03-03 Thread Bill Stephenson
I was wondering if anyone here has looked into the Rasberry Pi project? I just got wind of it a couple days ago and it looks pretty exciting. From their home page: "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be use

Re: Rasberry Pi

2012-03-03 Thread Manuel Cantu Reinhard
Thanks for the share. Some of us already know. Bad thing is there will be a long waiting list. There is more demand than they can supply. Best Regards, Manuel On Sat, Mar 3, 2012 at 10:08 PM, Bill Stephenson wrote: > I was wondering if anyone here has looked into the Rasberry Pi project? > > I

Re: run command from perl

2012-03-03 Thread Peter Scott
On Fri, 02 Mar 2012 21:31:50 +0100, Manfred Lotz wrote: > Another question I have: Where do I find what '-|' means? I mean the > minus before the pipe char. perldoc -f open -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ http://www.informit.com/store/product.aspx?isbn=

Re: run command from perl

2012-03-03 Thread Manfred Lotz
On 4 Mar 2012 05:03:55 - Peter Scott wrote: > On Fri, 02 Mar 2012 21:31:50 +0100, Manfred Lotz wrote: > > Another question I have: Where do I find what '-|' means? I mean the > > minus before the pipe char. > > perldoc -f open > > Thanks, found it there. -- Manfred -- To unsubscribe