zoned decimal
Is there a module that deals with zoned decimal from the mainframe '}' is plus zero for example, after it is converted to ASCII? Convert::IBM390 only seems to handle it in ebcdic format and it is already mucked up before we get the file. -- Ken Foskey FOSS developer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re[2]: HTML::TreeBuilder - finding a text element
ok, thx a lot Sunday, March 25, 2007, 9:38:08 PM, you wrote: > Brandino Andreas wrote: >> >> Hi list >> I am using HTML::TreeBuilder to parse a html page and find a specific >> value. >> >> When i dump the array i get this: >> $tree->dump(); >> more.. >> @0.1.0.1.1.0.0.0.0 >> @0.1.0.1.1.0.0.0.0.0 >> "MAC Address" >> @0.1.0.1.1.0.0.0.1 >> @0.1.0.1.1.0.0.0.2 >> @0.1.0.1.1.0.0.0.2.0 >> "000D28D760B6" >>@0.1.0.1.1.0.0.1 >> @0.1.0.1.1.0.0.1.0 >> more.. >> >> Is there any way to get the "000D28D760B6" value by using >> "@0.1.0.1.1.0.0.0.2.0" somehow? look_down function is accepting the >> "dotted sequence of number" (the tree postition) so i can get the >> value ? > my $address = $tree->address('0.1.0.1.1.0.0.0.2.0')->as_trimmed_text; > Rob <> --- --- --- <> Brandino Andreas [EMAIL PROTECTED] <> --- --- --- <> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: zoned decimal
Ken Foskey wrote: Is there a module that deals with zoned decimal from the mainframe '}' is plus zero for example, after it is converted to ASCII? Convert::IBM390 only seems to handle it in ebcdic format and it is already mucked up before we get the file. Hi Ken. There's nothing I know about, but how about using Convert::IBM390 to convert your stuff back to EBCDIC and then to unpack it as zoned decimal? Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: File::Find again
On 3/25/07, Alan <[EMAIL PROTECTED]> wrote: On Sunday 25 March 2007 18:14, Matt Herzog wrote: > This is all I needed. I swear I had " /($searchstring)/; " in there at > some point before . . . so if I pass it > > -s "\.properties$" > > at the command line, it works as expetcted. Nice. That might be a shell thing? In Linux bash shell those quotes (I think) tell the shell to not interpret anything inside the quotes. bash quotes work like perl quotes: echo "$PS1" echo '$PS1' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Add directories to @INC
I see that there are a lot of people wanting to know how to add directories to their @INC permanently. I accomplished this by adding the following line to the end of my startup.pl file: push(@INC, "Put path to directory here"); Restart apache and you should be good to go! Hope this helps.
Re: Add directories to @INC
> >I accomplished this by adding the following line to the end of my >startup.pl file: push(@INC, "Put path to directory here"); > This is not mod_perl list. Since we discuss about common perl scripts not mod_perl,so your way seems not useful here. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
How do I generate a hash from an xml document?
What are the general steps to building a hash from and xml document? Here are my steps: 1. Read in xml document using XML::Simple 2. Create and empty hash 3. Loop through $VAR1 (the anonymous datastructure) and populate hash Is this the general idea or is there a simplier way? Thanks to all, DA
Re: How do I generate a hash from an xml document?
On 26 Mar 2007 at 11:55, Dave Adams wrote: > What are the general steps to building a hash from and xml document? > > Here are my steps: > > 1. Read in xml document using XML::Simple > 2. Create and empty hash > 3. Loop through $VAR1 (the anonymous datastructure) and populate hash > > Is this the general idea or is there a simplier way? > > Thanks to all, > DA > XML::Simple will return a hash reference from a file handle. $VAR1 is the root of the XML document which comes from Data::Dumper. use strict; use warnings; use XML::Simple; use Data::Dumper; my $file = 'myfile.xml'; my $config = XMLin($file); # $config is a reference to a hash; print Dumper($config); # Print the hash reference. or print $config->{'somevalue'},"\n"; # To see a single value # from the doc. HTH, Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: How do I generate a hash from an xml document?
Dave Adams wrote: What are the general steps to building a hash from and xml document? Here are my steps: 1. Read in xml document using XML::Simple 2. Create and empty hash 3. Loop through $VAR1 (the anonymous datastructure) and populate hash Is this the general idea or is there a simplier way? Hi Dave The result of XMLin is already a reference to a hash representation of the XML. If you're looking at the XML::Simple documentation that says you can dump the hash using Data::Dumper then that's not a part of using XML::Simple - it's just a way of examining the hash data so that you can see what you've got. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Command line fed to Perl was Re: File::Find again
On Monday 26 March 2007 07:32, Dave Gray wrote: > On 3/25/07, Alan <[EMAIL PROTECTED]> wrote: > > On Sunday 25 March 2007 18:14, Matt Herzog wrote: > > > This is all I needed. I swear I had " /($searchstring)/; " in there at > > > some point before . . . so if I pass it > > > > > > -s "\.properties$" > > > > > > at the command line, it works as expetcted. Nice. > > > > That might be a shell thing? > > > > In Linux bash shell those quotes (I think) tell the shell to not > > interpret anything inside the quotes. > > bash quotes work like perl quotes: > > echo "$PS1" > echo '$PS1' It's a different case here ie not a var, instead it's a command line that's entered into a shell, such command line being passed to Perl. And the command needs to make it to Perl without getting altered before it gets to Perl. -s "\.properties$" In that part of the command line, in this case the $ happens to also be a bash shell meta (or possibly interpreted) character. In this context, I was alledging that perhaps the quotes (on that command line) tell the bash shell to keep it literal (do not interpret the special character $). But, I don't know much. I guess there's even a way to run a Perl script without going through a shell in order to run the Perl script. If so, I don't know how to do it. -- Alan. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
how can I use a variable in the name of an array ?
Hi all, I will get the content of an array via a variable in the name of the array. Is it possibel to join the array in a way as I wrote? I know that my example doesn't work Has anybody a solution for me? Thanks a lot Jo @M1= (a,b); @M2= (e,f); $count = 1; until ( $count > 2 ){ print @M$count ; $count++; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: how can I use a variable in the name of an array ?
Jochen Jansen wrote: > Hi all, Hello, > I will get the content of an array via a variable in the name of the array. > Is it possibel to join the array in a way as I wrote? > I know that my example doesn't work > Has anybody a solution for me? > Thanks a lot > Jo > > @M1= (a,b); > @M2= (e,f); > $count = 1; > until ( $count > 2 ){ > print @M$count ; > $count++; > } You want to use an array of arrays: my @M = ( [ 'a', 'b' ], [ 'e', 'f' ] ); perldoc perldata perldoc perldsc perldoc perllol John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: how can I use a variable in the name of an array ?
On 3/26/07, Jochen Jansen <[EMAIL PROTECTED]> wrote: Hi all, I will get the content of an array via a variable in the name of the array. Is it possibel to join the array in a way as I wrote? I know that my example doesn't work Has anybody a solution for me? Thanks a lot Jo @M1= (a,b); @M2= (e,f); $count = 1; until ( $count > 2 ){ print @M$count ; $count++; } Short answer: you don't, you use an AoA (array of arrays) Medium answer: it looks like this: my @M = ( ['a', 'b'], #create an anonymous array reference ['e', 'f'], #ditto ); for my $subarray (@M) { print @$subarray; } Long answer: You can do it and there are several ways, but none of them are safe or good so you shouldn't. If you are foolish enough to wish to do it anyway or are trying to create obfuscated code (which is also foolish, but fun) take a look at the eval function. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Mimic SMTP server
Hello, I need to create a simple perl script that can mimic an SMTP server. Having some difficulty coming up with a workable solution. The script will need to run as a daemon (24/7) accepting connections on port 25. When a request comes in, the script will take in the email as any SMTP server, parse out the header and message. What is the best way to accomplish this? Are there available modules to can do this? Mickalo -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Telnet question in Perl
I'm using Net::Telnet in my Perl script and I can get through the user login ok. But when I try to "sudo" to root I can't get there. Any ideas? My $TELNET = Net::Telnet->new(Timeout => 10, Prompt => "/$prompt/", Errmode => 'return', Host => "$host"); $TELNET->login($LOGIN, $PASSWD); # I can get this far ok and do commands $TELNET->('sudo su -'); $TELNET->waitfor('/Password/'); $TELNET->print("$PASSWD"); $TELNET->waitfor('/root/'); #I get a pattern match time out on this line I've tried single and double quote as well as no quote. Can' get past it. Don Dukelow -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Telnet question in Perl
simplest questions first... is "sudo" a valid command on that particular system? if so, is "sudo su -" a valid syntax in that environment? is "/Password/" a valid prompt being returned by that system? should the "/"s be a part of the prompt text? i've never included "/"s in my expected returns unless they were part of the text i expected to see, though this could well be a viable format i've never before seen. On 3/26/07, Dukelow, Don <[EMAIL PROTECTED]> wrote: I'm using Net::Telnet in my Perl script and I can get through the user login ok. But when I try to "sudo" to root I can't get there. Any ideas? My $TELNET = Net::Telnet->new(Timeout => 10, Prompt => "/$prompt/", Errmode => 'return', Host => "$host"); $TELNET->login($LOGIN, $PASSWD); # I can get this far ok and do commands $TELNET->('sudo su -'); $TELNET->waitfor('/Password/'); $TELNET->print("$PASSWD"); $TELNET->waitfor('/root/'); #I get a pattern match time out on this line I've tried single and double quote as well as no quote. Can' get past it. Don Dukelow -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- since this is a gmail account, please verify the mailing list is included in the reply to addresses
Re: Telnet question in Perl
the "/"s i was referring to are in your 'waitfor' texts - Password shows '/Password/' rather than 'Password' -> waitfor('/Password/') root shows '/root/' rather than 'root' -> waitfor('/root/') if that doesn't point to the problem, i can't help any further. hopefully someone else can. On 3/26/07, Dukelow, Don <[EMAIL PROTECTED]> wrote: Yes I can manualy sudo using the format shown all the time. What is returned is Password: sorry about the collen when I do it manualy. As for the "/"s I'm not sure which one you mean but I was tring all kinds of thinks to get it to work. That is just what I ended up with. Don Dukelow -Original Message- From: jm [mailto:[EMAIL PROTECTED] Sent: Monday, March 26, 2007 4:22 PM To: beginners@perl.org Subject: Re: Telnet question in Perl simplest questions first... is "sudo" a valid command on that particular system? if so, is "sudo su -" a valid syntax in that environment? is "/Password/" a valid prompt being returned by that system? should the "/"s be a part of the prompt text? i've never included "/"s in my expected returns unless they were part of the text i expected to see, though this could well be a viable format i've never before seen. On 3/26/07, Dukelow, Don <[EMAIL PROTECTED]> wrote: > > I'm using Net::Telnet in my Perl script and I can get through the user > login ok. But when I try to "sudo" to root I can't get there. Any > ideas? > > My $TELNET = Net::Telnet->new(Timeout => 10, > Prompt => "/$prompt/", > Errmode => 'return', > Host => "$host"); > > $TELNET->login($LOGIN, $PASSWD); # I can get this far ok and do > commands > > $TELNET->('sudo su -'); > $TELNET->waitfor('/Password/'); > $TELNET->print("$PASSWD"); > $TELNET->waitfor('/root/'); #I get a pattern match time out > on this line > > I've tried single and double quote as well as no quote. Can' get past > it. > > Don Dukelow > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] For additional > commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ > > > -- since this is a gmail account, please verify the mailing list is included in the reply to addresses -- since this is a gmail account, please verify the mailing list is included in the reply to addresses
Re: Command line fed to Perl was Re: File::Find again
From: Alan <[EMAIL PROTECTED]> > It's a different case here ie not a var, instead it's a command line that's > entered into a shell, such command line being passed to Perl. And the > command needs to make it to Perl without getting altered before it gets to > Perl. > > -s "\.properties$" > > In that part of the command line, in this case the $ happens to also be a > bash > shell meta (or possibly interpreted) character. > > In this context, I was alledging that perhaps the quotes (on that command > line) tell the bash shell to keep it literal (do not interpret the special > character $). > > But, I don't know much. I guess there's even a way to run a Perl script > without going through a shell in order to run the Perl script. If so, I > don't know how to do it. Sorry, I was not paying attention to the thread so I may be off. If you mean from within another script you may use the multiple parameter form of system(): system( $^X, $path_to_script, $param1, $param2, $param3); This way the shell is not involved in any way. Though of course it also means that you can't specify any redirection or anything like that this way. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: how can I use a variable in the name of an array ?
From: "Chas Owens" <[EMAIL PROTECTED]> > On 3/26/07, Jochen Jansen <[EMAIL PROTECTED]> wrote: > > Hi all, > > I will get the content of an array via a variable in the name of the array. > > Is it possibel to join the array in a way as I wrote? > > I know that my example doesn't work > > Has anybody a solution for me? > > Thanks a lot > > Jo > > > > @M1= (a,b); > > @M2= (e,f); > > $count = 1; > > until ( $count > 2 ){ > >print @M$count ; > >$count++; > > } > > Short answer: you don't, you use an AoA (array of arrays) > Medium answer: it looks like this: > > my @M = ( > ['a', 'b'], #create an anonymous array reference > ['e', 'f'], #ditto > ); > > for my $subarray (@M) { > print @$subarray; > } > > > Long answer: You can do it and there are several ways, but none of > them are safe or good so you shouldn't. If you are foolish enough to > wish to do it anyway or are trying to create obfuscated code (which is > also foolish, but fun) take a look at the eval function. eval"" is an overkill. Symbolic references would be enough. Anyway Jochen please read "Why it's stupid to `use a variable as a variable name'" at http://www.plover.com/~mjd/perl/varvarname.html Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Mimic SMTP server
From: "Mike Blezien" <[EMAIL PROTECTED]> > Hello, > > I need to create a simple perl script that can mimic an SMTP server. Having > some > difficulty coming up with a workable solution. > > The script will need to run as a daemon (24/7) accepting connections on port > 25. > When a request comes in, > the script will take in the email as any SMTP server, parse out the header > and > message. > > What is the best way to accomplish this? Are there available modules to can > do > this? Ask search.cpan.org : http://search.cpan.org/search?query=SMTP+server&mode=all = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Diagnosing use/lib problems
Hi all. First time using subroutines in external files. I've had some sporadic success with some simple libs (not modules), but can't seem to get consistent results. I've got a few subs files ending in 'pl' in a folder within my scripts' folder: UnitedScripts (dir) myScript.pl Libs (dir) Lib1.pl, etc I'm using the following (at the moment) to include them: use FindBin qw($Bin); use lib "$Bin/Libs"; I consistently get errors like so: Undefined subroutine &main::route_get_hash called at ./ReadSingleTable.pl line 114. I first assumed is was an @INC problem (I know that much), but printing the contents of @INC clearly shows my path is included: /Users/mike/Code/Perl/UnitedScripts/Libs /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/Library/Perl/5.8.6 ...and so on yeah, they're executable, and yeah, I've tried several approaches. Still no success. Anyone have any idea? Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Win32::OLE packages
Hello All, Does anybody know which package in Win32:OLE will Freeze Panes and call Format Report method in excel document? Thanks in advance, Vladimir
Re: Diagnosing use/lib problems
On 3/26/07, Mike Lesser <[EMAIL PROTECTED]> wrote: Hi all. First time using subroutines in external files. I've had some sporadic success with some simple libs (not modules), but can't seem to get consistent results. What do you mean by "sporadic success"? Does something work only on some invocations of your program? Once you can get it to work, doesn't it keep working? use FindBin qw($Bin); use lib "$Bin/Libs"; 'use lib' doesn't load your library files; it just tells Perl where to find them. You still need to load them (either with require or use). You could put code like this after those two lines; the BEGIN block ensures that the external subroutines are compiled before the following code begins compilation. BEGIN { require "first.pl"; require "another.pl"; require "one_more.pl"; } yeah, they're executable, and yeah, I've tried several approaches. Modules and libraries don't normally need to be marked as executable. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Add directories to @INC
Jeff Pang wrote: I accomplished this by adding the following line to the end of my startup.pl file: push(@INC, "Put path to directory here"); This is not mod_perl list. Since we discuss about common perl scripts not mod_perl,so your way seems not useful here. Instead of being critical maybe you can have shown how to do it in a script or module sense? Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Add directories to @INC
On 3/26/07, Robert Hicks <[EMAIL PROTECTED]> wrote: Jeff Pang wrote: >> I accomplished this by adding the following line to the end of my >> startup.pl file: push(@INC, "Put path to directory here"); >> > > This is not mod_perl list. > Since we discuss about common perl scripts not mod_perl,so your way seems not useful here. Instead of being critical maybe you can have shown how to do it in a script or module sense? Instead of being critical, maybe you could have invoked the FAQ? From perlfaq8: How do I add a directory to my include path (@INC) at runtime? Here are the suggested ways of modifying your include path: the PERLLIB environment variable the PERL5LIB environment variable the perl -Idir command line flag the use lib pragma, as in use lib "$ENV{HOME}/myown_perllib"; The latter is particularly useful because it knows about machine depen- dent architectures. The lib.pm pragmatic module was first included with the 5.002 release of Perl. Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Add directories to @INC
Lee Conine am Montag, 26. März 2007 16:03: Hello (just noted Tom Phoenix's answer with the hint to perlfaq8 after writing, but sending anyway...) > I see that there are a lot of people wanting to know how to add > directories to their @INC permanently. > > I accomplished this by adding the following line to the end of my > startup.pl file: push(@INC, "Put path to directory here"); This appends the new library path to @INC. The usual method however is to prepend it to @INC, so the added paths are searched first. That would lead to unshift @INC, 'Put path to directory here'; Which is better expressed by (see perldoc lib) use lib 'Put path to directory here'; Since the startup script unter mod_perl is also used to preload modules - including your own, located in nonstandard paths - a better place to put it is the beginning of the startup script, as you usually put "use lib"s at the beginning of non-mod_perl scripts and modules. And there is a PERL5LIB env variable too that can be populated with additional library paths and exported, f.e. export PERL5LIB=/opt/osf/lib:/opt/smf/lib:/opt/my_perl/lib so you don't have to change scripts or modules (by placing "use lib"s in it). Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Mimic SMTP server
> >I need to create a simple perl script that can mimic an SMTP server. Having >some >difficulty coming up with a workable solution. > >The script will need to run as a daemon (24/7) accepting connections on port >25. >When a request comes in, >the script will take in the email as any SMTP server, parse out the header and >message. > Hello, Maybe you can check Mail::SMTP::Honeypot as a referenct. http://search.cpan.org/~miker/Mail-SMTP-Honeypot-0.06/Honeypot.pm Once I did almost the same thing as you,used IO::Socket to handle socket connection and implement content parsing by myself. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Add directories to @INC
> >This appends the new library path to @INC. The usual method however is to >prepend it to @INC, so the added paths are searched first. That would lead to > > unshift @INC, 'Put path to directory here'; > Someone (including me) has mentioned many times,this couldn't work. You should: BEGIN { unshift @INC, 'Put path to directory here'; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/