Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use lib "$ENV{LJHOME}/cgi-bin";
- require 'ljlib.pl';
- my $dbr = LJ::get_db_reader();
- my $pub = LJ::S2::get_public_layers();
- my $in = shift @ARGV;
- my $id;
- if ($in =~ /^\d+$/) { # numeric
- $id = $in;
- } elsif ($in) { # redist_uniq
- $id = $pub->{$in}->{'s2lid'};
- } else {
- die("Please specify an ID");
- }
- my $layername = "$id";
- my $lay = LJ::S2::load_layer($id);
- die("Invalid layer $in") unless $lay;
- my $layerinfo = {};
- LJ::S2::load_layer_info($layerinfo, [ $id ]);
- $layername = $layerinfo->{$id}->{'redist_uniq'} if exists $layerinfo->{$id}->{'redist_uniq'};
- my $s2code = LJ::S2::load_layer_source($id);
- open my $layerfile, "> $ENV{LJHOME}/out.s2"
- or die ("Unable to open $ENV{LJHOME}/out.s2");
- print $layerfile $s2code;
- close $layerfile;
- print "$layername written to $ENV{LJHOME}/out.s2\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement