CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
cat with pipe

 



knezi
New User

Dec 6, 2012, 9:24 AM

Post #1 of 7 (1527 views)
cat with pipe Can't Post

Hello,
I want to do this https://github.com/ktoso/sidewinder-x6-linux-macro-key-events/blob/master/run.sh in perl. I've tried this:

Code
print <>;

It's work with other files (cat blabla), but with file /sys/kernel/debug/usb/usbmon/2u not.
Do you know what to do?
Thank you,
Knezi


(This post was edited by knezi on Dec 6, 2012, 9:26 AM)


FishMonger
Veteran / Moderator

Dec 6, 2012, 11:50 AM

Post #2 of 7 (1511 views)
Re: [knezi] cat with pipe [In reply to] Can't Post

That's a useless use of cat example, which you shouldn't do. It's a sign of bad perl coding.

If you provide more details on what you really need to accomplish, we will be able to show you a better approach.


Laurent_R
Enthusiast / Moderator

Dec 6, 2012, 2:59 PM

Post #3 of 7 (1502 views)
Re: [FishMonger] cat with pipe [In reply to] Can't Post


In Reply To
That's a useless use of cat example, which you shouldn't do. It's a sign of bad perl coding.

If you provide more details on what you really need to accomplish, we will be able to show you a better approach.


I totally agree (even though I did not understand everything in what the OP was contemplating to to).


knezi
New User

Dec 8, 2012, 10:53 AM

Post #4 of 7 (1460 views)
Re: [Laurent_R] cat with pipe [In reply to] Can't Post

I want to read output of keyboard connected with usb. Script "cat /sys/kernel/debug/usb/usbmon/2u | perl_file" runs in background and gives output to script in perl which would works with it. Have you got any ideas?
Thank you.


FishMonger
Veteran / Moderator

Dec 8, 2012, 11:12 AM

Post #5 of 7 (1457 views)
Re: [knezi] cat with pipe [In reply to] Can't Post

What kind of keyboard?

For now I'll assume you mean your computer keyboard.

When you press a key on the keyboard, it sends the data to STDIN and that's the filehandle that you read from to get that keyboard input.

If that's not what you're looking for, then you'll need to explain in more clear detail what you need.


FishMonger
Veteran / Moderator

Dec 8, 2012, 11:15 AM

Post #6 of 7 (1456 views)
Re: [knezi] cat with pipe [In reply to] Can't Post

If you need to communicate with other types of usb devices, then use one of the usb modules, such as Device::USB::Device
http://search.cpan.org/~gwadej/Device-USB-0.35/lib/Device/USB/Device.pm


(This post was edited by FishMonger on Dec 8, 2012, 11:16 AM)


knezi
New User

Dec 8, 2012, 12:21 PM

Post #7 of 7 (1450 views)
Re: [FishMonger] cat with pipe [In reply to] Can't Post

I've got Sidewinder X6.

Quote
When you press a key on the keyboard, it sends the data to STDIN and that's the filehandle that you read from to get that keyboard input.

It's exactly what I am looking for.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives